Revert to standard numbering when scene is absent

pull/2/head
Mark McDowall 12 years ago
parent 728a18f680
commit d99415bc31

@ -206,29 +206,5 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchProviderTests
result.Should().BeFalse(); result.Should().BeFalse();
ExceptionVerification.ExpectedWarns(1); ExceptionVerification.ExpectedWarns(1);
} }
[Test]
public void EpisodeSearch_should_skip_if_sceneNumbering_is_invalid_and_should_use_sceneNumbering()
{
//Setup
_series.UseSceneNumbering = true;
var episode = _episodes.First();
episode.SceneSeasonNumber = 0;
episode.SceneEpisodeNumber = 0;
episode.Series = _series;
Mocker.GetMock<UpgradePossibleSpecification>().Setup(s => s.IsSatisfiedBy(It.IsAny<Episode>()))
.Returns(true);
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisode(episode.EpisodeId))
.Returns(episode);
//Act
var result = Mocker.Resolve<SearchProvider>().EpisodeSearch(MockNotification, episode.EpisodeId);
//Assert
result.Should().BeFalse();
ExceptionVerification.ExpectedWarns(1);
}
} }
} }

@ -188,12 +188,12 @@ namespace NzbDrone.Core.Providers
foreach (var episodeNumber in parseResult.EpisodeNumbers) foreach (var episodeNumber in parseResult.EpisodeNumbers)
{ {
Episode episodeInfo; Episode episodeInfo = null;
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering) if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering)
episodeInfo = GetEpisodeBySceneNumbering(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber); episodeInfo = GetEpisodeBySceneNumbering(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber);
else if (episodeInfo == null)
{ {
episodeInfo = GetEpisode(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber); episodeInfo = GetEpisode(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber);
if (episodeInfo == null && parseResult.AirDate != null) if (episodeInfo == null && parseResult.AirDate != null)

@ -161,14 +161,6 @@ namespace NzbDrone.Core.Providers
return false; return false;
} }
if (episode.Series.UseSceneNumbering && episode.SceneSeasonNumber <= 0 && episode.SceneEpisodeNumber <= 0)
{
_logger.Warn("Series should use Scene Numbering, but it is not available: {0}", episode);
notification.CurrentMessage = String.Format("Search Failed, invalid scene episode data found: {0}", episode);
return false;
}
var searchResult = new SearchHistory var searchResult = new SearchHistory
{ {
SearchTime = DateTime.Now, SearchTime = DateTime.Now,
@ -192,13 +184,23 @@ namespace NzbDrone.Core.Providers
else if (episode.Series.UseSceneNumbering) else if (episode.Series.UseSceneNumbering)
{ {
searchResult.EpisodeId = episodeId; searchResult.EpisodeId = episodeId;
var seasonNumber = episode.SceneSeasonNumber;
var episodeNumber = episode.SceneEpisodeNumber;
if (seasonNumber == 0 || episodeNumber == 0)
{
seasonNumber = episode.SeasonNumber;
episodeNumber = episode.EpisodeNumber;
}
searchResult.SearchHistoryItems = ProcessSearchResults( searchResult.SearchHistoryItems = ProcessSearchResults(
notification, notification,
reports, reports,
searchResult, searchResult,
episode.Series, episode.Series,
episode.SceneSeasonNumber, seasonNumber,
episode.SceneEpisodeNumber episodeNumber
); );
_searchHistoryProvider.Add(searchResult); _searchHistoryProvider.Add(searchResult);
@ -254,8 +256,8 @@ namespace NzbDrone.Core.Providers
//Treat as single episode //Treat as single episode
else if (episodes.Count == 1) else if (episodes.Count == 1)
{ {
//Use SceneNumbering //Use SceneNumbering - Only if SceneSN and SceneEN are greater than zero
if (series.UseSceneNumbering) if (series.UseSceneNumbering && episodes.First().SceneSeasonNumber > 0 && episodes.First().SceneEpisodeNumber > 0)
reports.AddRange(indexer.FetchEpisode(title, episodes.First().SceneSeasonNumber, episodes.First().SceneEpisodeNumber)); reports.AddRange(indexer.FetchEpisode(title, episodes.First().SceneSeasonNumber, episodes.First().SceneEpisodeNumber));
//Standard //Standard

Loading…
Cancel
Save