From 549f82695063731209591042102b2aa2dd05cd51 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 20 May 2013 01:36:22 -0400 Subject: [PATCH] catch 404's on requests to banners.xml --- .../Providers/TV/RemoteSeriesProvider.cs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs index 28205c6508..1e126de143 100644 --- a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs +++ b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs @@ -360,16 +360,30 @@ namespace MediaBrowser.Controller.Providers.TV string url = string.Format("http://www.thetvdb.com/api/" + TVUtils.TvdbApiKey + "/series/{0}/banners.xml", seriesId); var images = new XmlDocument(); - using (var imgs = await HttpClient.Get(new HttpRequestOptions + try { - Url = url, - ResourcePool = TvDbResourcePool, - CancellationToken = cancellationToken, - EnableResponseCache = true + using (var imgs = await HttpClient.Get(new HttpRequestOptions + { + Url = url, + ResourcePool = TvDbResourcePool, + CancellationToken = cancellationToken, + EnableResponseCache = true - }).ConfigureAwait(false)) + }).ConfigureAwait(false)) + { + images.Load(imgs); + } + } + catch (HttpException ex) { - images.Load(imgs); + if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound) + { + // If a series has no images this will produce a 404. + // Return gracefully so we don't keep retrying on subsequent scans + return; + } + + throw; } if (images.HasChildNodes)