Skip to content

Commit

Permalink
Subsonic API: report the cover of the release if no embedded cover is…
Browse files Browse the repository at this point in the history
… found for the track, fixes #519
  • Loading branch information
epoupon committed Sep 13, 2024
1 parent 6c17c04 commit 8cd8486
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libs/subsonic/impl/responses/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ namespace lms::api::subsonic
trackResponse.setAttribute("transcodedContentType", av::getMimeType(std::filesystem::path{ "." + fileSuffix }));
}

const Release::pointer release{ track->getRelease() };

if (track->hasCover())
trackResponse.setAttribute("coverArt", idToString(track->getId()));
else if (release)
trackResponse.setAttribute("coverArt", idToString(release->getId()));

const std::vector<Artist::pointer>& artists{ track->getArtists({ TrackArtistLinkType::Artist }) };
if (!artists.empty())
Expand All @@ -121,7 +125,6 @@ namespace lms::api::subsonic
trackResponse.setAttribute("artistId", idToString(artists.front()->getId()));
}

Release::pointer release{ track->getRelease() };
if (release)
{
trackResponse.setAttribute("album", release->getName());
Expand Down

0 comments on commit 8cd8486

Please sign in to comment.