update image methods

This commit is contained in:
Luke Pulverenti 2017-05-19 13:09:37 -04:00
parent 9ceff1e96a
commit 799494af0b
7 changed files with 26 additions and 26 deletions

View File

@ -670,7 +670,7 @@ namespace Emby.Drawing
var ehnancedImagePath = await GetEnhancedImageInternal(originalImagePath, item, imageType, imageIndex, enhancers, cacheGuid).ConfigureAwait(false);
// If the path changed update dateModified
if (!ehnancedImagePath.Equals(originalImagePath, StringComparison.OrdinalIgnoreCase))
if (!string.Equals(ehnancedImagePath, originalImagePath, StringComparison.OrdinalIgnoreCase))
{
return GetResult(ehnancedImagePath);
}
@ -829,7 +829,7 @@ namespace Emby.Drawing
return Path.Combine(path, filename);
}
public async Task CreateImageCollage(ImageCollageOptions options)
public void CreateImageCollage(ImageCollageOptions options)
{
_logger.Info("Creating image collage and saving to {0}", options.OutputPath);

View File

@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Collections
return Task.FromResult(GetFinalItems(items, 2));
}
protected override Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected string CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
}

View File

@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Images
{
var outputPathWithoutExtension = Path.Combine(ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N"));
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(outputPathWithoutExtension));
string outputPath = await CreateImage(item, itemsWithImages, outputPathWithoutExtension, imageType, 0).ConfigureAwait(false);
string outputPath = CreateImage(item, itemsWithImages, outputPathWithoutExtension, imageType, 0);
if (string.IsNullOrWhiteSpace(outputPath))
{
@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.Images
protected abstract Task<List<BaseItem>> GetItemsWithImages(IHasImages item);
protected Task<string> CreateThumbCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath)
protected string CreateThumbCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath)
{
return CreateCollage(primaryItem, items, outputPath, 640, 360);
}
@ -188,22 +188,22 @@ namespace Emby.Server.Implementations.Images
.Where(i => !string.IsNullOrWhiteSpace(i));
}
protected Task<string> CreatePosterCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath)
protected string CreatePosterCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath)
{
return CreateCollage(primaryItem, items, outputPath, 400, 600);
}
protected Task<string> CreateSquareCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath)
protected string CreateSquareCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath)
{
return CreateCollage(primaryItem, items, outputPath, 600, 600);
}
protected Task<string> CreateThumbCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath, int width, int height)
protected string CreateThumbCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath, int width, int height)
{
return CreateCollage(primaryItem, items, outputPath, width, height);
}
private async Task<string> CreateCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath, int width, int height)
private string CreateCollage(IHasImages primaryItem, List<BaseItem> items, string outputPath, int width, int height)
{
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(outputPath));
@ -225,7 +225,7 @@ namespace Emby.Server.Implementations.Images
return null;
}
await ImageProcessor.CreateImageCollage(options).ConfigureAwait(false);
ImageProcessor.CreateImageCollage(options);
return outputPath;
}
@ -234,7 +234,7 @@ namespace Emby.Server.Implementations.Images
get { return "Dynamic Image Provider"; }
}
protected virtual async Task<string> CreateImage(IHasImages item,
protected virtual string CreateImage(IHasImages item,
List<BaseItem> itemsWithImages,
string outputPathWithoutExtension,
ImageType imageType,
@ -249,20 +249,20 @@ namespace Emby.Server.Implementations.Images
if (imageType == ImageType.Thumb)
{
return await CreateThumbCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
return CreateThumbCollage(item, itemsWithImages, outputPath);
}
if (imageType == ImageType.Primary)
{
if (item is UserView)
{
return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
return CreateSquareCollage(item, itemsWithImages, outputPath);
}
if (item is Playlist || item is MusicGenre || item is Genre || item is GameGenre || item is PhotoAlbum)
{
return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
return CreateSquareCollage(item, itemsWithImages, outputPath);
}
return await CreatePosterCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
return CreatePosterCollage(item, itemsWithImages, outputPath);
}
throw new ArgumentException("Unexpected image type");
@ -346,7 +346,7 @@ namespace Emby.Server.Implementations.Images
}
}
protected async Task<string> CreateSingleImage(List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType)
protected string CreateSingleImage(List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType)
{
var image = itemsWithImages
.Where(i => i.HasImage(imageType) && i.GetImageInfo(imageType, 0).IsLocalFile && Path.HasExtension(i.GetImagePath(imageType)))

View File

@ -26,7 +26,7 @@ namespace Emby.Server.Implementations.Photos
return Task.FromResult(items);
}
protected override Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected string CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
}

View File

@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.UserViews
return item is CollectionFolder;
}
protected override async Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected override string CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ".png");
@ -109,10 +109,10 @@ namespace Emby.Server.Implementations.UserViews
return null;
}
return await CreateThumbCollage(item, itemsWithImages, outputPath, 960, 540).ConfigureAwait(false);
return CreateThumbCollage(item, itemsWithImages, outputPath, 960, 540);
}
return await base.CreateImage(item, itemsWithImages, outputPath, imageType, imageIndex).ConfigureAwait(false);
return base.CreateImage(item, itemsWithImages, outputPath, imageType, imageIndex);
}
}
@ -155,7 +155,7 @@ namespace Emby.Server.Implementations.UserViews
return item is ManualCollectionsFolder;
}
protected override async Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected override string CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ".png");
@ -166,10 +166,10 @@ namespace Emby.Server.Implementations.UserViews
return null;
}
return await CreateThumbCollage(item, itemsWithImages, outputPath, 960, 540).ConfigureAwait(false);
return CreateThumbCollage(item, itemsWithImages, outputPath, 960, 540);
}
return await base.CreateImage(item, itemsWithImages, outputPath, imageType, imageIndex).ConfigureAwait(false);
return base.CreateImage(item, itemsWithImages, outputPath, imageType, imageIndex);
}
}

View File

@ -159,7 +159,7 @@ namespace Emby.Server.Implementations.UserViews
return collectionStripViewTypes.Contains(view.ViewType ?? string.Empty);
}
protected override async Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected override string CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
if (itemsWithImages.Count == 0)
{
@ -168,7 +168,7 @@ namespace Emby.Server.Implementations.UserViews
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ".png");
return await CreateThumbCollage(item, itemsWithImages, outputPath, 960, 540).ConfigureAwait(false);
return CreateThumbCollage(item, itemsWithImages, outputPath, 960, 540);
}
}
}

View File

@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Drawing
/// Creates the image collage.
/// </summary>
/// <param name="options">The options.</param>
Task CreateImageCollage(ImageCollageOptions options);
void CreateImageCollage(ImageCollageOptions options);
/// <summary>
/// Gets a value indicating whether [supports image collage creation].