indicator-muteads icon indicator-muteads: Auto-muting Spotify ads on Linux

I have created an application indicator (actually, "indicator application" might be more accurate, as the only interface is the indicator) which keeps a blacklist of ads played in Spotify. The idea is from a Windows application called Adify. For Linux, there were scripts out there that didn't do it quite right. Some were for muting with a hotkey, some were muting the whole system, some were focused on radio broadcasting (no idea why), but mostly the problem was their constant polling. I wanted something lighter and less resource hungry. You still need to poll; unless there is a way to register a callback when an xproperty changes or Spotify uses dbus or something. But the polling can be really reduced to a simple call to XGetWindowProperty and strcmp. Frankly, it can't get any simpler.

This application right here, gets the window title from libx11, checks the title against a blacklist file, gets the sink-input from libpulse, mutes/unmutes through libpulse, and shows an icon on the indicator tray. It also changes the icon color when it mutes an ad. The blacklist part is actually kind of neat. It parses the file to create a ternary search tree (TST). For optimum search times, it keeps the file sorted, and inserts the median of a set of titles, then the left set, and the right set recursively. Since the nodes contain the characters in a TST, after reaching the first character of a title in a search operation, the rest is almost equivalent to the string comparison (except for the pointer chase and path divergence points after same prefixes). By keeping the file sorted and adding in this fashion, the tree is kept balanced and the overhead is in a logn term.

Anyway, I created a tarball and also a Debian installer and published it on Launchpad. Dealing with the software packaging aspect was certainly interesting. To check it out, or to contribute, go to:

< Go back

August, 2014.