Removed un-needed call from Episode Search.

InventoryProvider.IsAcceptableSize will now handle daily series properly.
pull/3113/head
Mark McDowall 13 years ago
parent e01be46209
commit 1b0cdf922e

@ -364,5 +364,28 @@ namespace NzbDrone.Core.Test.ProviderTests
//Assert
result.Should().BeTrue();
}
[Test]
public void IsAcceptableSize_should_treat_daily_series_as_single_episode()
{
parseResultSingle.Series = series60minutes;
parseResultSingle.Size = 300.Megabytes();
parseResultSingle.AirDate = DateTime.Today;
parseResultSingle.EpisodeNumbers = null;
qualityType.MaxSize = (int)600.Megabytes();
Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
Mocker.GetMock<EpisodeProvider>().Setup(
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
.Returns(true);
//Act
bool result = Mocker.Resolve<InventoryProvider>().IsAcceptableSize(parseResultSingle);
//Assert
result.Should().BeTrue();
}
}
}

@ -156,12 +156,13 @@ namespace NzbDrone.Core.Providers
//Multiply maxSize by Series.Runtime
maxSize = maxSize * series.Runtime;
//Multiply maxSize by the number of episodes parsed
maxSize = maxSize * parseResult.EpisodeNumbers.Count;
//Multiply maxSize by the number of episodes parsed (if EpisodeNumbers is null it will be treated as a single episode)
if (parseResult.EpisodeNumbers != null)
maxSize = maxSize * parseResult.EpisodeNumbers.Count;
//Check if there was only one episode parsed
//and it is the first or last episode of the season
if (parseResult.EpisodeNumbers.Count == 1 &&
if (parseResult.EpisodeNumbers != null && parseResult.EpisodeNumbers.Count == 1 &&
_episodeProvider.IsFirstOrLastEpisodeOfSeason(series.SeriesId,
parseResult.SeasonNumber, parseResult.EpisodeNumbers[0]))
{

@ -131,23 +131,21 @@ namespace NzbDrone.Core.Providers
notification.CurrentMessage = "Searching for " + episode;
var series = _seriesProvider.GetSeries(episode.SeriesId);
if (episode.Series.IsDaily && !episode.AirDate.HasValue)
{
Logger.Warn("AirDate is not Valid for: {0}", episode);
return false;
}
var reports = PerformSearch(notification, series, episode.SeasonNumber, new List<Episode> { episode });
var reports = PerformSearch(notification, episode.Series, episode.SeasonNumber, new List<Episode> { episode });
Logger.Debug("Finished searching all indexers. Total {0}", reports.Count);
notification.CurrentMessage = "Processing search results";
if (!series.IsDaily && ProcessSearchResults(notification, reports, series, episode.SeasonNumber, episode.EpisodeNumber).Count == 1)
if (!episode.Series.IsDaily && ProcessSearchResults(notification, reports, episode.Series, episode.SeasonNumber, episode.EpisodeNumber).Count == 1)
return true;
if (series.IsDaily && ProcessSearchResults(notification, reports, series, episode.AirDate.Value))
if (episode.Series.IsDaily && ProcessSearchResults(notification, reports, episode.Series, episode.AirDate.Value))
return true;
Logger.Warn("Unable to find {0} in any of indexers.", episode);

Loading…
Cancel
Save