aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Images/ImageService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Images/ImageService.cs')
-rw-r--r--MediaBrowser.Api/Images/ImageService.cs22
1 files changed, 13 insertions, 9 deletions
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 09b99781b..559db550b 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
@@ -280,9 +281,16 @@ namespace MediaBrowser.Api.Images
public List<ImageInfo> GetItemImageInfos(BaseItem item)
{
var list = new List<ImageInfo>();
-
var itemImages = item.ImageInfos;
+ if (itemImages.Length == 0)
+ {
+ // short-circuit
+ return list;
+ }
+
+ _libraryManager.UpdateImages(item); // this makes sure dimensions and hashes are correct
+
foreach (var image in itemImages)
{
if (!item.AllowsMultipleImages(image.Type))
@@ -323,7 +331,7 @@ namespace MediaBrowser.Api.Images
{
int? width = null;
int? height = null;
- string? blurhash = null;
+ string blurhash = null;
long length = 0;
try
@@ -333,13 +341,9 @@ namespace MediaBrowser.Api.Images
var fileInfo = _fileSystem.GetFileInfo(info.Path);
length = fileInfo.Length;
- blurhash = _imageProcessor.GetImageHash(info.Path);
- info.Hash = blurhash; // TODO: this doesn't seem like the right thing to do
-
- ImageDimensions size = _imageProcessor.GetImageDimensions(item, info);
- _libraryManager.UpdateImages(item);
- width = size.Width;
- height = size.Height;
+ blurhash = info.Hash;
+ width = info.Width;
+ height = info.Height;
if (width <= 0 || height <= 0)
{