diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.cs index 36b509c740..960de017de 100644 --- a/MediaBrowser.Api/Images/RemoteImageService.cs +++ b/MediaBrowser.Api/Images/RemoteImageService.cs @@ -40,9 +40,6 @@ namespace MediaBrowser.Api.Images [ApiMember(Name = "ProviderName", Description = "Optional. The image provider to use", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string ProviderName { get; set; } - - [ApiMember(Name = "IncludeAllLanguages", Description = "Optional.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] - public bool IncludeAllLanguages { get; set; } } [Route("/Items/{Id}/RemoteImages", "GET")] @@ -220,14 +217,7 @@ namespace MediaBrowser.Api.Images private RemoteImageResult GetRemoteImageResult(BaseItem item, BaseRemoteImageRequest request) { - var images = _providerManager.GetAvailableRemoteImages(item, new RemoteImageQuery - { - ProviderName = request.ProviderName, - IncludeAllLanguages = request.IncludeAllLanguages, - IncludeDisabledProviders = true, - ImageType = request.Type - - }, CancellationToken.None).Result; + var images = _providerManager.GetAvailableRemoteImages(item, CancellationToken.None, request.ProviderName, request.Type).Result; var imagesList = images.ToList(); diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index e7a5014790..48041da111 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -190,8 +190,6 @@ namespace MediaBrowser.Controller.LiveTv public override Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken) { - DateLastSaved = DateTime.UtcNow; - // Avoid library manager and keep out of in-memory cache // Not great that this class has to know about that, but we'll improve that later. return ItemRepository.SaveItem(this, cancellationToken); diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs index 691a5add63..a4800955d1 100644 --- a/MediaBrowser.Controller/Providers/IProviderManager.cs +++ b/MediaBrowser.Controller/Providers/IProviderManager.cs @@ -62,10 +62,11 @@ namespace MediaBrowser.Controller.Providers /// Gets the available remote images. /// /// The item. - /// The query. /// The cancellation token. + /// Name of the provider. + /// The type. /// Task{IEnumerable{RemoteImageInfo}}. - Task> GetAvailableRemoteImages(IHasImages item, RemoteImageQuery query, CancellationToken cancellationToken); + Task> GetAvailableRemoteImages(IHasImages item, CancellationToken cancellationToken, string providerName = null, ImageType? type = null); /// /// Gets the image providers. diff --git a/MediaBrowser.Model/Providers/RemoteImageResult.cs b/MediaBrowser.Model/Providers/RemoteImageResult.cs index ed2788c0b4..1c60db6ae1 100644 --- a/MediaBrowser.Model/Providers/RemoteImageResult.cs +++ b/MediaBrowser.Model/Providers/RemoteImageResult.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using MediaBrowser.Model.Entities; namespace MediaBrowser.Model.Providers { @@ -26,15 +25,4 @@ namespace MediaBrowser.Model.Providers /// The providers. public List Providers { get; set; } } - - public class RemoteImageQuery - { - public string ProviderName { get; set; } - - public ImageType? ImageType { get; set; } - - public bool IncludeDisabledProviders { get; set; } - - public bool IncludeAllLanguages { get; set; } - } } diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs index 773ad354c6..c4cce93103 100644 --- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs +++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs @@ -213,14 +213,7 @@ namespace MediaBrowser.Providers.Manager _logger.Debug("Running {0} for {1}", provider.GetType().Name, item.Path ?? item.Name); - var images = await _providerManager.GetAvailableRemoteImages(item, new RemoteImageQuery - { - ProviderName = provider.Name, - IncludeAllLanguages = false, - IncludeDisabledProviders = false, - - }, cancellationToken).ConfigureAwait(false); - + var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, provider.Name).ConfigureAwait(false); var list = images.ToList(); int minWidth; diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index 58c05a80bf..db0a25ec6f 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -205,31 +205,26 @@ namespace MediaBrowser.Providers.Manager /// Gets the available remote images. /// /// The item. - /// The query. /// The cancellation token. + /// Name of the provider. + /// The type. /// Task{IEnumerable{RemoteImageInfo}}. - public async Task> GetAvailableRemoteImages(IHasImages item, RemoteImageQuery query, CancellationToken cancellationToken) + public async Task> GetAvailableRemoteImages(IHasImages item, CancellationToken cancellationToken, string providerName = null, ImageType? type = null) { - var providers = GetRemoteImageProviders(item, query.IncludeDisabledProviders); + var providers = GetRemoteImageProviders(item, true); - if (!string.IsNullOrEmpty(query.ProviderName)) + if (!string.IsNullOrEmpty(providerName)) { - var providerName = query.ProviderName; - providers = providers.Where(i => string.Equals(i.Name, providerName, StringComparison.OrdinalIgnoreCase)); } var preferredLanguage = item.GetPreferredMetadataLanguage(); - var language = query.IncludeAllLanguages ? null : preferredLanguage; - - var tasks = providers.Select(i => GetImages(item, cancellationToken, i, language, query.ImageType)); + var tasks = providers.Select(i => GetImages(item, cancellationToken, i, preferredLanguage, type)); var results = await Task.WhenAll(tasks).ConfigureAwait(false); - var images = results.SelectMany(i => i); - - return images; + return results.SelectMany(i => i); } /// @@ -249,15 +244,12 @@ namespace MediaBrowser.Providers.Manager { var result = await i.GetImages(item, type.Value, cancellationToken).ConfigureAwait(false); - return string.IsNullOrEmpty(preferredLanguage) ? result : - FilterImages(result, preferredLanguage); + return FilterImages(result, preferredLanguage); } else { var result = await i.GetAllImages(item, cancellationToken).ConfigureAwait(false); - - return string.IsNullOrEmpty(preferredLanguage) ? result : - FilterImages(result, preferredLanguage); + return FilterImages(result, preferredLanguage); } } catch (Exception ex)