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 NUnit.Framework;
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 @@ namespace NzbDrone.Core.Test.MediaCoverTests
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 @@ namespace NzbDrone.Core.MediaCover
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 @@ namespace NzbDrone.Core.MediaCover
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 @@ namespace NzbDrone.Core.MediaCover
{
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.Common.Messaging;
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 @@ namespace NzbDrone.Core.Tv
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)