* Only works on Windows
I don't know if anyone else has done this before. if they have, their script is probably better than mine.
It checks for window name changes and it'll exit Spotify and relaunch it when Spotify is playing anything that doesn't have "-" in the name. (Every song on Spotify has that in the name)
There's this known bug which let's you skip ads if you exit Spotify entirely and relaunch it.
Just head to the Latest Release tab and download the latest version.
- The Spotify directory in this release is in "appdata/roaming/spotify"
- Make sure you have Python 3.9 installed.
- Then extract the repository and open a terminal in that directory.
- Run
python -m pip install -r requirements.txt
in the same directory. - And finally run
pip install --only-binary :all: psutil
- Replace the
"SpotifyDir"
value with the directory of your Spotify executable. - Exit Spotify entirely (Ctrl + Shift + Q) or just pause the music.
- Open the directory in your preferred terminal.
- Run
python main.py
.
- Install Pyinstaller
pip install pyinstaller
. - Open the script directory in your preferred terminal.
- Run this line of code
pyinstaller --icon=icon.ico --onefile --hidden-import "pynput.keyboard._win32" --hidden-import "pynput.mouse._win32" main.py
- Wait for the program to finish compiling the executable.
- Your file is located in
dist
directory.
- You can replace any Spotify shortcut with this file. (But remember to change the
"SpotifyDir"
value.) - If the executable exits with "Python39.dll not found" error, move the included Python39.dll to the directory.
- You can use whatever version of python3 you have but to fix the "python3*.dll not found" you have to look through your python dir.
There is a limitation however, some ads don't change the window title to "Advertisement". I might design a system which detects those too but I'm lazy atm.
The mentioned bug is fixed.
- Some antivirus softwares incorrectly detect the precompiled version (Latest Release) as malware. This is a known issue caused by building executables with pyinstaller (Yara rule and Virustotal Scan).
- Fix the limitation.