1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01: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.Common;
using NzbDrone.Core.MediaCover; using NzbDrone.Core.MediaCover;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.MediaCoverTests 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() public void should_return_true_if_there_is_no_size_header_and_file_exist()
{ {
GivenExistingFileSize(100); 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 NLog;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Common.Serializer;
namespace NzbDrone.Core.MediaCover namespace NzbDrone.Core.MediaCover
{ {
@ -32,7 +33,7 @@ public bool AlreadyExists(string url, string path)
string sizeString; string sizeString;
if (headers.TryGetValue(headers[HttpProvider.ContentLenghtHeader], out sizeString)) if (headers.TryGetValue(HttpProvider.ContentLenghtHeader, out sizeString))
{ {
int size; int size;
int.TryParse(sizeString, out size); int.TryParse(sizeString, out size);
@ -41,7 +42,7 @@ public bool AlreadyExists(string url, string path)
return fileSize == size; 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; return false;
} }

View File

@ -53,7 +53,7 @@ private void DownloadCover(Series series, MediaCover cover)
{ {
var fileName = GetCoverPath(series.Id, cover.CoverType); 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); _httpProvider.DownloadFile(cover.Url, fileName);
} }
catch (Exception e) catch (Exception e)

View File

@ -6,6 +6,7 @@
using NzbDrone.Core.MetadataSource; using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Tv.Commands; using NzbDrone.Core.Tv.Commands;
using NzbDrone.Core.Tv.Events; using NzbDrone.Core.Tv.Events;
using NzbDrone.Common;
namespace NzbDrone.Core.Tv namespace NzbDrone.Core.Tv
{ {
@ -43,10 +44,16 @@ public void Execute(RefreshSeriesCommand message)
foreach (var series in allSeries) 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) public void HandleAsync(SeriesAddedEvent message)