daspartho / spotibyeads Goto Github PK
View Code? Open in Web Editor NEWSkip spotify ads by automatically restarting application when ad plays
License: GNU General Public License v3.0
Skip spotify ads by automatically restarting application when ad plays
License: GNU General Public License v3.0
can we add a feature to use this in spotify web ?
it will be very convenient. If possible i'll contribute too with whatever I can.
thank you,
normally the code will write a credential.json
file to store the clientID etc aswell as a cache text file, but the files are written outside of the SpotiByeAds-main folder, it messes up your file organization and can be pretty easily fixed
in open("./credentials.json", "r")
and open("./credentials.json", "w")
add in /SpotiByeAds-main
or whatever you named the file to get open("./SpotiByeAds-main/credentials.json", "r")
for read and write respectively, now the .json file will write to a better spot
i dont know how to make the cache file write into the folder though, it's probably something on the spotify for devs side
Change the string to a raw string
Like so:
PATH = 'C:\Users\USERNAME\AppData\Roaming\Spotify'
to
PATH = r'C:\Users\USERNAME\AppData\Roaming\Spotify'
I tried to use PyInstaller to create an exe file from main.py, and it works fine on my main computer that has Python installed, but on my other computer which doesn't have it installed, it gives me the "pip3 not recognized" error. Is there any possible way we could bundle the python3 interpreter with the main.py file in an exe? It would make it a lot more accessible for non computer geeks.
Found this thing that if i added some song in a queue to play next and an Ad comes resulting in restart, it will clear the queue.
The forks badge links to stargazers. This is a pretty minor issue and I'm on my phone at the moment, so I'll fix this myself tomorrow.
I hade rewriten code using hotkeys functions from pynput, should i post it on my repository or should i make branch in this one?
i can input all the data when it askes for it in python. after that nothing happens at all tho. no box where it asks for permissions
Lines 59 to 62 in ae073ff
https://github.com/theskumar/python-dotenv python-dotenv
can be an option. Just need to create a .env
file and load the environment variables.
Hi, I'm using MacOS and it doesn't block ads.
OS: Mac OS
error:
killall: unknown signal r; valid signals:
HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP
TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2
can we please have the next song resumed after the ad is skipped?
There is limit on number of requests to spotify api and since the program sends one every sec so its quite easy to exhaust it in a long music session which will break the script. We can reduce that one way. Since after a restart its quite certain that there won't be any ad for some time so we can make the detection program sleep for a few min after a restart as we are certain there won't be any ad any time soon. This would somewhat reduce the number of request. What you guys think?
Can someone volunteer to make a installation guide for those who are not experienced with programming so that will be the go-to on how to use this script.
Just replace os.startfile(path)
with os.system('spotify.exe')
at line 11.
[Documentation] Could the main README briefly explain how this is detected via the python code?
Does not have to be a long explanation, just the main gist of how it works. That way people can
understand which part notices when an ad is played. For instance I presently don't know the
spotify API so this would be helpful. Thank you for potentially considering and reading this
issue request.
An error was raised by line 71 (time.sleep((spotify.current_user_playing_track['duration_ms']/1000) - 6) #Stop us from getting rate limited from spotify API (It just waits for the song to end)
). A quick Google search showed the fix was to replace the brackets in spotify.current_user_playing_track['duration_ms']
with parenthesis. I'll create a PR for it.
did exactly what readme says and prompt says: Awesome, that's all I needed. I'm watching for ads now <.<
but when spoti AD kicks in, nothing happens....is this a sca m?
Edit: So I'm having 2 different spoti accounts, but this is more wired because when I sign in develop with 2nd account which I currently listening to, the main.py console will close immediately after I enter my password, the message was lighting fast that I will never be able to read....any advice? thanks!
When running on manjaro the program doesn't close spotify. It still opens a new window tho. There for ads aren't skipped.
Specs:
OS: Manjaro Linux x86_64
Kernel: 5.10.53-1-MANJARO
Shell: bash 5.1.8
WM: i3
Terminal: kitty
CPU: AMD Ryzen 7 3700X (16) @ 3.600GHz
GPU: NVIDIA GeForce GTX 1660
Memory: 2875MiB / 15990MiB
Was introduced by #51 (in response to #44).
I figured out a [maybe] temporary but workable fix for the exception of skipping tracks.
A keyboard interrupt (Ctrl-C
) can be sent to the program to trigger a dialogue that asks if the user wants to skip a track, change playlist or exit the program.
If the user chooses to skip a track... the program sends the appropriate key signal to automatically do that.
If the user wants to change the playlist, the script would request that the user confirms a dialogue after changing the track.
This way, the script handles skipping tracks and knows when the playlist is changed, hence it can simply go ahead to wait for the new track or skip an ad that pops up next :)
What do you think?
Originally addressed by @AnonymouX47 in #51 (comment)
here's the error message,
main(spotify_username, spotifyAccessScope, spotify_client_id, spotify_client_secret, spotifyRedirectURI, PATH)
File "main.py", line 96, in main
if current_track['item']['name'] != last_track: # Next track
TypeError: 'NoneType' object is not subscriptable
For some reason this issue from a while ago didn't submit. After putting in credentials, the program spits out an error about being unable to find spotify.exe. I checked, and my spotify executable is Spotify.exe. I'll submit a PR for this, but I'm curious about why nobody else has had this error yet. I didn't change the executable name, this is exactly how it was installed.
In the installation instructions, it says to run cd SpotiByeAds.py
after cloning. It should be changed to cd SpotiByeAds
without the .py extension, as the folder that is cloned is called SpotiByeAds.
Whenever I attempt to run the code I get this error: TypeError: expected str, bytes or os.PathLike object, not NoneType
.
I run it as follows:
$ cd C:\Users\me\SpotiByeAds
$ py main.py
Found previously used credentials. Want to use them again? (Y/n) Y
Awesome, that's all I needed. I'm watching for ads now <.<
SUCCESS: The process "Spotify.exe" with PID 12680 has been terminated.
SUCCESS: The process "Spotify.exe" with PID 23276 has been terminated.
SUCCESS: The process "Spotify.exe" with PID 25124 has been terminated.
SUCCESS: The process "Spotify.exe" with PID 11972 has been terminated.
SUCCESS: The process "Spotify.exe" with PID 20088 has been terminated.
SUCCESS: The process "Spotify.exe" with PID 13544 has been terminated.
Traceback (most recent call last):
File "C:\Users\me\SpotiByeAds\main.py", line 128, in
main(spotify_username, spotifyAccessScope, spotify_client_id, spotify_client_secret, spotifyRedirectURI, PATH)
File "C:\Users\me\SpotiByeAds\main.py", line 65, in main
restartSpotify(path)
File "C:\Users\me\SpotiByeAds\main.py", line 52, in restartSpotify
openSpotify(path)
File "C:\Users\me\SpotiByeAds\main.py", line 37, in openSpotify
subprocess.Popen([path], start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1360, in _execute_child
args = list2cmdline(args)
File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 565, in list2cmdline
for arg in map(os.fsdecode, seq):
File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\os.py", line 822, in fsdecode
filename = fspath(filename) # Does type-checking of filename
.
TypeError: expected str, bytes or os.PathLike object, not NoneType`
I was experimenting with moving the documentation from the Read The Docs Sphinx theme to the Press Sphinx theme. You can compare them at https://spotibyeads.readthedocs.io/en/latest/ and https://spotibyeads.readthedocs.io/en/press-theme/ respectively.
My personal opinion is that the press theme looks nicer, but since I have to manually scale the images (as compared to the automatic scaling on the RTD theme), the images are too small on high-resolution displays and too big on mobile and low-resolution displays. They only look as intended on a 1080p desktop monitor, which I think most people will use, but it's still something to consider.
There is a unspecified except:
in line 43. This can lead to the KeyboardInterrupt
- which gets raised when you hit CTRL+C to exit the program - not being registered. There for making it impossible to exit the program.
I suggest that the user be asked to enter a passphrase of at least 8 ASCII (to reduce complexity) characters. Then that can be used to encrypt the client secret when storing it and to decrypt it when reading it.
A simple cipher can be used, i'll say the XOR (maybe with a little extra like a random number) is ok... cracking the cipher with such key length will be quite a pain :)
I think we should make a separate thread since this is a common request. We have a way to use py2app for Mac, but my attempts with pyinstaller and cxfreeze on windows have been unsuccessful. Has anyone else built outside of Mac?
It crashes after a while. And returns the above error. It says,
" line 99, in main
if current_track['item']['name'] != last_track: # Next track
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable"
For those that don't use or are not used to git, updating the script after changes have been made could be clumsy.
I suggest including a script for this purpose.
I propose this following:
SpotiByeAds/
...
update.py
VERSION # Will contain current version number.
update.py
downloads and reads "VERSION" file from git repo to check if an update is available.
If an update is available, downloads the master zip and extracts it (using python's zipfile
).
I did not directly open a PR, so that this can be properly discussed before implementation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.