From b2b85d20a53216b48115ccbb9e3ff3d9b2d80f91 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 19 May 2013 17:20:47 -0400 Subject: [PATCH] slightly reduce simultaneous requests --- .../HttpClientManager/HttpClientManager.cs | 2 +- .../Providers/FanartBaseProvider.cs | 18 +++++++------- .../Providers/Movies/FanArtMovieProvider.cs | 24 +++++++++---------- .../Providers/Movies/MovieDbProvider.cs | 2 +- .../Providers/Music/FanArtAlbumProvider.cs | 10 ++++---- .../Providers/Music/FanArtArtistProvider.cs | 20 ++++++++-------- .../Providers/TV/FanArtTVProvider.cs | 18 +++++++------- .../Providers/TV/RemoteSeriesProvider.cs | 2 +- .../Providers/ProviderManager.cs | 4 ++-- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 7ea2d0adf..0418bcfc2 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -97,7 +97,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager }; client = new HttpClient(handler); - client.Timeout = TimeSpan.FromSeconds(15); + client.Timeout = TimeSpan.FromSeconds(30); _httpClients.TryAdd(host, client); } diff --git a/MediaBrowser.Controller/Providers/FanartBaseProvider.cs b/MediaBrowser.Controller/Providers/FanartBaseProvider.cs index 617cd3256..9873f0f2c 100644 --- a/MediaBrowser.Controller/Providers/FanartBaseProvider.cs +++ b/MediaBrowser.Controller/Providers/FanartBaseProvider.cs @@ -20,47 +20,47 @@ namespace MediaBrowser.Controller.Providers public abstract class FanartBaseProvider : BaseMetadataProvider { - protected static readonly SemaphoreSlim FanArtResourcePool = new SemaphoreSlim(5,5); + protected static readonly SemaphoreSlim FanArtResourcePool = new SemaphoreSlim(3,3); /// /// The LOG o_ FILE /// - protected const string LOGO_FILE = "logo.png"; + protected const string LogoFile = "logo.png"; /// /// The AR t_ FILE /// - protected const string ART_FILE = "clearart.png"; + protected const string ArtFile = "clearart.png"; /// /// The THUM b_ FILE /// - protected const string THUMB_FILE = "thumb.jpg"; + protected const string ThumbFile = "thumb.jpg"; /// /// The DIS c_ FILE /// - protected const string DISC_FILE = "disc.png"; + protected const string DiscFile = "disc.png"; /// /// The BANNE r_ FILE /// - protected const string BANNER_FILE = "banner.png"; + protected const string BannerFile = "banner.png"; /// /// The Backdrop /// - protected const string BACKDROP_FILE = "backdrop.jpg"; + protected const string BackdropFile = "backdrop.jpg"; /// /// The Primary image /// - protected const string PRIMARY_FILE = "folder.jpg"; + protected const string PrimaryFile = "folder.jpg"; /// /// The API key /// - protected const string APIKey = "5c6b04c68e904cfed1e6cbc9a9e683d4"; + protected const string ApiKey = "5c6b04c68e904cfed1e6cbc9a9e683d4"; protected FanartBaseProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { diff --git a/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs b/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs index 47a46760a..3d115f2b0 100644 --- a/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs +++ b/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs @@ -172,7 +172,7 @@ namespace MediaBrowser.Controller.Providers.Movies var movie = item; var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower(); - var url = string.Format(FanArtBaseUrl, APIKey, movie.GetProviderId(MetadataProviders.Tmdb)); + var url = string.Format(FanArtBaseUrl, ApiKey, movie.GetProviderId(MetadataProviders.Tmdb)); var doc = new XmlDocument(); using (var xml = await HttpClient.Get(new HttpRequestOptions @@ -198,7 +198,7 @@ namespace MediaBrowser.Controller.Providers.Movies var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : ""; var hasLogo = item.LocationType == LocationType.FileSystem ? - item.ResolveArgs.ContainsMetaFileByName(LOGO_FILE) + item.ResolveArgs.ContainsMetaFileByName(LogoFile) : item.HasImage(ImageType.Logo); if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !hasLogo) @@ -214,13 +214,13 @@ namespace MediaBrowser.Controller.Providers.Movies path = node != null ? node.Value : null; if (!string.IsNullOrEmpty(path)) { - movie.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(movie, path, LOGO_FILE, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + movie.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(movie, path, LogoFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); var hasArt = item.LocationType == LocationType.FileSystem ? - item.ResolveArgs.ContainsMetaFileByName(ART_FILE) + item.ResolveArgs.ContainsMetaFileByName(ArtFile) : item.HasImage(ImageType.Art); if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !hasArt) @@ -233,13 +233,13 @@ namespace MediaBrowser.Controller.Providers.Movies path = node != null ? node.Value : null; if (!string.IsNullOrEmpty(path)) { - movie.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(movie, path, ART_FILE, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + movie.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(movie, path, ArtFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); var hasDisc = item.LocationType == LocationType.FileSystem ? - item.ResolveArgs.ContainsMetaFileByName(DISC_FILE) + item.ResolveArgs.ContainsMetaFileByName(DiscFile) : item.HasImage(ImageType.Disc); if (ConfigurationManager.Configuration.DownloadMovieImages.Disc && !hasDisc) @@ -249,14 +249,14 @@ namespace MediaBrowser.Controller.Providers.Movies path = node != null ? node.Value : null; if (!string.IsNullOrEmpty(path)) { - movie.SetImage(ImageType.Disc, await _providerManager.DownloadAndSaveImage(movie, path, DISC_FILE, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + movie.SetImage(ImageType.Disc, await _providerManager.DownloadAndSaveImage(movie, path, DiscFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); var hasBanner = item.LocationType == LocationType.FileSystem ? - item.ResolveArgs.ContainsMetaFileByName(BANNER_FILE) + item.ResolveArgs.ContainsMetaFileByName(BannerFile) : item.HasImage(ImageType.Banner); if (ConfigurationManager.Configuration.DownloadMovieImages.Banner && !hasBanner) @@ -266,14 +266,14 @@ namespace MediaBrowser.Controller.Providers.Movies path = node != null ? node.Value : null; if (!string.IsNullOrEmpty(path)) { - movie.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(movie, path, BANNER_FILE, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + movie.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(movie, path, BannerFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); var hasThumb = item.LocationType == LocationType.FileSystem ? - item.ResolveArgs.ContainsMetaFileByName(THUMB_FILE) + item.ResolveArgs.ContainsMetaFileByName(ThumbFile) : item.HasImage(ImageType.Thumb); if (ConfigurationManager.Configuration.DownloadMovieImages.Thumb && !hasThumb) @@ -283,12 +283,12 @@ namespace MediaBrowser.Controller.Providers.Movies path = node != null ? node.Value : null; if (!string.IsNullOrEmpty(path)) { - movie.SetImage(ImageType.Thumb, await _providerManager.DownloadAndSaveImage(movie, path, THUMB_FILE, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + movie.SetImage(ImageType.Thumb, await _providerManager.DownloadAndSaveImage(movie, path, ThumbFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } var hasBackdrop = item.LocationType == LocationType.FileSystem ? - item.ResolveArgs.ContainsMetaFileByName(BACKDROP_FILE) + item.ResolveArgs.ContainsMetaFileByName(BackdropFile) : item.BackdropImagePaths.Count > 0; if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && !hasBackdrop) diff --git a/MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs index 83d57e5b9..97b2a7f18 100644 --- a/MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs @@ -896,7 +896,7 @@ namespace MediaBrowser.Controller.Providers.Movies try { // Limit to three requests per second - var diff = 330 - (DateTime.Now - _lastRequestDate).TotalMilliseconds; + var diff = 400 - (DateTime.Now - _lastRequestDate).TotalMilliseconds; if (diff > 0) { diff --git a/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs b/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs index 73a71e7e4..1744e96e6 100644 --- a/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs @@ -134,7 +134,7 @@ namespace MediaBrowser.Controller.Providers.Music return true; } - var url = string.Format("http://api.fanart.tv/webservice/album/{0}/{1}/xml/all/1/1", APIKey, album.MusicBrainzReleaseGroupId); + var url = string.Format("http://api.fanart.tv/webservice/album/{0}/{1}/xml/all/1/1", ApiKey, album.MusicBrainzReleaseGroupId); var doc = new XmlDocument(); @@ -154,7 +154,7 @@ namespace MediaBrowser.Controller.Providers.Music if (doc.HasChildNodes) { - if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Disc && !item.ResolveArgs.ContainsMetaFileByName(DISC_FILE)) + if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Disc && !item.ResolveArgs.ContainsMetaFileByName(DiscFile)) { var node = doc.SelectSingleNode("//fanart/music/albums/album/cdart/@url"); @@ -163,11 +163,11 @@ namespace MediaBrowser.Controller.Providers.Music if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting Disc for " + item.Name); - item.SetImage(ImageType.Disc, await _providerManager.DownloadAndSaveImage(item, path, DISC_FILE, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + item.SetImage(ImageType.Disc, await _providerManager.DownloadAndSaveImage(item, path, DiscFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } - if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Primary && !item.ResolveArgs.ContainsMetaFileByName(PRIMARY_FILE)) + if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Primary && !item.ResolveArgs.ContainsMetaFileByName(PrimaryFile)) { var node = doc.SelectSingleNode("//fanart/music/albums/album/albumcover/@url"); @@ -176,7 +176,7 @@ namespace MediaBrowser.Controller.Providers.Music if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting albumcover for " + item.Name); - item.SetImage(ImageType.Primary, await _providerManager.DownloadAndSaveImage(item, path, PRIMARY_FILE, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + item.SetImage(ImageType.Primary, await _providerManager.DownloadAndSaveImage(item, path, PrimaryFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } } diff --git a/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs index 7fdef81f1..fb09e4a7f 100644 --- a/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs @@ -114,7 +114,7 @@ namespace MediaBrowser.Controller.Providers.Music //var artist = item; - var url = string.Format(FanArtBaseUrl, APIKey, item.GetProviderId(MetadataProviders.Musicbrainz)); + var url = string.Format(FanArtBaseUrl, ApiKey, item.GetProviderId(MetadataProviders.Musicbrainz)); var doc = new XmlDocument(); var status = ProviderRefreshStatus.Success; @@ -137,7 +137,7 @@ namespace MediaBrowser.Controller.Providers.Music { string path; var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : ""; - if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.ResolveArgs.ContainsMetaFileByName(LOGO_FILE)) + if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.ResolveArgs.ContainsMetaFileByName(LogoFile)) { var node = doc.SelectSingleNode("//fanart/music/musiclogos/" + hd + "musiclogo/@url") ?? @@ -146,12 +146,12 @@ namespace MediaBrowser.Controller.Providers.Music if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting ClearLogo for " + item.Name); - item.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(item, path, LOGO_FILE, SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + item.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(item, path, LogoFile, SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); - if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops && !item.ResolveArgs.ContainsMetaFileByName(BACKDROP_FILE)) + if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops && !item.ResolveArgs.ContainsMetaFileByName(BackdropFile)) { var nodes = doc.SelectNodes("//fanart/music/artistbackgrounds//@url"); if (nodes != null) @@ -176,7 +176,7 @@ namespace MediaBrowser.Controller.Providers.Music cancellationToken.ThrowIfCancellationRequested(); - if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.ResolveArgs.ContainsMetaFileByName(ART_FILE)) + if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.ResolveArgs.ContainsMetaFileByName(ArtFile)) { var node = doc.SelectSingleNode("//fanart/music/musicarts/" + hd + "musicart/@url") ?? @@ -185,12 +185,12 @@ namespace MediaBrowser.Controller.Providers.Music if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting ClearArt for " + item.Name); - item.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(item, path, ART_FILE, SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + item.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(item, path, ArtFile, SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); - if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.ResolveArgs.ContainsMetaFileByName(BANNER_FILE)) + if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.ResolveArgs.ContainsMetaFileByName(BannerFile)) { var node = doc.SelectSingleNode("//fanart/music/musicbanners/" + hd + "musicbanner/@url") ?? doc.SelectSingleNode("//fanart/music/musicbanners/musicbanner/@url"); @@ -198,21 +198,21 @@ namespace MediaBrowser.Controller.Providers.Music if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting Banner for " + item.Name); - item.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(item, path, BANNER_FILE, SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + item.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(item, path, BannerFile, SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); // Artist thumbs are actually primary images (they are square/portrait) - if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.ResolveArgs.ContainsMetaFileByName(PRIMARY_FILE)) + if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.ResolveArgs.ContainsMetaFileByName(PrimaryFile)) { var node = doc.SelectSingleNode("//fanart/music/artistthumbs/artistthumb/@url"); path = node != null ? node.Value : null; if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting Primary image for " + item.Name); - item.SetImage(ImageType.Primary, await _providerManager.DownloadAndSaveImage(item, path, PRIMARY_FILE, SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + item.SetImage(ImageType.Primary, await _providerManager.DownloadAndSaveImage(item, path, PrimaryFile, SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } } diff --git a/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs b/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs index 4b8095666..534566c84 100644 --- a/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs +++ b/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs @@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Providers.TV var series = (Series)item; string language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower(); - string url = string.Format(FanArtBaseUrl, APIKey, series.GetProviderId(MetadataProviders.Tvdb)); + string url = string.Format(FanArtBaseUrl, ApiKey, series.GetProviderId(MetadataProviders.Tvdb)); var doc = new XmlDocument(); using (var xml = await HttpClient.Get(new HttpRequestOptions @@ -117,7 +117,7 @@ namespace MediaBrowser.Controller.Providers.TV { string path; var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hdtv" : "clear"; - if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !series.ResolveArgs.ContainsMetaFileByName(LOGO_FILE)) + if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !series.ResolveArgs.ContainsMetaFileByName(LogoFile)) { var node = doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo[@lang = \"" + language + "\"]/@url") ?? doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo[@lang = \"" + language + "\"]/@url") ?? @@ -127,14 +127,14 @@ namespace MediaBrowser.Controller.Providers.TV if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting ClearLogo for " + series.Name); - series.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(series, path, LOGO_FILE, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + series.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(series, path, LogoFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : ""; - if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !series.ResolveArgs.ContainsMetaFileByName(ART_FILE)) + if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !series.ResolveArgs.ContainsMetaFileByName(ArtFile)) { var node = doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart[@lang = \"" + language + "\"]/@url") ?? doc.SelectSingleNode("//fanart/series/cleararts/clearart[@lang = \"" + language + "\"]/@url") ?? @@ -144,13 +144,13 @@ namespace MediaBrowser.Controller.Providers.TV if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting ClearArt for " + series.Name); - series.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(series, path, ART_FILE, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + series.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(series, path, ArtFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } cancellationToken.ThrowIfCancellationRequested(); - if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !series.ResolveArgs.ContainsMetaFileByName(THUMB_FILE)) + if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !series.ResolveArgs.ContainsMetaFileByName(ThumbFile)) { var node = doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb[@lang = \"" + language + "\"]/@url") ?? doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb/@url"); @@ -158,11 +158,11 @@ namespace MediaBrowser.Controller.Providers.TV if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting ThumbArt for " + series.Name); - series.SetImage(ImageType.Thumb, await _providerManager.DownloadAndSaveImage(series, path, THUMB_FILE, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + series.SetImage(ImageType.Thumb, await _providerManager.DownloadAndSaveImage(series, path, ThumbFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } - if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.ResolveArgs.ContainsMetaFileByName(BANNER_FILE)) + if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.ResolveArgs.ContainsMetaFileByName(BannerFile)) { var node = doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner[@lang = \"" + language + "\"]/@url") ?? doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner/@url"); @@ -170,7 +170,7 @@ namespace MediaBrowser.Controller.Providers.TV if (!string.IsNullOrEmpty(path)) { Logger.Debug("FanArtProvider getting banner for " + series.Name); - series.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(series, path, BANNER_FILE, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); + series.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(series, path, BannerFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false)); } } } diff --git a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs index 8fec2778a..28205c650 100644 --- a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs +++ b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs @@ -30,7 +30,7 @@ namespace MediaBrowser.Controller.Providers.TV /// /// The tv db /// - internal readonly SemaphoreSlim TvDbResourcePool = new SemaphoreSlim(5, 5); + internal readonly SemaphoreSlim TvDbResourcePool = new SemaphoreSlim(3, 3); internal static RemoteSeriesProvider Current { get; private set; } diff --git a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs index 5f1b4bd58..2b85268cc 100644 --- a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs +++ b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs @@ -186,12 +186,12 @@ namespace MediaBrowser.Server.Implementations.Providers // Put this check below the await because the needs refresh of the next tier of providers may depend on the previous ones running // This is the case for the fan art provider which depends on the movie and tv providers having run before them - if (!force && !provider.NeedsRefresh(item)) + if (provider.RequiresInternet && item.DontFetchMeta) { continue; } - if (provider.RequiresInternet && item.DontFetchMeta) + if (!force && !provider.NeedsRefresh(item)) { continue; }