make sure series and episode providers are checking for existence of images

This commit is contained in:
Luke Pulverenti 2013-05-20 13:14:15 -04:00
parent 9430b09ae9
commit 466d00b021
4 changed files with 18 additions and 15 deletions

View File

@ -215,18 +215,21 @@ namespace MediaBrowser.Controller.Providers.TV
if (doc.HasChildNodes)
{
var p = doc.SafeGetString("//filename");
if (p != null)
if (!episode.HasImage(ImageType.Primary))
{
if (!Directory.Exists(episode.MetaLocation)) Directory.CreateDirectory(episode.MetaLocation);
var p = doc.SafeGetString("//filename");
if (p != null)
{
if (!Directory.Exists(episode.MetaLocation)) Directory.CreateDirectory(episode.MetaLocation);
try
{
episode.PrimaryImagePath = await _providerManager.DownloadAndSaveImage(episode, TVUtils.BannerUrl + p, Path.GetFileName(p), ConfigurationManager.Configuration.SaveLocalMeta, RemoteSeriesProvider.Current.TvDbResourcePool, cancellationToken);
}
catch (HttpException)
{
status = ProviderRefreshStatus.CompletedWithErrors;
try
{
episode.PrimaryImagePath = await _providerManager.DownloadAndSaveImage(episode, TVUtils.BannerUrl + p, Path.GetFileName(p), ConfigurationManager.Configuration.SaveLocalMeta, RemoteSeriesProvider.Current.TvDbResourcePool, cancellationToken);
}
catch (HttpException)
{
status = ProviderRefreshStatus.CompletedWithErrors;
}
}
}

View File

@ -214,7 +214,7 @@ namespace MediaBrowser.Controller.Providers.TV
series.AirTime = doc.SafeGetString("//Airs_Time");
string n = doc.SafeGetString("//banner");
if (!string.IsNullOrWhiteSpace(n))
if (!string.IsNullOrWhiteSpace(n) && !series.HasImage(ImageType.Banner))
{
series.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(series, TVUtils.BannerUrl + n, "banner" + Path.GetExtension(n), ConfigurationManager.Configuration.SaveLocalMeta, TvDbResourcePool, cancellationToken).ConfigureAwait(false));
}

View File

@ -1,10 +1,10 @@
using System.IO;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library
{

View File

@ -1,8 +1,8 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
using System;
using System.IO;
using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers
{