fixes #979 - Support personal fanart api key

pull/702/head
Luke Pulverenti 10 years ago
parent f9662e23e9
commit f552174069

@ -149,7 +149,9 @@ namespace MediaBrowser.Model.Configuration
/// <value><c>true</c> if [enable tv db updates]; otherwise, <c>false</c>.</value> /// <value><c>true</c> if [enable tv db updates]; otherwise, <c>false</c>.</value>
public bool EnableTvDbUpdates { get; set; } public bool EnableTvDbUpdates { get; set; }
public bool EnableTmdbUpdates { get; set; } public bool EnableTmdbUpdates { get; set; }
public bool EnableFanArtUpdates { get; set; } public bool EnableFanArtUpdates { get; set; }
public string FanartApiKey { get; set; }
/// <summary> /// <summary>
/// Gets or sets the image saving convention. /// Gets or sets the image saving convention.

@ -98,10 +98,17 @@ namespace MediaBrowser.Providers.Movies
private async Task<IEnumerable<string>> GetMovieIdsToUpdate(IEnumerable<string> existingIds, string lastUpdateTime, CancellationToken cancellationToken) private 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 time // First get last time
using (var stream = await _httpClient.Get(new HttpRequestOptions using (var stream = await _httpClient.Get(new HttpRequestOptions
{ {
Url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime), Url = url,
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
EnableHttpCompression = true, EnableHttpCompression = true,
ResourcePool = FanartArtistProvider.Current.FanArtResourcePool ResourcePool = FanartArtistProvider.Current.FanArtResourcePool

@ -283,6 +283,11 @@ namespace MediaBrowser.Providers.Movies
var url = string.Format(FanArtBaseUrl, FanartArtistProvider.ApiKey, id); var url = string.Format(FanArtBaseUrl, FanartArtistProvider.ApiKey, id);
if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))
{
url += "&client_key=" + _config.Configuration.FanartApiKey;
}
var path = GetFanartJsonPath(id); var path = GetFanartJsonPath(id);
Directory.CreateDirectory(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));

@ -423,6 +423,11 @@ namespace MediaBrowser.Providers.Music
var url = string.Format(FanArtBaseUrl, ApiKey, musicBrainzId); var url = string.Format(FanArtBaseUrl, ApiKey, musicBrainzId);
if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))
{
url += "&client_key=" + _config.Configuration.FanartApiKey;
}
var xmlPath = GetArtistXmlPath(_config.ApplicationPaths, musicBrainzId); var xmlPath = GetArtistXmlPath(_config.ApplicationPaths, musicBrainzId);
Directory.CreateDirectory(Path.GetDirectoryName(xmlPath)); Directory.CreateDirectory(Path.GetDirectoryName(xmlPath));

@ -104,10 +104,17 @@ namespace MediaBrowser.Providers.Music
/// <returns>Task{IEnumerable{System.String}}.</returns> /// <returns>Task{IEnumerable{System.String}}.</returns>
private async Task<IEnumerable<string>> GetArtistIdsToUpdate(IEnumerable<string> existingArtistIds, string lastUpdateTime, CancellationToken cancellationToken) 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 time // First get last time
using (var stream = await _httpClient.Get(new HttpRequestOptions using (var stream = await _httpClient.Get(new HttpRequestOptions
{ {
Url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime), Url = url,
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
EnableHttpCompression = true, EnableHttpCompression = true,
ResourcePool = FanartArtistProvider.Current.FanArtResourcePool ResourcePool = FanartArtistProvider.Current.FanArtResourcePool

@ -105,10 +105,17 @@ namespace MediaBrowser.Providers.TV
/// <returns>Task{IEnumerable{System.String}}.</returns> /// <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, 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 time // First get last time
using (var stream = await _httpClient.Get(new HttpRequestOptions using (var stream = await _httpClient.Get(new HttpRequestOptions
{ {
Url = string.Format(UpdatesUrl, FanartArtistProvider.ApiKey, lastUpdateTime), Url = url,
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
EnableHttpCompression = true, EnableHttpCompression = true,
ResourcePool = FanartArtistProvider.Current.FanArtResourcePool ResourcePool = FanartArtistProvider.Current.FanArtResourcePool

@ -295,6 +295,11 @@ namespace MediaBrowser.Providers.TV
var url = string.Format(FanArtBaseUrl, FanartArtistProvider.ApiKey, tvdbId); var url = string.Format(FanArtBaseUrl, FanartArtistProvider.ApiKey, tvdbId);
if (!string.IsNullOrWhiteSpace(_config.Configuration.FanartApiKey))
{
url += "&client_key=" + _config.Configuration.FanartApiKey;
}
var path = GetFanartJsonPath(tvdbId); var path = GetFanartJsonPath(tvdbId);
Directory.CreateDirectory(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));

@ -314,12 +314,14 @@
"OptionEpisodes": "Episodes", "OptionEpisodes": "Episodes",
"OptionOtherVideos": "Other Videos", "OptionOtherVideos": "Other Videos",
"TitleMetadata": "Metadata", "TitleMetadata": "Metadata",
"LabelAutomaticUpdatesFanart": "Enable automatic updates from FanArt.tv", "LabelAutomaticUpdates": "Enable automatic updates",
"LabelAutomaticUpdatesTmdb": "Enable automatic updates from TheMovieDB.org", "LabelAutomaticUpdatesTmdb": "Enable automatic updates from TheMovieDB.org",
"LabelAutomaticUpdatesTvdb": "Enable automatic updates from TheTVDB.com", "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.", "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.", "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.", "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.", "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:", "LabelMetadataDownloadLanguage": "Preferred download language:",
"ButtonAutoScroll": "Auto-scroll", "ButtonAutoScroll": "Auto-scroll",

Loading…
Cancel
Save