mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
update PhotoAlbumImageProvider
This commit is contained in:
parent
06efa32e8f
commit
6e463ef70a
1 changed files with 9 additions and 5 deletions
|
@ -7,6 +7,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Photos
|
namespace MediaBrowser.Server.Implementations.Photos
|
||||||
{
|
{
|
||||||
|
@ -25,19 +26,22 @@ namespace MediaBrowser.Server.Implementations.Photos
|
||||||
return Task.FromResult(items);
|
return Task.FromResult(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, Model.Entities.ImageType imageType, int imageIndex)
|
protected override async Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
||||||
{
|
{
|
||||||
var photoFile = itemsWithImages.Where(i => Path.HasExtension(i.Path)).Select(i => i.Path).FirstOrDefault();
|
var image = itemsWithImages
|
||||||
|
.Where(i => i.HasImage(ImageType.Primary) && i.GetImageInfo(ImageType.Primary, 0).IsLocalFile && Path.HasExtension(i.GetImagePath(ImageType.Primary)))
|
||||||
|
.Select(i => i.GetImagePath(ImageType.Primary))
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(photoFile))
|
if (string.IsNullOrWhiteSpace(image))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ext = Path.GetExtension(photoFile);
|
var ext = Path.GetExtension(image);
|
||||||
|
|
||||||
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ext);
|
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ext);
|
||||||
File.Copy(photoFile, outputPath);
|
File.Copy(image, outputPath);
|
||||||
|
|
||||||
return outputPath;
|
return outputPath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue