From 51ca72ab5d88f6e4bc910e7744bdecb6284bc00b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 5 Oct 2017 14:10:07 -0400 Subject: [PATCH] adjust default provider order --- MediaBrowser.Api/StartupWizardService.cs | 1 + MediaBrowser.Controller/Providers/MetadataResult.cs | 1 + .../Configuration/ServerConfiguration.cs | 9 ++++++--- MediaBrowser.Providers/Manager/MetadataService.cs | 2 ++ MediaBrowser.Providers/Manager/ProviderUtils.cs | 2 +- MediaBrowser.Providers/Movies/MovieDbProvider.cs | 3 +-- .../Movies/MovieDbTrailerProvider.cs | 3 +-- MediaBrowser.Providers/Omdb/OmdbItemProvider.cs | 11 ++++++++++- MediaBrowser.Providers/Omdb/OmdbProvider.cs | 6 +++--- .../TV/TheTVDB/TvdbSeriesProvider.cs | 3 +-- 10 files changed, 27 insertions(+), 14 deletions(-) diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index 22f1f3b62..52a5e444f 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -95,6 +95,7 @@ namespace MediaBrowser.Api config.EnableSimpleArtistDetection = true; config.EnableNormalizedItemByNameIds = true; config.DisableLiveTvChannelUserDataName = true; + config.EnableNewOmdbSupport = true; } public void Post(UpdateStartupConfiguration request) diff --git a/MediaBrowser.Controller/Providers/MetadataResult.cs b/MediaBrowser.Controller/Providers/MetadataResult.cs index 5ed55ea16..f35d41ca4 100644 --- a/MediaBrowser.Controller/Providers/MetadataResult.cs +++ b/MediaBrowser.Controller/Providers/MetadataResult.cs @@ -20,6 +20,7 @@ namespace MediaBrowser.Controller.Providers public bool HasMetadata { get; set; } public T Item { get; set; } public string ResultLanguage { get; set; } + public string Provider { get; set; } public bool QueriedById { get; set; } public void AddPerson(PersonInfo p) { diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index f7fffbf79..65b054b0c 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -183,6 +183,7 @@ namespace MediaBrowser.Model.Configuration public bool EnableExternalContentInSuggestions { get; set; } public bool RequireHttps { get; set; } public bool IsBehindProxy { get; set; } + public bool EnableNewOmdbSupport { get; set; } public int ImageExtractionTimeoutMs { get; set; } @@ -343,8 +344,8 @@ namespace MediaBrowser.Model.Configuration Type = ImageType.Logo } }, - - DisabledImageFetchers = new [] {"FanArt"} + DisabledMetadataFetchers = new []{ "The Open Movie Database" }, + DisabledImageFetchers = new []{ "The Open Movie Database", "FanArt" } }, new MetadataOptions(1, 1280) @@ -389,7 +390,9 @@ namespace MediaBrowser.Model.Configuration Limit = 1, Type = ImageType.Logo } - } + }, + DisabledMetadataFetchers = new []{ "TheMovieDb" }, + DisabledImageFetchers = new []{ "TheMovieDb" } }, new MetadataOptions(1, 1280) diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index f222b2da4..23c6b3efd 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -655,6 +655,8 @@ namespace MediaBrowser.Providers.Manager if (result.HasMetadata) { + result.Provider = provider.Name; + results.Add(result); refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataDownload; diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs index 41612321b..b727e1354 100644 --- a/MediaBrowser.Providers/Manager/ProviderUtils.cs +++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs @@ -51,7 +51,7 @@ namespace MediaBrowser.Providers.Manager } } - if (replaceData || !target.CommunityRating.HasValue) + if (replaceData || !target.CommunityRating.HasValue || (source.CommunityRating.HasValue && string.Equals(sourceResult.Provider, "The Open Movie Database", StringComparison.OrdinalIgnoreCase))) { target.CommunityRating = source.CommunityRating; } diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index fe798d4f0..0a6067694 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -629,8 +629,7 @@ namespace MediaBrowser.Providers.Movies { get { - // After Omdb - return 1; + return 0; } } diff --git a/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs b/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs index 36297914d..6d1259d20 100644 --- a/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs @@ -36,8 +36,7 @@ namespace MediaBrowser.Providers.Movies { get { - // After Omdb - return 1; + return 0; } } diff --git a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs index e769c8cab..bab1374c2 100644 --- a/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbItemProvider.cs @@ -22,7 +22,7 @@ using System.Threading.Tasks; namespace MediaBrowser.Providers.Omdb { public class OmdbItemProvider : IRemoteMetadataProvider, - IRemoteMetadataProvider, IRemoteMetadataProvider + IRemoteMetadataProvider, IRemoteMetadataProvider, IHasOrder { private readonly IJsonSerializer _jsonSerializer; private readonly IHttpClient _httpClient; @@ -41,6 +41,15 @@ namespace MediaBrowser.Providers.Omdb _configurationManager = configurationManager; } + public int Order + { + get + { + // After primary option + return 1; + } + } + public Task> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken) { return GetSearchResults(searchInfo, "series", cancellationToken); diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index e2043faaf..c481bf0e9 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -46,7 +46,7 @@ namespace MediaBrowser.Providers.Omdb var result = await GetRootObject(imdbId, cancellationToken).ConfigureAwait(false); // Only take the name and rating if the user's language is set to english, since Omdb has no localization - if (string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(language, "en", StringComparison.OrdinalIgnoreCase) || _configurationManager.Configuration.EnableNewOmdbSupport) { item.Name = result.Title; @@ -153,7 +153,7 @@ namespace MediaBrowser.Providers.Omdb } // Only take the name and rating if the user's language is set to english, since Omdb has no localization - if (string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(language, "en", StringComparison.OrdinalIgnoreCase) || _configurationManager.Configuration.EnableNewOmdbSupport) { item.Name = result.Title; @@ -389,7 +389,7 @@ namespace MediaBrowser.Providers.Omdb { T item = itemResult.Item; - var isConfiguredForEnglish = IsConfiguredForEnglish(item); + var isConfiguredForEnglish = IsConfiguredForEnglish(item) || _configurationManager.Configuration.EnableNewOmdbSupport; // Grab series genres because imdb data is better than tvdb. Leave movies alone // But only do it if english is the preferred language because this data will not be localized diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs index af18f5f0b..812d80b3b 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs @@ -1631,8 +1631,7 @@ namespace MediaBrowser.Providers.TV { get { - // After Omdb - return 1; + return 0; } }