mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 22:08:27 +01:00
Merge branch 'master' into userdb-efcore
# Conflicts: # Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs # Emby.Server.Implementations/Library/UserManager.cs # Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs # Emby.Server.Implementations/Sorting/IsPlayedComparer.cs # Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs # Emby.Server.Implementations/TV/TVSeriesManager.cs # Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs
This commit is contained in:
@@ -1375,6 +1375,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)
|
||||
{
|
||||
@@ -2219,6 +2220,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
existingImage.DateModified = image.DateModified;
|
||||
existingImage.Width = image.Width;
|
||||
existingImage.Height = image.Height;
|
||||
existingImage.BlurHash = image.BlurHash;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2370,6 +2372,46 @@ namespace MediaBrowser.Controller.Entities
|
||||
.ElementAtOrDefault(imageIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes image index for given image or raises if no matching image found.
|
||||
/// </summary>
|
||||
/// <param name="image">Image to compute index for.</param>
|
||||
/// <exception cref="ArgumentException">Image index cannot be computed as no matching image found.
|
||||
/// </exception>
|
||||
/// <returns>Image index.</returns>
|
||||
public int GetImageIndex(ItemImageInfo image)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
if (image.Type == ImageType.Chapter)
|
||||
{
|
||||
var chapters = ItemRepository.GetChapters(this);
|
||||
for (var i = 0; i < chapters.Count; i++)
|
||||
{
|
||||
if (chapters[i].ImagePath == image.Path)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ArgumentException("No chapter index found for image path", image.Path);
|
||||
}
|
||||
|
||||
var images = GetImages(image.Type).ToArray();
|
||||
for (var i = 0; i < images.Length; i++)
|
||||
{
|
||||
if (images[i].Path == image.Path)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ArgumentException("No image index found for image path", image.Path);
|
||||
}
|
||||
|
||||
public IEnumerable<ItemImageInfo> GetImages(ImageType imageType)
|
||||
{
|
||||
if (imageType == ImageType.Chapter)
|
||||
|
||||
@@ -348,6 +348,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;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public int Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the blurhash.
|
||||
/// </summary>
|
||||
/// <value>The blurhash.</value>
|
||||
public string BlurHash { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsLocalFile => Path == null || !Path.StartsWith("http", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user