Simplified artwork handling: create a brand new artwork when an image changed. Simplifies subsonic element retrievals

This commit is contained in:
emeric
2026-06-21 16:25:41 +02:00
parent 0d6dbcc291
commit fd338dabc7
16 changed files with 56 additions and 215 deletions
@@ -85,11 +85,20 @@ namespace lms::scanner
}
const bool added{ !image };
if (!image)
if (added)
{
image = dbSession.create<db::Image>(getFilePath());
dbSession.create<db::Artwork>(image);
}
else if (image->getLastWriteTime() != getLastWriteTime()
|| image->getFileSize() != getFileSize()
|| image->getHeight() != _parsedImageProperties->height
|| image->getWidth() != _parsedImageProperties->width)
{
if (auto artwork{ db::Artwork::find(dbSession, image->getId()) })
artwork.remove();
dbSession.create<db::Artwork>(image);
}
image.modify()->setLastWriteTime(getLastWriteTime());
image.modify()->setFileSize(getFileSize());