Closed daspartho closed 3 years ago
Umm... To quite an extent, i think the assumption is safe. So, i'm in support.
The question now is, how many minutes?
As for mins ig 3 will be ok as the average length of a song is about that. We can do more as its unlikely that ad will come after 1 song. But shouldn't compromise. What others think?
I think 3 minutes is just okay.
time.sleep(spotify.current_user_playing_track['duration_ms']/1000)
#Instead of checking every second for an ad. We simply get the total length of the song and wait for that ammount of time.
#Now spotify returns miliseconds for song length which is weird but this can easily be fixed with some basic math.
#We get the song duration and divide it by 1000 and we get our time in seconds
I had this code in one of my pull requests so that we dont keep pinging spotify every second. idk if it could help
Oh, that's way much better, can you please reference the PR, can't seem to find it.
Also, i think a subtraction of about 5-10 seconds would come in handy.
Oh, that's way much better, can you please reference the PR, can't seem to find it.
Also, i think a subtraction of about 5-10 seconds would come in handy.
It was from PR #8
Oh, i see. You can open another PR and try to make the change specific i.e addressing just this issue alone.
Done #45
Had to fetch upstream ^^^
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?