The Free Software Media System - Server Backend & API
fixes #979 - Support personal fanart api key
Luke Pulverentif55217406985
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.csindex f9c5c65674..e30cf1789d 100644--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs@@ -149,7 +149,9 @@ namespace MediaBrowser.Model.Configuration/// <value><c>true</c> if [enable tv db updates]; otherwise, <c>false</c>.</value>public bool EnableTvDbUpdates { get; set; }public bool EnableTmdbUpdates { get; set; }+public bool EnableFanArtUpdates { get; set; }+ public string FanartApiKey { get; set; }/// <summary>/// Gets or sets the image saving convention.diff --git a/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPostScanTask.cs b/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPostScanTask.csindex 2936fec0ec..2f3d8ceeae 100644--- a/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPostScanTask.cs+++ b/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPostScanTask.cs@@ -98,10 +98,17 @@ namespace MediaBrowser.Providers.Moviesprivate async Task<IEnumerable<string>> GetMovieIdsToUpdate(IEnumerable<string> existingIds, string lastUpdateTime, CancellationToken cancellationToken){+ var url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime);++ if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))+ {+ url += "&client_key=" + _config.Configuration.FanartApiKey;+ }+// First get last timeusing (var stream = await _httpClient.Get(new HttpRequestOptions{- Url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime),+ Url = url,CancellationToken = cancellationToken,EnableHttpCompression = true,ResourcePool = FanartArtistProvider.Current.FanArtResourcePooldiff --git a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.csindex 6813f2ff5e..91d8830e60 100644--- a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs+++ b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs@@ -283,6 +283,11 @@ namespace MediaBrowser.Providers.Moviesvar url = string.Format(FanArtBaseUrl, FanartArtistProvider.ApiKey, id);+ if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))+ {+ url += "&client_key=" + _config.Configuration.FanartApiKey;+ }+var path = GetFanartJsonPath(id);Directory.CreateDirectory(Path.GetDirectoryName(path));diff --git a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Providers/Music/FanArtArtistProvider.csindex 6f633cfc87..6bb4b0aeff 100644--- a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs+++ b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs@@ -423,6 +423,11 @@ namespace MediaBrowser.Providers.Musicvar url = string.Format(FanArtBaseUrl, ApiKey, musicBrainzId);+ if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))+ {+ url += "&client_key=" + _config.Configuration.FanartApiKey;+ }+var xmlPath = GetArtistXmlPath(_config.ApplicationPaths, musicBrainzId);Directory.CreateDirectory(Path.GetDirectoryName(xmlPath));diff --git a/MediaBrowser.Providers/Music/FanArtUpdatesPostScanTask.cs b/MediaBrowser.Providers/Music/FanArtUpdatesPostScanTask.csindex 4c6706287c..703153e319 100644--- a/MediaBrowser.Providers/Music/FanArtUpdatesPostScanTask.cs+++ b/MediaBrowser.Providers/Music/FanArtUpdatesPostScanTask.cs@@ -104,10 +104,17 @@ namespace MediaBrowser.Providers.Music/// <returns>Task{IEnumerable{System.String}}.</returns>private async Task<IEnumerable<string>> GetArtistIdsToUpdate(IEnumerable<string> existingArtistIds, string lastUpdateTime, CancellationToken cancellationToken){+ var url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime);++ if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))+ {+ url += "&client_key=" + _config.Configuration.FanartApiKey;+ }+// First get last timeusing (var stream = await _httpClient.Get(new HttpRequestOptions{- Url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime),+ Url = url,CancellationToken = cancellationToken,EnableHttpCompression = true,ResourcePool = FanartArtistProvider.Current.FanArtResourcePooldiff --git a/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs b/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.csindex 13920d942d..567f3b5daa 100644--- a/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs+++ b/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs@@ -105,10 +105,17 @@ namespace MediaBrowser.Providers.TV/// <returns>Task{IEnumerable{System.String}}.</returns>private async Task<IEnumerable<string>> GetSeriesIdsToUpdate(IEnumerable<string> existingSeriesIds, string lastUpdateTime, CancellationToken cancellationToken){+ var url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime);++ if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))+ {+ url += "&client_key=" + _config.Configuration.FanartApiKey;+ }+// First get last timeusing (var stream = await _httpClient.Get(new HttpRequestOptions{- Url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime),+ Url = url,CancellationToken = cancellationToken,EnableHttpCompression = true,ResourcePool = FanartArtistProvider.Current.FanArtResourcePooldiff --git a/MediaBrowser.Providers/TV/FanartSeriesProvider.cs b/MediaBrowser.Providers/TV/FanartSeriesProvider.csindex 8ba25e9f1f..f95b6b2c68 100644--- a/MediaBrowser.Providers/TV/FanartSeriesProvider.cs+++ b/MediaBrowser.Providers/TV/FanartSeriesProvider.cs@@ -295,6 +295,11 @@ namespace MediaBrowser.Providers.TVvar url = string.Format(FanArtBaseUrl, FanartArtistProvider.ApiKey, tvdbId);+ if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))+ {+ url += "&client_key=" + _config.Configuration.FanartApiKey;+ }+var path = GetFanartJsonPath(tvdbId);Directory.CreateDirectory(Path.GetDirectoryName(path));diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.jsonindex 1935fba93d..e3add2f19b 100644--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json@@ -314,12 +314,14 @@"OptionEpisodes": "Episodes","OptionOtherVideos": "Other Videos","TitleMetadata": "Metadata",- "LabelAutomaticUpdatesFanart": "Enable automatic updates from FanArt.tv",+ "LabelAutomaticUpdates": "Enable automatic updates","LabelAutomaticUpdatesTmdb": "Enable automatic updates from TheMovieDB.org","LabelAutomaticUpdatesTvdb": "Enable automatic updates from TheTVDB.com","LabelAutomaticUpdatesFanartHelp": "If enabled, new images will be downloaded automatically as they're added to fanart.tv. Existing images will not be replaced.","LabelAutomaticUpdatesTmdbHelp": "If enabled, new images will be downloaded automatically as they're added to TheMovieDB.org. Existing images will not be replaced.","LabelAutomaticUpdatesTvdbHelp": "If enabled, new images will be downloaded automatically as they're added to TheTVDB.com. Existing images will not be replaced.",+ "LabelFanartApiKey": "Personal api key:",+ "LabelFanartApiKeyHelp": "Requests to fanart without a personal API key return results that were approved over 7 days ago. With a personal API key that drops to 48 hours and if you are also a fanart VIP member that will further drop to around 10 minutes.","ExtractChapterImagesHelp": "Extracting chapter images will allow clients to display graphical scene selection menus. The process can be slow, cpu-intensive and may require several gigabytes of space. It runs when videos are discovered, and also as a nightly scheduled task at 4am. The schedule is configurable in the scheduled tasks area. It is not recommended to run this task during peak usage hours.","LabelMetadataDownloadLanguage": "Preferred download language:","ButtonAutoScroll": "Auto-scroll",