First you need to install `wmctrl` and `pulseaudio-utils`:
sudo apt-get install wmctrl pulseaudio-utils then save this script in a file and run:
import subprocess, time class SpotifyAdBlock: def __init__(self): print('Spotify AdBlocker enabled.') self.raise_volume() while(True): found = False windows = self.windows_pipe() if windows.find('Advertisement') >= 0: if not self.volumeIsLow: self.lower_volume() elif self.volumeIsLow: self.raise_volume() time.sleep(1) def raise_volume(self): subprocess.Popen("pacmd \"set-sink-mute 0 0\" > /dev/null", shell=True) self.volumeIsLow = False def lower_volume(self): subprocess.Popen("pacmd \"set-sink-mute 0 1\" > /dev/null", shell=True) self.volumeIsLow = True def windows_pipe(self): # sudo apt-get install wmctrl pulseaudio-utils pipe = subprocess.Popen("wmctrl -l", shell=True, stdout=subprocess.PIPE).stdout return "".join([p.decode("utf-8") for p in pipe.readlines()]) if __name__=='__main__': SpotifyAdBlock()
SOCIAL SHARE CARD GENERATOR