Giter Club home page Giter Club logo

blockify's People

Contributors

abrahambotros avatar baongoc124 avatar cossio avatar diogocp avatar ffy00 avatar florianfranzen avatar gmdfalk avatar hstarmans avatar nopeppermint avatar rod-persky avatar ryuzakikk avatar senden9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockify's Issues

Songs are blocked when they shouldn't be

I open a new issue to keep it separate from the solved one

So, I have tried with the default settings and it happens as well, these are the steps i did:

  • temporally renamed the config, playlist and blocklist in order to use the default settings
  • open the spotify window
  • start a song
  • quickly click on the next song button

You'll see in the blockify (CLI) log that sometimes it blocks some songs, even if the blocklist is empty

This is a quick way I've found to replicate it, the same problem happens also without skipping songs, but just when you listen to spotify normally. Sometimes I see that it blocked a song, and started the interlude when it shouldn't have, I don't know how to replicate this, it appears to be quite random

doesnt work anymore

it seems like the newest spotify version circumvent the adblock somehow :/

blockify doesn't work on arch linux

I have used blockify since early versions and works great, but when I updated to version 1.4.2 it doesn't work anymore.I checked the dependencies and reinstalled it but didn't solve the problem. I'm posting the command line exit of blockify-ui to clarify the possible problem.

2014-12-20 11:22:01 INFO util Loglevel is 20.
2014-12-20 11:22:01 INFO main Loading blockfile from /home/aram/.config/blockify/blocklist.
2014-12-20 11:22:01 INFO main Setting autodetect to: True.
2014-12-20 11:22:01 INFO main Interlude playlist is: []
2014-12-20 11:22:01 INFO main Blockify initialized.
2014-12-20 11:22:01 INFO main Setting autodetect to: True.
2014-12-20 11:22:01 INFO gui Blockify-UI started.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/blockify-1.4-py2.7.egg/blockify/blockifyui.py", line 356, in update
self.update_cover()
File "/usr/lib/python2.7/site-packages/blockify-1.4-py2.7.egg/blockify/blockifyui.py", line 369, in update_cover
cover_file = self.get_cover_art()
File "/usr/lib/python2.7/site-packages/blockify-1.4-py2.7.egg/blockify/blockifyui.py", line 448, in get_cover_art
cover_hash = os.path.basename(self.b.dbus.get_art_url())
File "/usr/lib/python2.7/posixpath.py", line 121, in basename
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'

I like your program but I hope you help me to fix this to keep using it.
Sincerely,
Aram

correct way of installing spotify

Blockify requires Spotify > 1.0.12. If you install Spotify via https://www.spotify.com/nl/download/linux/, you end up with an old version and blockify does not work (tested on Ubuntu 14.04).
As a fix, use the official instructions for the beta spotify version; https://community.spotify.com/t5/Spotify-Community-Blog/Spotify-Client-1-x-beta-for-Linux-has-been-released/ba-p/1147084.
It would be nice if the blockify manual was updated and outlines how to install spotify or links to the correct instructions.

update on AUR

Hi, I saw that the last update in GIT is in september 2014, but in AUR I find may 2014.

when will be done the update on AUR?
(I' m tired to listen ads on Spotify ;) )

Permanent Mute

Hello mikar,

Blockify has been working without any problems on Ubuntu 15.04 but today I had to completely reinstall it and now Blockify does not work. It launches fine but if in GUI I select autodetect and automute - it mutes everything, including spotify songs and never unmute it.

If I run blockify in the terminal - nothing comes up and it is working in the same manner as above.

Any solution to this?

Unmute after add not working

Blockify detects and blocks adds (mutes program mixer) but does not unmute it after add finishes.
I have to manually enter sound controls and unmute the spotify mixer after each add.

When using a playlist it furthermore does not resume playing on spotify after the playlist song finishes. I have to restart spotify to make it posible to play the next song. Seems like signals only go one way:
spotify->blockify
not
blockify->spotify
Here is the version number and logfile of the last try.
blockify --version 1.8.7

2015-07-08 15:09:04 DEBUG    util     Added logging file handler: /home/niceri/logfile.
2015-07-08 15:09:04 INFO     util     Loading configuration.
2015-07-08 15:09:04 INFO     util     Configuration file loaded from /home/niceri/.config/blockify/blockify.ini.
2015-07-08 15:09:04 INFO     list     Blocklist loaded from /home/niceri/.config/blockify/blocklist.txt.
2015-07-08 15:09:04 INFO     player   InterludePlayer initialized.
2015-07-08 15:09:04 DEBUG    player   Loading playlist.
2015-07-08 15:09:04 DEBUG    player   Stop: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_NU$
2015-07-08 15:09:04 DEBUG    player   Setting interlude to: /home/niceri/Music/Ricardo Arjona - Vida (Video Oficial)-Jzn3yVu1XsE.m4a
2015-07-08 15:09:04 INFO     player   Playlist loaded (Length: 1263).
2015-07-08 15:09:04 INFO     player   Playlist: ['Ricardo Arjona - Vida (Video Oficial)-Jzn3yVu1XsE.m4a', 'rebuild.pdf', 'tuning.pdf',$
2015-07-08 15:09:04 DEBUG    main     Mute method is pulse sink.
2015-07-08 15:09:04 INFO     main     Blockify initialized.
2015-07-08 15:09:04 INFO     main     Blockify started.
2015-07-08 15:15:27 INFO     main     Muting Amason – Ålen.

And here is some output copied from the console when using a personal playlist and blockify -vvv (unecessary info removed)

2015-07-08 14:54:10 INFO     main     Blockify started.
2015-07-08 15:05:34 INFO     main     Muting Absolute Dance – Absolute Dance.
2015-07-08 15:05:35 INFO     player   Playing interlude: /home/niceri/Music/Ricardo Arjona - Vida (Video Oficial)-Jzn3yVu1XsE.m4a
2015-07-08 15:05:35 DEBUG    player   Play: State is (<enum GST_STATE_CHANGE_FAILURE of type GstStateChangeReturn>, <enum GST_STATE_READY of type GstState>, <enum GST_STATE_PLAYING of type GstState>).
2015-07-08 15:05:38 DEBUG    player   Setting index to: 1.
2015-07-08 15:05:38 DEBUG    player   Setting interlude to: file:///home/niceri/Music/Fields of Africa.flac
2015-07-08 15:05:38 DEBUG    player   Setting index to: 0.
2015-07-08 15:05:38 INFO     player   Playing interlude: file:///home/niceri/Music/Fields of Africa.flac
2015-07-08 15:05:38 DEBUG    player   Play: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_PLAYING of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
2015-07-08 15:05:38 INFO     main     Muting Absolute Dance – Absolute Dance.

2015-07-08 15:06:35 INFO     main     Muting Topsify – FRESH.
2015-07-08 15:06:35 DEBUG    player   Setting index to: 1.
2015-07-08 15:06:35 DEBUG    player   Setting interlude to: file:///home/niceri/Music/Fields of Africa.mp3
2015-07-08 15:06:35 DEBUG    player   Interlude song finished. Queued: file:///home/niceri/Music/Fields of Africa.mp3.
2015-07-08 15:06:35 INFO     main     Muting Topsify – FRESH.
^C2015-07-08 15:08:26 DEBUG    main     2 received. Exiting safely.
2015-07-08 15:08:26 INFO     main     Exiting safely. Bye.

(blockify:30236): GStreamer-CRITICAL **: Failed to deactivate pad mpegaudioparse0:sink, very bad
2015-07-08 15:08:26 DEBUG    player   Stop: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_NULL of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
Traceback (most recent call last):
  File "/usr/bin/blockify", line 9, in <module>
    load_entry_point('blockify==1.8.7', 'console_scripts', 'blockify')()
  File "/usr/lib/python2.7/site-packages/blockify/blockify.py", line 453, in main
    blockify.start()
  File "/usr/lib/python2.7/site-packages/blockify/blockify.py", line 122, in start
    gtk.main()
KeyboardInterrupt

I am furthermore using spotify on Arch linux, installed from the AUR.

Any idea on how to debug this would be appreciated.

To support native Linux version

Hi, why doesn't blockify support native Linux version? It'll just be only ONE line difference from current version. And about ad blocking functionality, I see that current version only blocking from a list. Why don't integrate automatic methods like EZBlocker?

Thanks.

Attempt to unlock mutex that was not locked

When running blockify installed from AUR on Arch Linux I encounter the following error before the process ends:
Attempt to unlock mutex that was not locked

Apparently the problem is triggered by the upgrade from glib2 and can be resolved by removing the line gtk.gdk.threads_init() from some packages but I have been unable to find it in any of the files from this package.

does not block "404 Not Found" ads

When Spotify output says there is a 404 Not Found error for an ad, no notification of the ad is made, and so blockify lets the ad play. As of today, every ad gets a 404 Not Found, so that means blockify allows all ads, at least for me.

I'm running Blockify 1.7.1, Arch 3.18.2-1, Enlightenment 0.19.2-1, Pulseaudio 5.99.2, and Spotify 0.9.11.27-1. Enlightenment is configured to show all three levels of notifications and to use the Enlightenment notification and DBus modules. Song info appears in notifications, and they are recognized by blockify, and the DBus controls work. I don't know if my system is causing the "404 Not Found" errors or if it's happening for everyone.

I wrote a shell script in 5 minutes to mute all "404 Not Found" ads. Here is its output (which is mostly just repeating the stderr of spotify):

12:34:09.247 I [head_file_streamer.cpp:106 ] Requesting head file from CDN url: http://heads-ec.spotify.com/head/3ec8731d67ad9b18cb7aec929f24ff8edf2e60ef
12:34:09.247 D [spirc_manager.cpp:578 ] GAIA: SpircManager::stpLoad, track=spotify:track:0ylMnxkHno7tBynYTV5esa, index=0, position=0, paused=0
*** Track!
12:34:09.247 I [ap_chunk_downloader.cpp:75 ] Requesting data (0 -> 524288) from AP for file 3ec8731d67ad9b18cb7aec929f24ff8edf2e60ef
12:34:09.603 I [http_fetch_connection.cpp:362 ] Result 404 Not Found
*** Ad!
12:34:10.881 I [ap_chunk_downloader.cpp:174 ] Request for file 3ec8731d67ad9b18cb7aec929f24ff8edf2e60ef complete (code: 0)

Here is blockify-ui's -vvv output:

2015-01-10 14:11:49 DEBUG util Added logging console handler.
2015-01-10 14:11:49 INFO util Loglevel is 10 (10=DEBUG, 20=INFO, 30=WARN).
2015-01-10 14:11:49 INFO list Blocklist loaded from /home/user/.config/blockify/blocklist.txt.
2015-01-10 14:11:49 INFO util Configuration file loaded from /home/user/.config/blockify/blockify.ini.
2015-01-10 14:11:49 INFO player InterludePlayer initialized.
2015-01-10 14:11:49 DEBUG player Loading playlist.
2015-01-10 14:11:49 DEBUG player Stop: State is (, , ).
2015-01-10 14:11:49 DEBUG player Setting interlude to: file:///media/Passport/Music/Waldeck/Balance Of The Force/01 Defenceless.mp3
2015-01-10 14:11:49 INFO player Playlist loaded (Length: 69).
2015-01-10 14:11:49 INFO player Playlist: ['file:///media/Passport/Music/Waldeck/Balance Of The Force/01 Defenceless.mp3']
2015-01-10 14:11:49 DEBUG main Mute method is pulse sink.
2015-01-10 14:11:49 INFO main Blockify initialized.
2015-01-10 14:11:49 DEBUG main Autodetect: True.
2015-01-10 14:11:49 DEBUG main Automute: True.
2015-01-10 14:11:49 DEBUG gui Enabled automute.
2015-01-10 14:11:49 INFO gui Blockify-UI initialized.
2015-01-10 14:11:49 INFO gui Blockify-UI started.
2015-01-10 14:34:09 INFO main Forcing unmute.

Where it says "Forcing unmute", your program undid my program's muting of an ad. (Note where my program says, "Ad!" at the same timestamp.) I'm not asking your program to play nicely with my program (though I'm not sure why it insists on unmuting.) I'm just saying your program misses every ad at present, at least for me. It is, however, very impressive otherwise. You could fix it by launching spotify from blockify (unless there is an easier way to grab stderr), and then just look for that text. I'm not sure, but you might be able to do away with the need for notifications while you're at it.

blockify cant start (TypeError: option values must be strings)

Hi,
blockify cant start on my setup. To exclude a config mistake i removed the blockify and spotify config. I start first spotify and after that blockify. For the installation i used the AUR package
Please see the log below for the stacktrace.

.-(/tmp)----------------------------------------------------------------------------------------------------------------------------------(stefano@STEFANO-PC)-
`--> rm -r ~/.config/blockify
.-(/tmp)----------------------------------------------------------------------------------------------------------------------------------(stefano@STEFANO-PC)-
`--> blockify --version      
3.0.1
.-(/tmp)----------------------------------------------------------------------------------------------------------------------------------(stefano@STEFANO-PC)-
`--> blockify -vvv     
2015-11-08 09:24:01 DEBUG    util     Added logging console handler.
2015-11-08 09:24:01 INFO     util     Loglevel is 10 (10=DEBUG, 20=INFO, 30=WARN).
2015-11-08 09:24:01 INFO     util     Loading configuration.
2015-11-08 09:24:01 ERROR    util     Could not parse option autodetect for section general. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option automute for section general. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option autoplay for section general. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option start_spotify for section general. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option substring_search for section general. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option update_interval for section cli. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option unmute_delay for section cli. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option use_cover_art for section gui. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option autohide_cover for section gui. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option update_interval for section gui. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option unmute_delay for section gui. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option use_interlude_music for section interlude. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option start_shuffled for section interlude. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option autoresume for section interlude. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option radio_timeout for section interlude. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option playback_delay for section interlude. Using default value.
2015-11-08 09:24:01 ERROR    util     Could not parse option playlist for section interlude. Using default value.
2015-11-08 09:24:01 INFO     util     Configuration file loaded from /home/stefano/.config/blockify/blockify.ini.
2015-11-08 09:24:01 INFO     util     Creating config directory.
2015-11-08 09:24:01 INFO     util     Creating thumbnail directory.
Traceback (most recent call last):
  File "/usr/bin/blockify", line 9, in <module>
    load_entry_point('blockify==3.0.1', 'console_scripts', 'blockify')()
  File "/usr/lib/python3.5/site-packages/blockify/cli.py", line 590, in main
    cli = initialize()
  File "/usr/lib/python3.5/site-packages/blockify/cli.py", line 583, in initialize
    util.initialize(doc)
  File "/usr/lib/python3.5/site-packages/blockify/util.py", line 169, in initialize
    init_config_dir()
  File "/usr/lib/python3.5/site-packages/blockify/util.py", line 66, in init_config_dir
    save_options(CONFIG_DIR, get_default_options())
  File "/usr/lib/python3.5/site-packages/blockify/util.py", line 150, in save_options
    config.set(section, k, v)
  File "/usr/lib/python3.5/configparser.py", line 1190, in set
    self._validate_value_types(option=option, value=value)
  File "/usr/lib/python3.5/configparser.py", line 1175, in _validate_value_types
    raise TypeError("option values must be strings")
TypeError: option values must be strings
[1]    16796 exit 1     blockify -vvv
.-(/tmp)----------------------------------------------------------------------------------------------------------------------------------(stefano@STEFANO-PC)-
`--> tree ~/.config/blockify/       
/home/stefano/.config/blockify/
└── thumbnails

1 directory, 0 files
.-(/tmp)----------------------------------------------------------------------------------------------------------------------------------(stefano@STEFANO-PC)-
`--> pacman -Q spotify 
spotify 1.0.17.75-2

Please say if you need additional infos.

Edit 1:
I add the following to line 150 in blockify/util.py:

    for section in sections:
        config.add_section(section)
        for k, v in options[section].items():
            print(type(section), type(k), type(v))  # <-- here
            print(section, k, v) # <-- and here
            config.set(section, k, v)

And now i get this additional info:

[…]
2015-11-08 09:47:50 INFO     util     Configuration file loaded from /home/stefano/.config/blockify/blockify.ini.
<class 'str'> <class 'str'> <class 'bool'>
general substring_search False
Traceback (most recent call last):
  File "/usr/bin/blockify", line 9, in <module>
[…]

Edit 2:
I fix it by replacing "config.set(section, k, v)" with "config.set(section, k, str(v))". I check side-effects before creating a pullrequest.

Ad-blocking does not work

I'm using blockify on arch linux and I've installed it through the AUR package (not the -git version.) blockify-ui shows the current track and I can change the track through it but when an ad plays it doesn't mute it and shows "No song playing?" in the window.

~$ blockify --version
3.0.2
2015-11-11 16:18:16 DEBUG    util     Added logging file handler: /home/julian/blockify.log.
2015-11-11 16:18:16 INFO     util     Loading configuration.
2015-11-11 16:18:16 INFO     util     Configuration file loaded from /home/julian/.config/blockify/blockify.ini.
2015-11-11 16:18:16 INFO     list     Blocklist loaded from /home/julian/.config/blockify/blocklist.txt.
2015-11-11 16:18:16 INFO     player   InterludePlayer initialized.
2015-11-11 16:18:16 DEBUG    player   Loading playlist.
2015-11-11 16:18:16 DEBUG    player   Stop: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_NULL of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
2015-11-11 16:18:16 INFO     player   Playlist loaded (Length: 0).
2015-11-11 16:18:16 INFO     player   Playlist: []
2015-11-11 16:18:17 DEBUG    cli      Mute method is alsa or pulse without sinks.
2015-11-11 16:18:17 INFO     cli      No pulse sinks found, falling back to system mute via alsa/pulse.
2015-11-11 16:18:17 INFO     cli      Blockify initialized.
2015-11-11 16:18:17 INFO     cli      Blockify started.
2015-11-11 16:25:34 WARNING  cli      Spotify was closed!
2015-11-11 16:25:44 DEBUG    cli      2 received. Exiting safely.
2015-11-11 16:25:44 INFO     cli      Exiting safely. Bye.

When I start it in a terminal, something constantly prints

Cannot get client list properties. 
(_NET_CLIENT_LIST or _WIN_CLIENT_LIST)

The log also says that it can't find pulse sinks but I'm using pulseaudio and I can mute spotify individually via pavucontrol. However, when I use the command pacmd list-sink-inputs it prints Daemon not responding..

"Show desktop notifications when the track changes" is enabled but I don't have any programs installed that would show the notification.

I'm using a fork of dwm as my window manager.

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

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']

How to install on Fedora:

Hey mikar, love the app, can't use Spotify without it!

I got it to install on Fedora 22 with this method and thought I'd post here in case you want to post the install method on your page:

Instead of "sudo pip install http://github.com/mikar/blockify/archive/v1.8.3.zip," (I put the zip in my home folder for compiling because I didn't realize I could use a url yet.) I ran:

 sudo pip install blockify-master.zip

Then the dependencies under Fedora are:

 sudo dnf install python-dbus
 sudo dnf install gstreamer-python
 sudo dnf install gnome-python2-libwnck

After this I was able to run blockify. Thanks for developing this.

Segmentation fault when the playlist finishes

I have only one song in the playlist (~2min song) and use the non UI version (so with the autoresume enabled). With that length I hear it few times before the song finishes, but at that point blockify crashes.

This is the log:

$ blockify
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
2014-12-23 12:18:46 INFO     util     Loglevel is 20.
2014-12-23 12:18:46 INFO     list     Loading blockfile from /home/user/.config/blockify/blocklist.
2014-12-23 12:18:46 INFO     main     Blockify initialized.
2014-12-23 12:18:46 INFO     main     Blockify started.
2014-12-23 12:18:46 INFO     main     Muting Spotify – Spotify.
2014-12-23 12:18:57 INFO     main     Unmuting.
2014-12-23 12:39:11 INFO     main     Muting Spotify – Spotify.
2014-12-23 12:40:02 INFO     main     Unmuting.
2014-12-23 12:52:32 INFO     main     Muting Johnny Mathis – When A Child Is Born.
2014-12-23 12:52:33 INFO     main     Unmuting.
2014-12-23 12:59:26 INFO     main     Muting Sony Music – Best 2014.
[1]    8534 segmentation fault (core dumped)  blockify

and the playlist:

file:///home/user�/.config/blockify/piano.mp3

support for 1.0.9 (without dbus)

version 1.0.9 has no dbus support. a workaround is needed, i think the only possibility is xprop/wmctrl/xwininfo and blacklists...

No handlers could be found for logger "util"

Hey mikar, so far I've gotten this error when I start blockify from the terminal on every distribution I've tried it on. Despite that, the app continues to run and works so feel free to dismiss this post if you already know and it's not an issue.

No handlers could be found for logger "util"
2015-07-23 10:41:28 ERROR dbus Spotify not found in DBus session. Is it running?
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
2015-07-23 10:41:28 ERROR player Could not parse playlist source: [Errno 2] No such file or directory: '/home/roman/.config/blockify/playlist.m3u'

Thanks again!

[suggestion] integrate interlude player with spotify controls

First of all, thanks for amazing piece of software, doing really great job unlike most ad muting scripts out there :)
I have one suggestion though, that would make it GODLIKE for me:
If I want the whole song to play through rather than autoresuming I HAVE TO listen to whole track. If I click next on spotify track changes, but it is still paused, and interlude player track goes on.
If interlude player would stop and let spotify play the track that would be perfect :)
I hope that's not something impossible,
Keep up the good work :)

Remove wmctrl dependency

Blockify currently uses wmctrl to find the Spotify window and extract its title.

This isn't necessary as DBus provides enough metadata to detect if the current track is an ad:

a) Commercials have title information but blank artist info
b) Commercials have a different track url (https://open.spotify.com/ad/id instead of https://open.spotify.com/track/id)

Metadata can be checked via dbusclient.py, e.g. python dbusclient.py get all

To implement this, the current_song_is_ad() method could look like this return self.dbus.get_song_title() and not self.dbus.get_song_artist() and the wmctrl resp. get_windows logic could be removed entirely.

Two issues with translations and condition construction

I found two issues:

  1. Translations: I'm using Manjaro with Polish locale and command pacmd list-sink-inputs actually returns on my system muted: tak or muted: nie ("tak" for "yes" and "nie" for "no") and as far as I can see you have hardcoded "yes" and "no" in pulsesink_mute method :) Currently I have no universal solution yet but I believe that we should read values for "yes" and "no" from system properties.
  2. For me condition construction is_ad = self.current_song != self.dbus.get_song_artist() + u" \u2013 " + self.dbus.get_song_title() doesn't work. I had to change it to
dbus_info = self.dbus.get_song_artist() + u" \u2013 " + self.dbus.get_song_title()
is_ad = self.current_song != dbus_info

in order to get it to work. I don't have experience in coding in Python so I cannot explain it but this is what I found under Python debugger.

Blockify will not start properly if an ad is playing in Spotify

If you try to start blockify while an ad is playing, the function to get the current song being played through the dbus returns an uncaught null value. As the following stack trace shows:

Traceback (most recent call last):
File "/usr/bin/blockify", line 9, in
load_entry_point('blockify==1.0', 'console_scripts', 'blockify')()
File "/usr/lib/python2.7/site-packages/blockify/blockify.py", line 399, in main
blockify.update()
File "/usr/lib/python2.7/site-packages/blockify/blockify.py", line 163, in update
if self.current_song_is_ad():
File "/usr/lib/python2.7/site-packages/blockify/blockify.py", line 146, in current_song_is_ad
u" \u2013 " + self.dbus.get_song_title()
TypeError: unsupported operand type(s) for +: 'NoneType' and 'unicode'

Mint 17 KDE4: blockify won't run

below the error I get when launch blockify from terminal with -vvv option:
http://pastebin.com/GmeJCtFq

I have no idea of what could be, but I know that I could not install pygtk gstreamer0.10-python, in addition instead of install pyton2-wnck and pythom2-dbus I installed pyton-wnck and python-dbus

the version is 1.7.2

Thanks

Permanent mute

After an ad is muted successfully, if a song comes up, muting still continues till I manually unmute my system. I'm using GUI (mute tracks and auto add tracks are checked), but problem persist on the normal blockify as well. Is there anyway to fix this?

Great piece of software by the way. Thanks.

System: Ubuntu 14.04

error "Cannot connect to DBus"

Hi, when I launch blockify I see this error message:

2014-11-21 08:17:07 ERROR main Cannot connect to DBus. Autodetection and Player Controls will be unavailable (org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.).
Traceback (most recent call last):
File "/usr/bin/blockify", line 9, in
load_entry_point('blockify==1.0', 'console_scripts', 'blockify')()
File "/usr/lib/python2.7/site-packages/blockify/blockify.py", line 416, in main
blockify = Blockify(blocklist)
File "/usr/lib/python2.7/site-packages/blockify/blockify.py", line 109, in init
self.try_enable_dbus()
File "/usr/lib/python2.7/site-packages/blockify/blockify.py", line 151, in try_enable_dbus
if self.dbus.is_running():
AttributeError: 'NoneType' object has no attribute 'is_running'

what's happened?

Thanks in advance

Add autoresume as a config (non UI)

I use the non UI version of blockify and it'd be useful to have the autoresume setting somewhere in the configs in order to turn it off

That would help also the UI to save it, currently when you close and open it again it resets to true

Start automatically with Spotify?

I'm struggling to get blockify to start automatically at the same time as Spotify. I'm using the default .desktop file which is provided by Spotify:

[Desktop Entry]
Name=Spotify
GenericName=Music Player
Comment=Listen to music using Spotify
Icon=spotify-client
Exec=spotify %U
TryExec=spotify
Terminal=false
Type=Application
Categories=Qt;Audio;Music;Player;AudioVideo
MimeType=x-scheme-handler/spotify

Any suggestions on how to achieve this? I tried changing the Exec line to spotify %U & blockify (which works ok from bash), but this doesn't start blockify when launched from Gnome.

I can hear ads during interlude

Hi,
The interlude works and starts playing when ad begins, but I can hear both the interlude song and the ad together.
(Blockify 1.8.8 on Archlinux, pulseaudio, Spotify 0.9.17.8)
Thanks for this great piece of software!

Being able to (mostly) catch ads automatically

Though the current system works, I'm sure I'm not the only one to find it jarring to suddenly hear offending ads and then having to silence them manually. Would it not be possible to parse the "song" name and, using a regular expression, match any occurrences of common companies? Here is my (slightly edited to protect my location) .blockify_list:

ProFlowers – ProFlowers
O'Reilly Auto Parts – O'Reilly Auto Parts
O'Reilly Auto Parts – O'Reilly Auto Parts
Universal Music – Digster Country
Universal Music – Digster Country
Universal Music – 5 Seconds of Summer
Universal Music – 5 Seconds of Summer
Audible – Audible
McDonald's – Dollar Menu & More
McDonald's – Dollar Menu at Breakfast
Buffalo Wild Wings – Buffalo Wild Wings
Interdynamics R134a Refrigerant – O'Reilly Auto Parts
Verizon Wireless – Verizon Wireless
Warby Parker – Warby Parker
Win Gas for Life – O'Reilly Auto Parts
Graze.com – Graze.com
Autotrader.com – Autotrader.com
Sony Music – Jack White
Universal Pictures – A Million Ways to Die in the West
Big Smo – A&E
Sony Music – Jake Owen
DoubleDown Casino – Where The World Plays.
GRAZE.COM – GRAZE.COM
Web – O'Reilly Auto Parts
Car Wash – O'Reilly Auto Parts
Coca-Cola Ahh – Coca-Cola Ahh
Chick-fil-A – 2014
Verizon – Verizon
Dr Pepper – Dr Pepper
2014 FIFA World Cup – 2014 FIFA World Cup
DASANI Drops – DASANI Drops
Red Bull – Red Bull
Kelley Blue Book – Price Advisor
SyFy Defiance – SyFy Defiance
Syfy Defiance – Syfy Defiance
Chick-fil-A – Pop
Wilfred FXX – Wilfred FXX

If you gaze through the list, you'll see many company names pop out at you--Verizon, Coca-Cola, O'Reilley, etc. These names are very prominent and very obvious, thus very easy to block by simply searching for famous company names. Even certain ones have the telling .com in the name, something not usually found in song titles. Now, some things can't be caught, such as the very specific FIFA World Cup ad, but by automating a large portion of the ad blocking, blocking spotify ads no longer has to be a tedious chore that crops up each time Spotify updates its ad list.

There are a few issues with this set-up, mainly the possibility of false positives with vague names such as "Verizon". A cursory search for "Verizon" came up with a few songs/albums with name in it. Now, there are three ways that (when effectively combined) can make this a non-issue (should it even become one):

  1. Notifications alerting the user when something has been automatically blocked. Assuming that they are consciously trying to play a song that triggers the false positive, it will be immediately evident that blockify was be overzealous
  2. Have an organized list of keywords to search for that can be freely edited by the user if they run into problems with a particular brand-name (such as "Verizon")
    • However, if there is only a few edge cases being brought up, perhaps a whitelist for those particular songs could be checked against? However, this might make the application unwieldy when the user has to pay attention to three lists
  3. Certain names can only be blocked if they are found descriptions that point toward a product (i.e: Verizon Wireless – Verizon Wireless)
    • However, this would not catch certain vague ads (such as Verizon – Verizon), so the worth of additional keyword identifiers is questionable
    • Additional keywords should not be required, but if a more strict muting is necessary then it is an option

And finally, this feature would obviously be very experimental, so a certain flag should be set by the user in the initial stages so he/she is not suddenly without music.

Shuffle the interlude playlist

I've noticed that the playlist (I have a single directory with various mp3 in it) is always loaded in the same way. It'd be nice to have an option in the config to enable it to be shuffled. I always ear the same songs (the first ones in the playlist) even if I have hundreds in the directory

No sink input found with this index.

Hi, whenever an ad comes up I get this message in the command line:

Welcome to PulseAudio! Use "help" for usage information.

No sink input found with this index.

So the ad is detected but Blockify can't find the input to mute it. Any ideas?

Autoblocking not working

3.17.4-1-ARCH
Installed from AUR. Spotify Linux Version.

blockify -vvv
2014-11-27 13:36:43 DEBUG main Added logging console handler.
2014-11-27 13:36:43 INFO main Loglevel is 10.
2014-11-27 13:36:43 INFO main Loading blockfile from /home/monkee/.blockify_list.
2014-11-27 13:36:43 WARNING main No blockfile found. Created one.
2014-11-27 13:36:44 INFO main Blockify initialized.

~/.blockify_list is empty too.

If this matters: If I try to mute sound (with my keyboad shortcut) while spotify is playing, blockify unmutes it:
2014-11-27 13:36:43 DEBUG main Added logging console handler.
2014-11-27 13:36:43 INFO main Loglevel is 10.
2014-11-27 13:36:43 INFO main Loading blockfile from /home/monkee/.blockify_list.
2014-11-27 13:36:43 WARNING main No blockfile found. Created one.
2014-11-27 13:36:44 INFO main Blockify initialized.
2014-11-27 13:52:02 INFO main Unmuting.
2014-11-27 13:52:26 INFO main Unmuting.
2014-11-27 13:52:27 INFO main Unmuting.

edit
blockify-ui: next/prev buttons are not working. Toggle play is not working...

Doc update required

Blockify v3.0.1 needs the setuptools module in python, which must be listed as a required dependency on the readme file.
On a similar note, the PKGBUILD config file for Arch must be updated to use python3 (on line line 26).

Wish: Play "Mute Music" whan Ad is muted

Hi,

I dont know if this is the wright section.... This is the first time i want to be an active user... :D So ist there a chance to add a custom "Mute Music" for Ads? So there is no Silence in Spotify?

Best wishes from Hamburg, Germany

"pacmd_muted_value" option cannot be set because of typo in util.py

There is a typo near the end of line 121 in util.py:
-"pamcd_muted_value"
+"pacmd_muted_value"

Without this option blockify can mute, but not unmute, if language is non-english.
I need this option to get blockify to work, i have changed this typo and built blockify, and it works for me.

This issue is related to #38

I guess one ugly solution to not require this option could be to just unmute and read the pacmd "muted" value at the start of blockify
Out of curiosity, why is there a need to check if spotify is muted or not, if there is an ad running, mute, if not, unmute, right? No?

BTW, thanks for this awesome application :)

Fix playback status

According to dbus info for Spotify, it should support the [PROPERTY] org.mpris.MediaPlayer2.Player.PlaybackStatus(PlaybackStatus:s) (mdbus2 org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2)
but since Spotify v1.0.0 this feature is broken and/or NYI.

Consequently, blockify currently cannot detect whether a song is playing which impairs interlude music and gui functionality.
However, playback status can also be queried via pulseaudio e.g. pacmd list-sink-inputs.
Example output:

    index: 69
        driver: <protocol-native.c>
        flags: START_CORKED
        state: RUNNING
        sink: 0 <alsa_output.pci-0000_00_1b.0.analog-stereo>
        volume: front-left: 65535 / 100% / -0.00 dB,   front-right: 65535 / 100% / -0.00 dB
                balance 0.00
        muted: no
        current latency: 1064.83 ms
        requested latency: 980.00 ms
        sample spec: s16le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        resample method: (null)
        module: 8
        client: 11208 <Spotify>
        properties:
                media.role = "music"
                media.name = "Spotify"
                application.name = "Spotify"

where state: RUNNING indicates that the sink is actively streaming.

Until that DBus property is reimplemented, playback information could be queried this way.

Random segmentation faults

From 1.8.0 I'm getting some random seg faults, I initially tought it was because of corrupted files, but I've noticed that a file has been played correctly while few minutes before it resulted in a seg fault. With 1.7.2 and before it worked well

$ blockify -vvvv
2015-03-17 19:59:10 DEBUG    util     Added logging console handler.
2015-03-17 19:59:10 INFO     util     Loglevel is 10 (10=DEBUG, 20=INFO, 30=WARN).
2015-03-17 19:59:10 INFO     list     Blocklist loaded from /home/user/.config/blockify/blocklist.txt.
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
2015-03-17 19:59:10 INFO     player   InterludePlayer initialized.
2015-03-17 19:59:10 DEBUG    player   Loading playlist.
2015-03-17 19:59:10 INFO     player   Shuffled playlist.
2015-03-17 19:59:10 INFO     player   Playlist: ['4.mp3', '3.mp3', '7.mp3', '1.mp3', '2.mp3', '6.mp3', '14.mp3', '12.mp3', '8.mp3', '5.mp3', '11.mp3', '10.mp3', '9.mp3', '13.mp3']
2015-03-17 19:59:10 DEBUG    player   Stop: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_NULL of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
2015-03-17 19:59:10 DEBUG    player   Setting interlude to: file:///home/user/.config/blockify/music/4.mp3
2015-03-17 19:59:10 INFO     player   Playlist loaded (Length: 14).
2015-03-17 19:59:10 INFO     player   Playlist: ['4.mp3', '3.mp3', '7.mp3', '1.mp3', '2.mp3', '6.mp3', '14.mp3', '12.mp3', '8.mp3', '5.mp3', '11.mp3', '10.mp3', '9.mp3', '13.mp3']
2015-03-17 19:59:10 DEBUG    main     Mute method is pulse sink.
2015-03-17 19:59:10 INFO     main     Blockify initialized.
2015-03-17 19:59:10 INFO     main     Blockify started.
2015-03-17 20:09:27 INFO     main     Muting Spotify – Spotify.
2015-03-17 20:09:28 INFO     player   Playing interlude: file:///home/user/.config/blockify/music/4.mp3
2015-03-17 20:09:28 DEBUG    player   Play: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_PLAYING of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
2015-03-17 20:10:30 INFO     main     Forcing unmute.
2015-03-17 20:13:05 DEBUG    player   Setting index to: 1.
2015-03-17 20:13:05 DEBUG    player   Setting interlude to: file:///home/user/.config/blockify/music/3.mp3
2015-03-17 20:13:05 DEBUG    player   Interlude song finished. Queued: file:///home/user/.config/blockify/music/3.mp3.
2015-03-17 20:13:05 DEBUG    player   Pause: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_PAUSED of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
[1]    32657 segmentation fault (core dumped)  blockify -vvvv
user@neo ~/.config/blockify $ blockify -vvvv
2015-03-17 20:45:06 DEBUG    util     Added logging console handler.
2015-03-17 20:45:06 INFO     util     Loglevel is 10 (10=DEBUG, 20=INFO, 30=WARN).
2015-03-17 20:45:06 INFO     list     Blocklist loaded from /home/user/.config/blockify/blocklist.txt.
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
2015-03-17 20:45:06 INFO     player   InterludePlayer initialized.
2015-03-17 20:45:06 DEBUG    player   Loading playlist.
2015-03-17 20:45:06 INFO     player   Shuffled playlist.
2015-03-17 20:45:06 INFO     player   Playlist: ['3.mp3', '12.mp3', '11.mp3', '6.mp3', '1.mp3', '5.mp3', '7.mp3', '14.mp3', '10.mp3', '4.mp3', '9.mp3', '2.mp3', '13.mp3', '8.mp3']
2015-03-17 20:45:06 DEBUG    player   Stop: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_NULL of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
2015-03-17 20:45:06 DEBUG    player   Setting interlude to: file:///home/user/.config/blockify/music/3.mp3
2015-03-17 20:45:06 INFO     player   Playlist loaded (Length: 14).
2015-03-17 20:45:06 INFO     player   Playlist: ['3.mp3', '12.mp3', '11.mp3', '6.mp3', '1.mp3', '5.mp3', '7.mp3', '14.mp3', '10.mp3', '4.mp3', '9.mp3', '2.mp3', '13.mp3', '8.mp3']
2015-03-17 20:45:06 DEBUG    main     Mute method is pulse sink.
2015-03-17 20:45:06 INFO     main     Blockify initialized.
2015-03-17 20:45:06 INFO     main     Blockify started.
2015-03-17 20:45:06 INFO     main     Muting Believe Music – Playlist Advisor.
2015-03-17 20:45:07 INFO     player   Playing interlude: file:///home/user/.config/blockify/music/3.mp3
2015-03-17 20:45:07 DEBUG    player   Play: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_PLAYING of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
2015-03-17 20:46:01 INFO     main     Forcing unmute.
2015-03-17 20:47:18 DEBUG    player   Setting index to: 1.
2015-03-17 20:47:18 DEBUG    player   Setting interlude to: file:///home/user/.config/blockify/music/12.mp3
2015-03-17 20:47:18 DEBUG    player   Interlude song finished. Queued: file:///home/user/.config/blockify/music/12.mp3.
2015-03-17 20:47:18 DEBUG    player   Pause: State is (<enum GST_STATE_CHANGE_SUCCESS of type GstStateChangeReturn>, <enum GST_STATE_PAUSED of type GstState>, <enum GST_STATE_VOID_PENDING of type GstState>).
2015-03-17 20:56:14 INFO     main     Forcing unmute.
[1]    27563 segmentation fault (core dumped)  blockify -vvvv

Could not find Spotify PID

When I run blockify as a normal user (with Spotify definitely running, checked with ps -A ) get:

 Could not get Spotify PID: list index out of range

Now, I believe the issue is how blockify looks for the PID of spotify, because when I run blockify as root, I don't get this error. Of course, one should not run a program as root for it to function, so this should probably be fixed

Notes about Ubuntu/Linux Mint dependencies

Linux Mint 17.2 installation : python-configparser package has to be installed to run the pip blockify installation without error!

So I suggest to add:
sudo apt-get install python-configparser

In my Linux Mint 17.2 I didn't find the packages: libwnck3 and gst-python1.0
But I installed libgstreamer0.10-dev

maybe this helps other users ;-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.