Now resolve the preferred artist artworks during scan steps

This commit is contained in:
emeric
2025-06-21 22:18:17 +02:00
parent 67db09685d
commit 93b446e124
10 changed files with 121 additions and 86 deletions
@@ -143,14 +143,15 @@ namespace lms::artwork
ImageFindResult res;
if (const db::Artist::pointer artist{ db::Artist::find(session, artistId) })
{
if (const db::ImageId imageId{ artist->getImageId() }; imageId.isValid())
res = imageId;
const db::Artist::pointer artist{ db::Artist::find(session, artistId) };
if (!artist)
return res;
// TODO fallback on embedded Band/LeadArtist/Artist?
// TODO fallback on first release?
}
const db::Artwork::pointer artwork{ artist->getPreferredArtwork() };
if (artwork && artwork->getImageId().isValid())
res = artwork->getImageId();
else if (artwork && artwork->getTrackEmbeddedImageId().isValid())
res = artwork->getTrackEmbeddedImageId();
return res;
}