Skip to content

Use the coverArt field from song JSON if available #1731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cquike
Copy link
Contributor

@cquike cquike commented Apr 28, 2025

This PR make sure that the coverArt JSON field in the subsonic song API takes precedence over the album or song ID.
As I understand it, if a song has a coverArt field then that one is the one to be used. As a fallback solution strawberry uses the song id. However if the setting "Use Album ID for album covers" is set, then the coverArt is ignored.

I have tried with the lms (https://github.com/epoupon/lms/tree/master) server and causes many errors since the album id is not mapped to the cover id (i.e., the only option for the getCoverArt method is to give the cover id).

My interpretation is that the "Use Album ID for album covers" uses album id as a fallback solution when the coverArt is not found in the song. If false, then the song id will be used as a fallback solution. That's the logic that this PR implements.

Thanks!

@jonaski
Copy link
Member

jonaski commented May 1, 2025

As far as I understand, the problem was that using coverArt was requesting cover for each song, because each song had different coverArt, see #1636, so this will actually make it impossible to use album ID if coverArt exists which will re-introduce the issue again.
CC: @Leohige

@cquike
Copy link
Contributor Author

cquike commented May 3, 2025

I see. It is a bit unfortunate that different Subsonic servers behave differently. So #1636 was introduced to make gonic and subsonic to behave sanely, while this PR would make lms to work.
OpenSubsonic (https://opensubsonic.netlify.app/docs/) is establishing itself as the new open standard, and gonic is a participant of it, and so is lms, so at least it would be nice if both behave in a compatible way. I cannot say for subsonic itself since it is not open source.
One possible solution is that the option usealbumidforalbumcovers uses the album "coverArt" field to get the cover id, rather than calling getCoverArt with the album id. I will try to see whether that change would work. @Leohige : do you think that would work in your case?
Note that OpenSubsonic documentation clarifies the semantics of getCoverArt: opensubsonic/open-subsonic-api#140

@cquike
Copy link
Contributor Author

cquike commented May 4, 2025

I have now modified the PR to ask for the coverArt field of the reponse to getAlbum if the "Use album id for album covers" option is enabled. That should give the same benefit as #1636 while being compatible with the clarification of opensubsonic on the coverId for getCoverArt.
I have tested that this gives correct results with gonic, ampache and lms. @Leohige : if you could also test this patch would be great. Thanks!

@cquike
Copy link
Contributor Author

cquike commented May 4, 2025

I have also tested now that it works with navidrome as well.

@Leohige
Copy link
Contributor

Leohige commented May 5, 2025

Unfortunately, I can't test this right now. I'm traveling, and my computer, which I use to compile the project, is at home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants