Simplified artwork handling: create a brand new artwork when an image changed. Simplifies subsonic element retrievals
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user