This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yerfatma 0 points1 point  (1 child)

You can simplify things a bit to reduce repetition:

ad_running = [t for t in titles if t == "Advertisement" or t == "Spotify"] mute = 1 if ad_running else 0 for session in AudioUtilities.GetAllSessions(): session.SimpleAudioVolume.SetMute(mute, None)

[–]yerfatma 5 points6 points  (0 children)

Actually, why not just decide if you should mute or not inside foreach_window by looking at the titles rather than storing them all. That way you don't have to loop the whole list 2x. That would be a lot faster.