fixes #313 - Corrupt TVDB source causing issue?

This commit is contained in:
Luke Pulverenti 2013-05-26 10:51:48 -04:00
parent 83446ae5fe
commit e57deb61ae

View File

@ -1,4 +1,5 @@
using MediaBrowser.Common.Extensions; using System.Net;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
@ -10,6 +11,7 @@ using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml; using System.Xml;
using MediaBrowser.Model.Net;
namespace MediaBrowser.Controller.Providers.TV namespace MediaBrowser.Controller.Providers.TV
{ {
@ -243,6 +245,8 @@ namespace MediaBrowser.Controller.Providers.TV
{ {
n = n.SelectSingleNode("./BannerPath"); n = n.SelectSingleNode("./BannerPath");
if (n != null) if (n != null)
{
try
{ {
var bannerImagePath = var bannerImagePath =
await _providerManager.DownloadAndSaveImage(season, await _providerManager.DownloadAndSaveImage(season,
@ -254,6 +258,17 @@ namespace MediaBrowser.Controller.Providers.TV
season.SetImage(ImageType.Banner, bannerImagePath); season.SetImage(ImageType.Banner, bannerImagePath);
} }
catch (HttpException ex)
{
Logger.ErrorException("Error downloading season banner for {0}", ex, season.Path);
// Sometimes banners will come up not found even though they're reported in tvdb xml
if (ex.StatusCode.HasValue && ex.StatusCode.Value != HttpStatusCode.NotFound)
{
throw;
}
}
}
} }
} }