From b01780a9b7b55bb4f90984f16c2b841ad805f44e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 22 Feb 2016 14:32:35 -0500 Subject: [PATCH] update action sheet --- .../Photos/BaseDynamicImageProvider.cs | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs index c30d35ed2..4a69646f8 100644 --- a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -14,6 +13,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Server.Implementations.Photos { @@ -47,6 +47,41 @@ namespace MediaBrowser.Server.Implementations.Photos }; } + private IEnumerable GetEnabledImages(IHasImages item) + { + //var options = ProviderManager.GetMetadataOptions(item); + + return GetSupportedImages(item); + //return GetSupportedImages(item).Where(i => IsEnabled(options, i, item)).ToList(); + } + + private bool IsEnabled(MetadataOptions options, ImageType type, IHasImages item) + { + if (type == ImageType.Backdrop) + { + if (item.LockedFields.Contains(MetadataFields.Backdrops)) + { + return false; + } + } + else if (type == ImageType.Screenshot) + { + if (item.LockedFields.Contains(MetadataFields.Screenshots)) + { + return false; + } + } + else + { + if (item.LockedFields.Contains(MetadataFields.Images)) + { + return false; + } + } + + return options.IsEnabled(type); + } + public async Task FetchAsync(T item, MetadataRefreshOptions options, CancellationToken cancellationToken) { if (!Supports(item)) @@ -55,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.Photos } var updateType = ItemUpdateType.None; - var supportedImages = GetSupportedImages(item).ToList(); + var supportedImages = GetEnabledImages(item).ToList(); if (supportedImages.Contains(ImageType.Primary)) { @@ -69,7 +104,6 @@ namespace MediaBrowser.Server.Implementations.Photos updateType = updateType | thumbResult; } - return updateType; } @@ -220,7 +254,7 @@ namespace MediaBrowser.Server.Implementations.Photos return false; } - var supportedImages = GetSupportedImages(item).ToList(); + var supportedImages = GetEnabledImages(item).ToList(); if (supportedImages.Contains(ImageType.Primary) && HasChanged(item, ImageType.Primary)) {