gmdfalk / blockify

mute spotify adverts on linux
MIT License
353 stars 42 forks source link

Muting does not work if pulseaudio has a combine-sink. #20

Closed illuxio closed 9 years ago

illuxio commented 9 years ago

Because combine-sink has no pid the formating does not work.

idxd = {info[3 * n + 2]: (info[3 * n], info[3 * n + 1]) for n in range(len(info) // 3)}

My output of the "info"

info = [u'0', u'no', u'1', u'no', u'4516', u'2', u'no', u'4516']

gmdfalk commented 9 years ago

Hey,

what is the output of pacmd list-sink-inputs for you?

P.S.: Try this:

info = sorted(pattern.findall(output)) mid = len(info) // 2 idxd = {info[mid] if len(info) % 2 else info[mid-1] : (info[0], info[-1])}

or pull the combine-sink_fix branch i just pushed.

Regards

This is a quick and dirty fix which should work as long as at least one process id somehow makes its way into the list info and the amount of no/yes is the same as the amount of single digits in the list ... To do more, i'd need to see the output of list-sink-inputs on your system (and maybe read up on combine-sink as i don't know what exactly that module does here, i don't really use pulse).

illuxio commented 9 years ago

3 sink input(s) available. index: 0 driver: flags: VARIABLE_RATE DONT_MOVE NO_CREATE_SUSPEND state: RUNNING sink: 0 volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 muted: no current latency: 0.00 ms requested latency: 99.95 ms sample spec: s16le 2ch 44100Hz channel map: front-left,front-right Stereo resample method: trivial module: 14 properties: media.name = "Simultaneous output on Built-in Audio Analog Stereo" media.role = "filter" module-stream-restore.id = "sink-input-by-media-role:filter" index: 5 driver: flags: START_CORKED state: RUNNING sink: 1 volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 muted: no current latency: 118.89 ms requested latency: 99.95 ms sample spec: s16le 2ch 44100Hz channel map: front-left,front-right Stereo resample method: (null) module: 10 client: 1593 properties: media.name = "Playback" application.name = "Chromium" native-protocol.peer = "UNIX socket client" native-protocol.version = "29" application.process.id = "9024" application.process.binary = "spotify" window.x11.display = ":0" application.language = "en_US.UTF-8" application.icon_name = "spotify-client" module-stream-restore.id = "sink-input-by-application-name:Chromium" index: 6 driver: flags: START_CORKED state: RUNNING sink: 1 volume: front-left: 65535 / 100% / -0.00 dB, front-right: 65535 / 100% / -0.00 dB balance 0.00 muted: no current latency: 1911.18 ms requested latency: 99.95 ms sample spec: s16le 2ch 44100Hz channel map: front-left,front-right Stereo resample method: (null) module: 10 client: 1611 properties: media.role = "music" media.name = "Spotify" application.name = "Spotify" native-protocol.peer = "UNIX socket client" native-protocol.version = "29" application.process.id = "9024" application.process.binary = "spotify" window.x11.display = ":0" application.language = "en_US.UTF-8" application.icon_name = "spotify-client" module-stream-restore.id = "sink-input-by-media-role:music"

gmdfalk commented 9 years ago

and spotify is running in two of your three sinks?

Also, nevermind the fix branch, i just noticed that yes/no and single digits are in fact often uneven, rendering mute useless. I'll have to do it some other way.

illuxio commented 9 years ago

Strangely, yes.

Index 5 appiers when I start sportify and index 6 manages the sound.

gmdfalk commented 9 years ago

Can you check if the current combine-sink_fix branch fixes the issue?

gmdfalk commented 9 years ago

http://a.pomf.se/vhfdna.jpg

Merged to master, let me know if you experience further issues with this.

illuxio commented 9 years ago

Looks fine.