Giter Site home page Giter Site logo

xeroday / spotify-ad-blocker Goto Github PK

View Code? Open in Web Editor NEW
1.8K 70.0 192.0 7.29 MB

EZBlocker - A Spotify Ad Blocker for Windows

Home Page: https://www.ericzhang.me/projects/spotify-ad-blocker-ezblocker/

License: GNU General Public License v3.0

C# 100.00%

spotify-ad-blocker's Introduction

EZBlocker

EZBlocker is a Spotify Ad Blocker written in C# for Windows 7/8/10/11. The goal for EZBlocker is to be the most reliable ad blocker for Spotify.

When an advertisement is playing, EZBlocker will mute Spotify until it's over.

To download a pre-compiled binary of the latest version, click here. For more info, visit the EZBlocker project page.

Technical overview

The current version of EZBlocker hooks Spotify in three ways: window titles, audio sessions, and a reverse listener.

Window title

The window title is used to grab the name of the currently playing song/artist/advertisement. EZBlocker also uses the window title to grab the Spotify process handle.

Audio session

Using lower level COM interfaces, EZBlocker is able to both find and extract information from Spotify's audio session.

Firstly, if the Spotify window is hidden (in the tray), its window title cannot be used locate the correct Spotify process handle. In this case, EZBlocker falls back to searching through the audio sessions to find the correct process.

Secondly, the audio session is a somewhat reliable way to detect whether or not a song/advertisement is playing regardless of whether or not the Spotify window is hidden. It can be inaccurate at times, eg. when a song has a 3 second gap of no sound, but can automatically recover.

Reverse Listener

I've historically tried to avoid modifying the Spotify application, but since the shutdown of its unofficial local API (in mid July 2018), there was no reliable way to detect if an advertisement was playing.

Spotify is built with the Chromium Embedded Framework, which means many of its components are written in HTML/JS. EZBlocker patches one of them to attach a web worker that sends a signal to a local listener when an advertisement is playing.

More data could probably be extracted through the web worker, but I haven't had time to explore.

Changelog (Major releases only):

  • V 1.8 (Oct 31, 2021):
    • New muting logic, reduces false positives (podcasts no longer muted)
    • Cleanup and bugfixes
  • V 1.7 (July 22, 2018):
    • Almost a complete re-write of the application (lighter, more performant, cleaner code)
    • New Spotify ad detection and muting logic after Spotify's shutdown of its local API
  • V 1.6 (March 10, 2016):
    • Better handling of Spotify updates/restarts
    • Fix bugs caused by newer Spotify local API
    • Update dependencies
    • Now requires .NET Framework 4.5

Translations

To better support non-English speakers, I've started an effort to translate EZBlocker. Please reach out if you are a native speaker of a non-English language.

The following are contributors to this goal:

  • Portuguese: Raí

spotify-ad-blocker's People

Contributors

andreabresolin avatar avelure avatar avidort avatar ceejaycee avatar danielchalmers avatar georgeto avatar novaki92 avatar richardhabeeb avatar war59312 avatar xeroday avatar zacbre avatar zoef 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  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

spotify-ad-blocker's Issues

Bug: Pausing And Un-pausing Foobar2000 Instead Of Spotify

Hey,

So Spotify was playing an ad and I just happended to have Foobar2000 1.3.5 on Win 8.1 x64 open as well, but paused.

Oddly enough Foobar2000 started to be paused and un-paused many times. Turns out it was EZBlocker doing it.

Whoops! Of course it should not be doing anything to Foobar2000 since of course it's just for Spotify. I kinda laughed out loud cause I thought it was going crazy for a second.

Thanks,

Will

Minimize to tray icon is not intuitive

Minimizing the window with double click to tray icon is less intuitive that using the close button.

That behaviour will be perfect if it's the same as Spotify:

  • Minimize to tray on close button click [X]
  • Minimize to taskbar on minimize button click [-]

Version 1.5 Issues

1.) Unable to connect to ad servers over and over again.
2.) Please stop telling me it's hidden on every minimize, once is enough.
3.) Please have a real about screen with at least version number and date.
4.) Copyright of exe is 2014.

Ad plays when Spotify is hidden by a Virtual Desktop Manager

If using a virtual desktop manager (VDM), ads will not be blocked while Spotify window is hidden by VDM.

  1. If the Spotify window is shown during an ad, EZBlocker will recognise the an ad and block it.
  2. Should the window be hidden while an ad is being blocked, EZBlocker will not resume playing music until Spotify is shown by vdm.

I have tested Dexpot and VirtuaWin and have verified the issue appears with both of these VDM.

Replaying last song of playlist.

This is minor, but when an ad is played after the last song on a queue (playlist, etc.), the last song is that queue will be played again.

I wonder what the results would be if queue shuffle is enabled. Would this cause the entire queue to replay?

Distributed Block List

What do you guys think about having a distributed model for the block list so that it is never out of date. The problem with having a static list on xeroday's website is that if he doesn't update it then we all have to manually add new ads to our list. If we could have a small server that serves the block list and listens to new block requests we could then count how many block requests we've gotten, say we get three requests to block the same ad from three unique computers then we will add that to the block list and everyone gets the updated block list(this prevents people from blocking legit songs). I don't think this would be very difficult to implement, just wanted to get everyone's opinion and thoughts about the idea.

Thanks

Sort Blocklist

Could there perhaps be some way of ordering/filtering the blocklist? I know it's probably not an important feature, since most users won't be spending much time accessing the blocklist — however, it would make searching for entries that were accidentally added much easier (but you didn't notice until much later).

I believe that currently, the entries are sorted by date (with the newest entry first)? While this is fine if you realize right away what you've done, if multiple advertisements have come up after, that legitimate artist has been buried in oblivion.

Pressing the first letter of the entry allows you to cycle through all entries starting that letter, but a filter view would certainly be nice!

Requested Feature

Could do please add awesome feature that allows you to play a substitute MP3 from your Music folder when it mutes an ad, that way, you don't have any empty space between songs, and then move to the next track on your Spotify playlist when that song is over.
Sorry for posting here :(

Does not compile, missing two .cs files

1>------ Build started: Project: EZBlocker, Configuration: Debug Any CPU ------
1>CSC : error CS2001: Source file 'AudioUtilities.cs' could not be found
1>CSC : error CS2001: Source file 'Volume.cs' could not be found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Don't work on windows 10

Hi

I have dicover this program today, but when i want to laught this on windows 10, the program stop immediately

Did Spotify Update?

My spotify restarted, and now EZ Blocker doesn't work. The spotify version listed in my client is 1.0.1.1060.gc75ebdfd

Banner ads are blocked, but container remains

While the banner ads are blocked, the container it's in remains and can't be removed/resized, blocking a LOT of screen real estate. The workaround I've found is restarting spotify, which is obviously not ideal. I'll post a screenshot as soon as I see this behavior again.

Great tool, you wooed me away from blockify ;)

[feature] Ad detection by last.fm

Algorithm:

  1. Ad plays.
  2. EZBlocker detects song change.
  3. Ad is finished, new song begins.
  4. EZB checks if previous song got scrobbled to Last.fm.
    If so, it's not an ad.
    If not, it's an ad.

Vitual desktops not working with EZblocker

When im in another virtual desktop then the one EXblocker (and spotify) is in, EZblocker is not able to mute playing ads or unmute music if i switched desktops while an ad was playing.

The vdesktop software im using is dexpot (newest version) on windows 8.1

Compatibility with the web player

I believe it shouldn't be much work to implement the ability to read the song info from the browser for those who use the web player (there are already software that streamers use to display song names to viewers, like http://sourceforge.net/projects/obsmusicstreamd/). In that case you would need to silence the browser. The problem is that the tab with the web player would need to be active or in a separate window.

I might try doing that myself when I have time.

Mutes and pauses spotify on ad

When an ad plays it is correctly muted but the player also pauses until I manually un-pause. On un-pause the ad plays (muted). This means the time before I hear music is the 30s ad plus however long it takes me to un-pause Spotify.

I'm on Windows 8 with no UAC.

Multiple messages when opening for first time

The first time I opened the exe I got a "Please check 'Allow Spotify to be started from the Web' in your Spotify preferences." message. Fair enough. But then I got another... and another and.. one every second.

Some ads are missed by EZBlocker

Previously this was not an issue due to the presence of a block-list. Now I'm getting around a 10% failure rate with muting ads. Next time I experience the problem I'll check for the specific ads themselves.

EDIT: I checked my history and the ads "Pennsylvania College of Arts & Design" and "Trance Top 1000" were not blocked.

Improvement: Start minimized

Hi Guys!

Love the tool!
Only thing missing is a toggle to start minimized.
It now always opens up fully when started and (for my work machine) it freezes for a minute or so. in this periode im unable to minimize it. Only after it unfreezes am i able to minimize to sytem tray.

Keep up the great work!

No longer works properly after Spotify update this week

I've somehow managed to get the app mute Spotify manually once, other than that it only messes up sound in Windows (probably) and/or in Spotify. I hope this is somehow easily fixable.

Either way, thanks for your great work!

Shows up on Alt+Tab app switcher after minimized to tray

I assume that most people want to keep EZBlocker out of sight. Currently it shows up on the Alt+Tab app switcher even when it's minimized:
alt-tab-switcher

There's also an bug which results the EZBlocker window not to disappear after Alt+Tab is used to recover the window. Instead the window collapses to the left lower corner and "–" button doesn't hide the window anymore but expands/collapses it. Collapsed window:
collapsed-window

For example Mumble (http://sourceforge.net/projects/mumble/) does this the way I'd like it to work – when it's minimized to tray, it stays there.

Make it part of spotify program

I asking for EZBlocker be a part of spotify itself , can it be an extension or patch for spotify program and the option show in any where in spotify , In short I want the EZBlocker and spotify be one program . it's will be great, thank you

2 Solutions

Why there are two solutions? Do you want to clean it up, get rid of the old unused code and fix missing project files?

Why programming in C# with .NET Framework 3.5?

Hi, i was thinking about porting it to other systems, but... C# and .net kinda makes it not so cool.
Why keep in this segment instead of going to a java? or even pure C (with NSPR lib)?

Thankz!

Not working on Private session

As title says: the blocker isn't working on private sessions. Aside from that, awesome work!

Thanks for the great app!

Stopped working since Spotify 1.0.18.60

Ad blocking doesn't work anymore. Banner ads haven't been blocked for a long time but after the latest update to Spotify even the radio ads are not blocked anymore.

Single process

EZBlocker opens Spotify on launch, so I changed the shortcut from Spotify to EZBlocker.

When I click on the shortcut twice (forgetting Spotify is opened in the systray) it opens two EZBlocker instances. They conflict each other when an ad is muted.

Maybe you should test if an instance is already launched and if it is, only bring back the spotify window to the front ? or do nothing ? or maybe only display the message "EZBlocker is already running"

Feature suggestion

Something to start and close EZBlocker automatically with Spotify would be nice.

Constant not responding app

I'm running Windows 8.1 x64 and the current version (V 1.4 (November 22, 2014)) is constantly not responding, resulting in some times the mute feature keeps Spotify muted for a while and then when it unfreezes, it just unmutes Spotify in the middle of a song.

Fallback to the previous version until this is fixed.

Thanks!

Crashing after the latest update

I don't know if it's just me but it seems that the latest update from spotify broke the program. Infact everytime I try to open EZBlocker, spotify just crashes. The same happens both opening spotify with ezblocker and opening first spotify and then ezblocker

Version 1.0.21.141.g

Plays/Pauses iTunes

When iTunes is open alongside Spotify and trying to block an ad, iTunes switches between playing and pausing about every second.

iTunes was initially not playing music, just open in the background.

Windows XP support

Ok...
I understand that Microsoft has stopped support for Windows XP.

However, This old monster was around since late XP and early Vista inquisition.
I am unable to earn enough funds to put aside to upgrade my machine to a more modern one.
I request through your kindness to program a Spotify Blocker that will work on Windows XP.
Windows vista and greater haven't shown any bright signs for me to permanently upgrade without slowing down inexplicably.
you are my only hope... :'(

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.