GetEpisodesByParseResult will log a warning when an episode is daily, but series isn't.

pull/4/head
Mark McDowall 13 years ago
parent 55b9dc2a9b
commit 77bf257132

@ -11,6 +11,7 @@ using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
using PetaPoco;
@ -384,5 +385,28 @@ namespace NzbDrone.Core.Test.ProviderTests
ep.First().ShouldHave().AllPropertiesBut(e => e.Series);
parseResult.EpisodeTitle.Should().Be(fakeEpisode.Title);
}
[Test]
public void GetEpisodeParseResult_should_log_warning_when_series_is_not_dailt_but_parsed_daily()
{
WithRealDb();
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.IsDaily = false)
.Build();
Db.Insert(fakeSeries);
var parseResult = new EpisodeParseResult
{
Series = fakeSeries,
AirDate = DateTime.Today
};
var ep = Mocker.Resolve<EpisodeProvider>().GetEpisodesByParseResult(parseResult);
ep.Should().BeEmpty();
ExceptionVerification.ExcpectedWarns(1);
}
}
}

@ -127,6 +127,13 @@ namespace NzbDrone.Core.Providers
if (parseResult.AirDate.HasValue)
{
if (!parseResult.Series.IsDaily)
{
//Todo: Collect this as a Series we want to treat as a daily series, or possible parsing error
Logger.Warn("Found daily-style episode for non-daily series: {0}", parseResult.Series.Title);
return new List<Episode>();
}
var episodeInfo = GetEpisode(parseResult.Series.SeriesId, parseResult.AirDate.Value);
if (episodeInfo == null && autoAddNew)

Loading…
Cancel
Save