Implement Subsonic getNowPlaying API endpoint#632
Draft
langelgjm wants to merge 3 commits intosentriz:masterfrom
Draft
Implement Subsonic getNowPlaying API endpoint#632langelgjm wants to merge 3 commits intosentriz:masterfrom
langelgjm wants to merge 3 commits intosentriz:masterfrom
Conversation
Owner
|
oh nice, thank you @langelgjm but i think we do in fact want to store track level plays in the database. that will be required for #459 i'm not sure about the structure though. maybe extending the plays table, maybe a new table, should it be polymorhic so we can track podcast plays, internet radio plays, etc also, if we have the concept of track level plays, we could delete the concept of album level plays, since the info is already there |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a proof of concept implementation of the getNowPlaying API endpoint (see #510 ). The response NowPlayingEntry only provides the minimal fields required by the OpenSubsonic spec, plus "artist" and "album". The IsDir and and PlayerId fields are hardcoded to false / 0.
I implemented this so I could use Homepage's Navidrome widget (which is just a generic Subsonic widget that hits the getNowPlaying endpoint and looks for Username, Title, Album, and Artist) as discussed in #533 .
Originally I had created a now_playing table in the database and would insert a row during ServeStream, but that seemed too heavy and invasive, so instead this code relies on an in-memory cache that simply stores the latest track streamed by each user.
Caveats:
Questions / Clarifications
Full disclosure, I never used Go before this week and this is mostly Copilot code, but I have reviewed it, and I'm running this version of the code on my personal network right now.