Repository navigation
Conversation
|
This, alongside with the Last Seen Pr's l will be in limbo due to the amount of data saved into Redis, per second. I ought to implement both at once (last RPC?, update in general) but I'm not sure what's the best way to not hammer Redis |
|
Adding to this, when/if we actually implement previous activities/songs, we'll want to consider not just throwing it all in the existing route, we shouldn't make the lanyard object response size all that much bigger for features most won't even use, of course this is just my thoughts and its open for discussion with maintainers. Perhaps a query parameter to return the "stale" data rather then adding another route |
|
Agree with dustinrouillard on opt-in data fetching (eg.. using a ?include_history=true query param or dedicated endpoint) to keep default API response sizes light. |
That makes sense. I agree that writing to Redis on every presence update could create unnecessary load. I’ll update Redis only when the value actually changes, using local caching where appropriate. I’ll look into implementing this if there’s actual interest in the feature. Thanks for pointing this out |
|
I don't want us to introduce a Redis call per presence query. Lanyard was designed to be extremely efficient on the lookup path (memory operations only) so we don't need to introduce rate limits. Lanyard is also currently able to operate if Redis is down/unavailable for whatever reason, which is a nice bonus. If we do ever introduce something like this, it must be cached within the Presence GenServer state. |
Pull Request: Add Support for Last Played Spotify Activity
Description
This PR introduces a new "Last Played Spotify" feature. Previously, when a user paused their Spotify music or went offline, their Lanyard presence would simply drop the Spotify data and show them as "idle" (or no active Spotify).
With this change, Lanyard will now cache the user's last played Spotify song in Redis and return it in the presence payload whenever they are not currently listening to anything. This provides a more meaningful historical presence instead of a blank state.
Changes Made
last_played_spotifyfield toLanyard.Presence.PrettyPresence(inlib/presence/presence.ex).get_last_played_spotify/1andset_last_played_spotify/2helper functions toLanyard.Connectivity.Redisfor storing and retrieving the JSON serialized Spotify activity.build_pretty_presence/1:spotify_activityto Redis when it is active.last_played_spotifydata whenspotify_activityisnil(e.g. music paused or user offline).