|
|
|
@ -33,7 +33,6 @@ namespace Emby.Drawing
|
|
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
|
|
private readonly IServerApplicationPaths _appPaths;
|
|
|
|
|
private readonly IImageEncoder _imageEncoder;
|
|
|
|
|
private readonly Func<ILibraryManager> _libraryManager;
|
|
|
|
|
private readonly Func<IMediaEncoder> _mediaEncoder;
|
|
|
|
|
|
|
|
|
|
private bool _disposed = false;
|
|
|
|
@ -45,20 +44,17 @@ namespace Emby.Drawing
|
|
|
|
|
/// <param name="appPaths">The server application paths.</param>
|
|
|
|
|
/// <param name="fileSystem">The filesystem.</param>
|
|
|
|
|
/// <param name="imageEncoder">The image encoder.</param>
|
|
|
|
|
/// <param name="libraryManager">The library manager.</param>
|
|
|
|
|
/// <param name="mediaEncoder">The media encoder.</param>
|
|
|
|
|
public ImageProcessor(
|
|
|
|
|
ILogger<ImageProcessor> logger,
|
|
|
|
|
IServerApplicationPaths appPaths,
|
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
|
IImageEncoder imageEncoder,
|
|
|
|
|
Func<ILibraryManager> libraryManager,
|
|
|
|
|
Func<IMediaEncoder> mediaEncoder)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_fileSystem = fileSystem;
|
|
|
|
|
_imageEncoder = imageEncoder;
|
|
|
|
|
_libraryManager = libraryManager;
|
|
|
|
|
_mediaEncoder = mediaEncoder;
|
|
|
|
|
_appPaths = appPaths;
|
|
|
|
|
}
|
|
|
|
@ -126,21 +122,9 @@ namespace Emby.Drawing
|
|
|
|
|
throw new ArgumentNullException(nameof(options));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var libraryManager = _libraryManager();
|
|
|
|
|
|
|
|
|
|
ItemImageInfo originalImage = options.Image;
|
|
|
|
|
BaseItem item = options.Item;
|
|
|
|
|
|
|
|
|
|
if (!originalImage.IsLocalFile)
|
|
|
|
|
{
|
|
|
|
|
if (item == null)
|
|
|
|
|
{
|
|
|
|
|
item = libraryManager.GetItemById(options.ItemId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
originalImage = await libraryManager.ConvertImageToLocal(item, originalImage, options.ImageIndex).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string originalImagePath = originalImage.Path;
|
|
|
|
|
DateTime dateModified = originalImage.DateModified;
|
|
|
|
|
ImageDimensions? originalImageSize = null;
|
|
|
|
@ -312,10 +296,6 @@ namespace Emby.Drawing
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info)
|
|
|
|
|
=> GetImageDimensions(item, info, true);
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info, bool updateItem)
|
|
|
|
|
{
|
|
|
|
|
int width = info.Width;
|
|
|
|
|
int height = info.Height;
|
|
|
|
@ -332,11 +312,6 @@ namespace Emby.Drawing
|
|
|
|
|
info.Width = size.Width;
|
|
|
|
|
info.Height = size.Height;
|
|
|
|
|
|
|
|
|
|
if (updateItem)
|
|
|
|
|
{
|
|
|
|
|
_libraryManager().UpdateImages(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|