diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-10-28 12:45:06 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-10-28 12:45:06 -0400 |
| commit | 3b2f98a619ad7aa386de62ffa19c61d274521503 (patch) | |
| tree | 0e8a34aee398ee5d1ce8ecdb73a5192927de726d | |
| parent | e47ed8194a388a4c156be3aaaad40e43f266b32d (diff) | |
| parent | 6e463ef70ae93af49036d379b2da1f835cebe99d (diff) | |
Merge pull request #1231 from MediaBrowser/master
update PhotoAlbumImageProvider
| -rw-r--r-- | MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs index 8b73d03d8..32b046d3a 100644 --- a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using CommonIO; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Server.Implementations.Photos { @@ -25,19 +26,22 @@ namespace MediaBrowser.Server.Implementations.Photos 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; } - var ext = Path.GetExtension(photoFile); + var ext = Path.GetExtension(image); var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ext); - File.Copy(photoFile, outputPath); + File.Copy(image, outputPath); return outputPath; } |
