Revert to standard numbering when scene is absent
This commit is contained in:
parent
728a18f680
commit
d99415bc31
|
@ -206,29 +206,5 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchProviderTests
|
|||
result.Should().BeFalse();
|
||||
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)
|
||||
{
|
||||
Episode episodeInfo;
|
||||
Episode episodeInfo = null;
|
||||
|
||||
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering)
|
||||
episodeInfo = GetEpisodeBySceneNumbering(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber);
|
||||
|
||||
else
|
||||
if (episodeInfo == null)
|
||||
{
|
||||
episodeInfo = GetEpisode(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber);
|
||||
if (episodeInfo == null && parseResult.AirDate != null)
|
||||
|
|
|
@ -161,14 +161,6 @@ namespace NzbDrone.Core.Providers
|
|||
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
|
||||
{
|
||||
SearchTime = DateTime.Now,
|
||||
|
@ -192,13 +184,23 @@ namespace NzbDrone.Core.Providers
|
|||
else if (episode.Series.UseSceneNumbering)
|
||||
{
|
||||
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(
|
||||
notification,
|
||||
reports,
|
||||
searchResult,
|
||||
episode.Series,
|
||||
episode.SceneSeasonNumber,
|
||||
episode.SceneEpisodeNumber
|
||||
seasonNumber,
|
||||
episodeNumber
|
||||
);
|
||||
|
||||
_searchHistoryProvider.Add(searchResult);
|
||||
|
@ -254,8 +256,8 @@ namespace NzbDrone.Core.Providers
|
|||
//Treat as single episode
|
||||
else if (episodes.Count == 1)
|
||||
{
|
||||
//Use SceneNumbering
|
||||
if (series.UseSceneNumbering)
|
||||
//Use SceneNumbering - Only if SceneSN and SceneEN are greater than zero
|
||||
if (series.UseSceneNumbering && episodes.First().SceneSeasonNumber > 0 && episodes.First().SceneEpisodeNumber > 0)
|
||||
reports.AddRange(indexer.FetchEpisode(title, episodes.First().SceneSeasonNumber, episodes.First().SceneEpisodeNumber));
|
||||
|
||||
//Standard
|
||||
|
|
Loading…
Reference in New Issue