aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs')
-rw-r--r--MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs18
1 files changed, 14 insertions, 4 deletions
diff --git a/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs b/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs
index 13920d942d..115b80434c 100644
--- a/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs
+++ b/MediaBrowser.Providers/TV/FanArtTvUpdatesPostScanTask.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Music;
@@ -54,7 +55,9 @@ namespace MediaBrowser.Providers.TV
/// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- if (!_config.Configuration.EnableFanArtUpdates)
+ var options = FanartSeriesProvider.Current.GetFanartOptions();
+
+ if (!options.EnableAutomaticUpdates)
{
progress.Report(100);
return;
@@ -82,7 +85,7 @@ namespace MediaBrowser.Providers.TV
// If this is our first time, don't do any updates and just record the timestamp
if (!string.IsNullOrEmpty(lastUpdateTime))
{
- var seriesToUpdate = await GetSeriesIdsToUpdate(existingDirectories, lastUpdateTime, cancellationToken).ConfigureAwait(false);
+ var seriesToUpdate = await GetSeriesIdsToUpdate(existingDirectories, lastUpdateTime, options, cancellationToken).ConfigureAwait(false);
progress.Report(5);
@@ -103,12 +106,19 @@ namespace MediaBrowser.Providers.TV
/// <param name="lastUpdateTime">The last update time.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{System.String}}.</returns>
- private async Task<IEnumerable<string>> GetSeriesIdsToUpdate(IEnumerable<string> existingSeriesIds, string lastUpdateTime, CancellationToken cancellationToken)
+ private async Task<IEnumerable<string>> GetSeriesIdsToUpdate(IEnumerable<string> existingSeriesIds, string lastUpdateTime, FanartOptions options, CancellationToken cancellationToken)
{
+ var url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime);
+
+ if (!string.IsNullOrWhiteSpace(options.UserApiKey))
+ {
+ url += "&client_key=" + options.UserApiKey;
+ }
+
// First get last time
using (var stream = await _httpClient.Get(new HttpRequestOptions
{
- Url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime),
+ Url = url,
CancellationToken = cancellationToken,
EnableHttpCompression = true,
ResourcePool = FanartArtistProvider.Current.FanArtResourcePool