Subsonic API: added timestamps into coverart ids, Made use of image ids to save a lookup, ref #558

This commit is contained in:
emeric
2024-12-08 15:48:52 +01:00
parent 38efdfaf87
commit 4a8754a7fa
18 changed files with 253 additions and 179 deletions
+6 -3
View File
@@ -32,6 +32,7 @@
#include "services/feedback/IFeedbackService.hpp"
#include "services/scrobbling/IScrobblingService.hpp"
#include "CoverArtId.hpp"
#include "RequestContext.hpp"
#include "SubsonicId.hpp"
#include "responses/Artist.hpp"
@@ -84,9 +85,10 @@ namespace lms::api::subsonic
}
albumNode.setAttribute("created", core::stringUtils::toISO8601String(release->getLastWritten()));
if (release->getImage())
if (const auto image{ release->getImage() })
{
albumNode.setAttribute("coverArt", idToString(release->getId()));
const CoverArtId coverArtId{ image->getId(), image->getLastWriteTime().toTime_t() };
albumNode.setAttribute("coverArt", idToString(coverArtId));
}
else
{
@@ -96,7 +98,8 @@ namespace lms::api::subsonic
params.setRange(db::Range{ 0, 1 });
db::Track::find(context.dbSession, params, [&](const db::Track::pointer& track) {
albumNode.setAttribute("coverArt", idToString(track->getId()));
const CoverArtId coverArtId{ track->getId(), track->getLastWriteTime().toTime_t() };
albumNode.setAttribute("coverArt", idToString(coverArtId));
});
}
if (const auto year{ release->getYear() })