joeyy-watts / SpotifyWLED

A script to listen to the currently playing track on your Spotify account and forward it to a WLED (https://github.com/Aircoookie/WLED) LED matrix with support for animations.
2 stars 0 forks source link

Make track update asynchronous #16

Closed joeyy-watts closed 10 months ago

joeyy-watts commented 10 months ago

Currently, every polling cycle, the script has to update the current playing track in a blocking operation, causing a slight but noticeable delay in the animation.

https://github.com/joeyy-watts/SpotifyWLED/blob/549e8102254d40f62234a9e76d519da1672ba85c/handlers/spotify_api_handler.py#L94

https://github.com/joeyy-watts/SpotifyWLED/blob/549e8102254d40f62234a9e76d519da1672ba85c/handlers/wled/wled_artnet.py#L32

This should be a non-blocking operation to allow animation to always run.

joeyy-watts commented 10 months ago

Using Threading to address this, but still have to refactor the code since update_current_track is not called in one place.

joeyy-watts commented 10 months ago

Addressed in:

Lag is still there, but not really noticeable in WLED matrix IRL. Only slight lag visible if viewing the ArtNet monitor.

There is still major lag upon track change, but will address this in separate issue.