New: Use XEM season number for some releases when mapping episodes

Closes #5195
This commit is contained in:
Mark McDowall 2022-12-30 16:42:11 -08:00
parent 6ec7c3f7a9
commit 2fc76a9ac5
2 changed files with 47 additions and 0 deletions

View File

@ -220,5 +220,45 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
Mocker.GetMock<ISeriesService>()
.Verify(v => v.FindByTitle(It.IsAny<string>()), Times.Never());
}
[Test]
public void should_use_scene_season_number_from_xem_mapping_if_alias_matches_a_specific_season_number()
{
_parsedEpisodeInfo.SeasonNumber = 1;
var sceneMapping = new SceneMapping
{
Type = "XemService",
SceneSeasonNumber = 2
};
Mocker.GetMock<ISceneMappingService>()
.Setup(s => s.FindSceneMapping(_parsedEpisodeInfo.SeriesTitle, _parsedEpisodeInfo.ReleaseTitle, _parsedEpisodeInfo.SeasonNumber))
.Returns(sceneMapping);
var result = Subject.Map(_parsedEpisodeInfo, _series);
result.MappedSeasonNumber.Should().Be(sceneMapping.SceneSeasonNumber);
}
[Test]
public void should_not_use_scene_season_number_from_xem_mapping_if_alias_matches_a_specific_season_number_but_did_not_parse_season_1()
{
_parsedEpisodeInfo.SeasonNumber = 2;
var sceneMapping = new SceneMapping
{
Type = "XemService",
SceneSeasonNumber = 2
};
Mocker.GetMock<ISceneMappingService>()
.Setup(s => s.FindSceneMapping(_parsedEpisodeInfo.SeriesTitle, _parsedEpisodeInfo.ReleaseTitle, _parsedEpisodeInfo.SeasonNumber))
.Returns(sceneMapping);
var result = Subject.Map(_parsedEpisodeInfo, _series);
result.MappedSeasonNumber.Should().Be(sceneMapping.SceneSeasonNumber);
}
}
}

View File

@ -163,6 +163,13 @@ namespace NzbDrone.Core.Parser
{
sceneSource = false;
}
else if (sceneMapping.Type == "XemService" &&
sceneMapping.SceneSeasonNumber.HasValue &&
parsedEpisodeInfo.SeasonNumber == 1 &&
sceneMapping.SceneSeasonNumber != parsedEpisodeInfo.SeasonNumber)
{
remoteEpisode.MappedSeasonNumber = sceneMapping.SceneSeasonNumber.Value;
}
}
if (series == null)