|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using MediaBrowser.Common.Extensions;
|
|
|
|
using MediaBrowser.Common.Extensions;
|
|
|
@ -280,9 +281,16 @@ namespace MediaBrowser.Api.Images
|
|
|
|
public List<ImageInfo> GetItemImageInfos(BaseItem item)
|
|
|
|
public List<ImageInfo> GetItemImageInfos(BaseItem item)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var list = new List<ImageInfo>();
|
|
|
|
var list = new List<ImageInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
var itemImages = item.ImageInfos;
|
|
|
|
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)
|
|
|
|
foreach (var image in itemImages)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!item.AllowsMultipleImages(image.Type))
|
|
|
|
if (!item.AllowsMultipleImages(image.Type))
|
|
|
@ -323,7 +331,7 @@ namespace MediaBrowser.Api.Images
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int? width = null;
|
|
|
|
int? width = null;
|
|
|
|
int? height = null;
|
|
|
|
int? height = null;
|
|
|
|
string? blurhash = null;
|
|
|
|
string blurhash = null;
|
|
|
|
long length = 0;
|
|
|
|
long length = 0;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
@ -333,13 +341,9 @@ namespace MediaBrowser.Api.Images
|
|
|
|
var fileInfo = _fileSystem.GetFileInfo(info.Path);
|
|
|
|
var fileInfo = _fileSystem.GetFileInfo(info.Path);
|
|
|
|
length = fileInfo.Length;
|
|
|
|
length = fileInfo.Length;
|
|
|
|
|
|
|
|
|
|
|
|
blurhash = _imageProcessor.GetImageHash(info.Path);
|
|
|
|
blurhash = info.Hash;
|
|
|
|
info.Hash = blurhash; // TODO: this doesn't seem like the right thing to do
|
|
|
|
width = info.Width;
|
|
|
|
|
|
|
|
height = info.Height;
|
|
|
|
ImageDimensions size = _imageProcessor.GetImageDimensions(item, info);
|
|
|
|
|
|
|
|
_libraryManager.UpdateImages(item);
|
|
|
|
|
|
|
|
width = size.Width;
|
|
|
|
|
|
|
|
height = size.Height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (width <= 0 || height <= 0)
|
|
|
|
if (width <= 0 || height <= 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|