Browse Source

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

Vasily 5 years ago
parent
commit
3fb4c1356c

+ 2 - 0
Jellyfin.Drawing.Skia/SkiaEncoder.cs

@@ -246,6 +246,8 @@ namespace Jellyfin.Drawing.Skia
                 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);
         }
 

+ 1 - 0
MediaBrowser.Controller/Entities/BaseItem.cs

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

+ 5 - 0
MediaBrowser.Controller/Entities/Folder.cs

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