amybytes / nanoleaf-desktop

A modern desktop application for the Nanoleaf Aurora and Canvas
MIT License
166 stars 13 forks source link

(minor) wonky timestamp for spotify visualizer #20

Open SammyMasala opened 4 years ago

SammyMasala commented 4 years ago

1) The timestamp doesn't seem to be properly resetting. As such, it keeps accumulating song after song (at 2+ hours on my device right now)

2) Funnily enough, it seems to be flickering between the cumulative/specific track timestamp. Just a random guess here, but is it constantly pinging spotify from the proper timestamp, but it keeps getting overwritten?

amybytes commented 4 years ago

at 2+ hours on my device right now

Does this only start happening after listening for a long amount of time? This problem doesn't seem to be occurring for me, but I have yet to test for 2+ hours (I'm at about 30mins right now). In fact, IIRC, the app prevents Spotify streaming for over an hour in a single session.

SammyMasala commented 4 years ago

That's funny. I haven't stopped using the app since the thread. I'm at 5 hours now. lights are still going.

I have a further blind guess after tinkering with it: it seems to be related to the enable/disable button. Namely, the app doesn't seem to like me spamming the disabling and reenabling mid use. Correct me if i'm wrong, but disable doesn't seem to stop or reset the timestamp. So when i reenable it struggles to override the existing stamp with the 'correct' info, causing a general desync.

This desync might also be how im getting around the 1 hour limit

amybytes commented 4 years ago

Interesting... so when you are pressing the enable/disable button is it prompting you to re-authenticate with Spotify in your browser? My best guess right now is that you have somehow created two or more instances of the spotify player (the local player that syncs with the real player) and since one has expired it is now just increasing the timestamp forever and the other one is setting the real timestamp. Since they would be executed on separate threads, you would see a flickering effect.

In any case, I don't think it really matters what the specifics of the cause are, because it seems that the root cause is the session expiring. Since the app actually doesn't check that the sessions expires, it is prone to stuff like this happening (due to a bit of a design flaw in the app). I think the best fix for this is to either add a check for when the session expires, or to lift the one hour time limit. I'm not too sure I want to lift the time limit though, since the app is running on a shared Spotify profile (meaning that everyone using the app shares the same quota, so if someone just left the app running it would potentially use it all up and break the app for everyone else).

Also, my session just expired and my lights stopped updating and the enable/disable button does nothing. Restarting the app and clicking the enable button prompts for re-authentication as it should. Something that still confuses me is that you said your lights didn't stop after your session expired. Is this still true? Did you re-authenticate at any point?