Fixed: Mapping episode 0 to the parsed season instead of specials

This commit is contained in:
Mark McDowall 2022-04-29 17:27:35 -07:00
parent 8f2c4fe4d1
commit edf1167a37
2 changed files with 48 additions and 1 deletions

View File

@ -518,5 +518,46 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
Mocker.GetMock<IEpisodeService>()
.Verify(v => v.GetEpisodesBySceneSeason(It.IsAny<int>(), It.IsAny<int>()), Times.Once);
}
[Test]
public void should_use_season_zero_when_looking_up_is_partial_special_episode_found_by_title()
{
_series.UseSceneNumbering = false;
_parsedEpisodeInfo.SeasonNumber = 1;
_parsedEpisodeInfo.EpisodeNumbers = new int[] { 0 };
_parsedEpisodeInfo.ReleaseTitle = "Series.Title.S01E00.My.Special.Episode.1080p.AMZN.WEB-DL.DDP5.1.H264-TEPES";
Mocker.GetMock<IEpisodeService>()
.Setup(s => s.FindEpisodeByTitle(_series.TvdbId, 0, _parsedEpisodeInfo.ReleaseTitle))
.Returns(
Builder<Episode>.CreateNew()
.With(e => e.SeasonNumber = 0)
.With(e => e.EpisodeNumber = 1)
.Build()
);
Subject.Map(_parsedEpisodeInfo, _series.TvdbId, _series.TvRageId);
Mocker.GetMock<IEpisodeService>()
.Verify(v => v.FindEpisode(_series.TvdbId, 0, 1), Times.Once());
}
[Test]
public void should_use_original_parse_result_when_special_episode_lookup_by_title_fails()
{
_series.UseSceneNumbering = false;
_parsedEpisodeInfo.SeasonNumber = 1;
_parsedEpisodeInfo.EpisodeNumbers = new int[] { 0 };
_parsedEpisodeInfo.ReleaseTitle = "Series.Title.S01E00.My.Special.Episode.1080p.AMZN.WEB-DL.DDP5.1.H264-TEPES";
Mocker.GetMock<IEpisodeService>()
.Setup(s => s.FindEpisodeByTitle(_series.TvdbId, 0, _parsedEpisodeInfo.ReleaseTitle))
.Returns((Episode)null);
Subject.Map(_parsedEpisodeInfo, _series.TvdbId, _series.TvRageId);
Mocker.GetMock<IEpisodeService>()
.Verify(v => v.FindEpisode(_series.TvdbId, _parsedEpisodeInfo.SeasonNumber, _parsedEpisodeInfo.EpisodeNumbers.First()), Times.Once());
}
}
}

View File

@ -246,7 +246,13 @@ namespace NzbDrone.Core.Parser
if (parsedEpisodeInfo.IsPossibleSceneSeasonSpecial)
{
parsedEpisodeInfo = ParseSpecialEpisodeTitle(parsedEpisodeInfo, parsedEpisodeInfo.ReleaseTitle, series) ?? parsedEpisodeInfo;
var parsedSpecialEpisodeInfo = ParseSpecialEpisodeTitle(parsedEpisodeInfo, parsedEpisodeInfo.ReleaseTitle, series);
if (parsedSpecialEpisodeInfo != null)
{
// Use the season number and disable scene source since the season/episode numbers that were returned are not scene numbers
return GetStandardEpisodes(series, parsedSpecialEpisodeInfo, parsedSpecialEpisodeInfo.SeasonNumber, false, searchCriteria);
}
}
return GetStandardEpisodes(series, parsedEpisodeInfo, mappedSeasonNumber, sceneSource, searchCriteria);