|
|
@ -44,30 +44,31 @@ namespace NzbDrone.Core.MediaCover
|
|
|
|
foreach (var cover in series.Images)
|
|
|
|
foreach (var cover in series.Images)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var fileName = GetCoverPath(series.Id, cover.CoverType);
|
|
|
|
var fileName = GetCoverPath(series.Id, cover.CoverType);
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
if (!_coverExistsSpecification.AlreadyExists(cover.Url, fileName))
|
|
|
|
if (!_coverExistsSpecification.AlreadyExists(cover.Url, fileName))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DownloadCover(series, cover);
|
|
|
|
DownloadCover(series, cover);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (WebException e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Warn(string.Format("Couldn't download media cover for {0}. {1}", series, e.Message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.ErrorException("Couldn't download media cover for " + series, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void DownloadCover(Series series, MediaCover cover)
|
|
|
|
private void DownloadCover(Series series, MediaCover cover)
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var fileName = GetCoverPath(series.Id, cover.CoverType);
|
|
|
|
var fileName = GetCoverPath(series.Id, cover.CoverType);
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Info("Downloading {0} for {1} {2}", cover.CoverType, series, cover.Url);
|
|
|
|
_logger.Info("Downloading {0} for {1} {2}", cover.CoverType, series, cover.Url);
|
|
|
|
_httpProvider.DownloadFile(cover.Url, fileName);
|
|
|
|
_httpProvider.DownloadFile(cover.Url, fileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (WebException e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Warn("Couldn't download media cover for " + series);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.ErrorException("Couldn't download media cover for " + series, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void HandleAsync(SeriesDeletedEvent message)
|
|
|
|
public void HandleAsync(SeriesDeletedEvent message)
|
|
|
|