Make blurhash be computed during regular scans if it was not already computed

This commit is contained in:
Vasily 2020-05-20 23:50:17 +03:00
parent 2b1ae7ac58
commit 3fb4c1356c
3 changed files with 8 additions and 0 deletions

View File

@ -246,6 +246,8 @@ namespace Jellyfin.Drawing.Skia
throw new FileNotFoundException("File not found", path); throw new FileNotFoundException("File not found", path);
} }
// Use 4 vertical and 4 horizontal components of DCT of the image.
// See more at https://github.com/woltapp/blurhash/#how-do-i-pick-the-number-of-x-and-y-components
return BlurHashEncoder.Encode(4, 4, path); return BlurHashEncoder.Encode(4, 4, path);
} }

View File

@ -1374,6 +1374,7 @@ namespace MediaBrowser.Controller.Entities
new List<FileSystemMetadata>(); new List<FileSystemMetadata>();
var ownedItemsChanged = await RefreshedOwnedItems(options, files, cancellationToken).ConfigureAwait(false); var ownedItemsChanged = await RefreshedOwnedItems(options, files, cancellationToken).ConfigureAwait(false);
LibraryManager.UpdateImages(this); // ensure all image properties in DB are fresh
if (ownedItemsChanged) if (ownedItemsChanged)
{ {

View File

@ -341,6 +341,11 @@ namespace MediaBrowser.Controller.Entities
{ {
currentChild.UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken); currentChild.UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken);
} }
else
{
// metadata is up-to-date; make sure DB has correct images dimensions and hash
LibraryManager.UpdateImages(currentChild);
}
continue; continue;
} }