1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 01:57:21 +00:00

fixed media cover download issue

This commit is contained in:
kay.one 2013-06-02 22:51:16 -07:00
parent e708a17c6a
commit 233def11c7
4 changed files with 17 additions and 6 deletions

View file

@ -5,6 +5,7 @@
using NzbDrone.Common;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.MediaCoverTests
{
@ -66,7 +67,9 @@ public void should_return_ture_if_file_exists_and_same_size()
public void should_return_true_if_there_is_no_size_header_and_file_exist()
{
GivenExistingFileSize(100);
Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeTrue();
Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeFalse();
ExceptionVerification.ExpectedWarns(1);
}
}
}

View file

@ -1,5 +1,6 @@
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Serializer;
namespace NzbDrone.Core.MediaCover
{
@ -32,7 +33,7 @@ public bool AlreadyExists(string url, string path)
string sizeString;
if (headers.TryGetValue(headers[HttpProvider.ContentLenghtHeader], out sizeString))
if (headers.TryGetValue(HttpProvider.ContentLenghtHeader, out sizeString))
{
int size;
int.TryParse(sizeString, out size);
@ -41,7 +42,7 @@ public bool AlreadyExists(string url, string path)
return fileSize == size;
}
_logger.Warn("Couldn't read content length header {0}", headers[HttpProvider.ContentLenghtHeader]);
_logger.Warn("Couldn't find content-length header {0}", headers.ToJson());
return false;
}

View file

@ -53,7 +53,7 @@ private void DownloadCover(Series series, MediaCover cover)
{
var fileName = GetCoverPath(series.Id, cover.CoverType);
_logger.Info("Downloading {0} for {1}", cover.CoverType, series.Title);
_logger.Info("Downloading {0} for {1} {2}", cover.CoverType, series.Title, cover.Url);
_httpProvider.DownloadFile(cover.Url, fileName);
}
catch (Exception e)

View file

@ -6,6 +6,7 @@
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Tv.Commands;
using NzbDrone.Core.Tv.Events;
using NzbDrone.Common;
namespace NzbDrone.Core.Tv
{
@ -43,10 +44,16 @@ public void Execute(RefreshSeriesCommand message)
foreach (var series in allSeries)
{
RefreshSeriesInfo(series);
try
{
RefreshSeriesInfo(series);
}
catch (Exception e)
{
_logger.ErrorException("Couldn't refresh info for {0}".Inject(series.Title), e);
}
}
}
}
public void HandleAsync(SeriesAddedEvent message)