mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Multiple Scene Mapping exception even when the mappings pointed to the same tvdbid.
Closes #1917
This commit is contained in:
parent
95c81f8905
commit
c184e7ddcc
@ -346,6 +346,20 @@ public void should_throw_if_multiple_mappings()
|
||||
Assert.Throws<InvalidSceneMappingException>(() => Subject.FindTvdbId("Amareto", "Amareto.S01E01.720p.WEB-DL-Viva"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_throw_if_multiple_mappings_with_same_tvdbid()
|
||||
{
|
||||
var mappings = new List<SceneMapping>
|
||||
{
|
||||
new SceneMapping { Title = "Amareto", ParseTerm = "amareto", SearchTerm = "Amareto", TvdbId = 100 },
|
||||
new SceneMapping { Title = "Amareto", ParseTerm = "amareto", SearchTerm = "Amareto", TvdbId = 100 }
|
||||
};
|
||||
|
||||
Mocker.GetMock<ISceneMappingRepository>().Setup(c => c.All()).Returns(mappings);
|
||||
|
||||
Subject.FindTvdbId("Amareto", "Amareto.S01E01.720p.WEB-DL-Viva").Should().Be(100);
|
||||
}
|
||||
|
||||
private void AssertNoUpdate()
|
||||
{
|
||||
_provider1.Verify(c => c.GetSceneMappings(), Times.Once());
|
||||
|
@ -102,9 +102,11 @@ public SceneMapping FindSceneMapping(string seriesTitle, string releaseTitle)
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mappings.Count <= 1)
|
||||
var distinctMappings = mappings.DistinctBy(v => v.TvdbId).ToList();
|
||||
|
||||
if (distinctMappings.Count <= 1)
|
||||
{
|
||||
return mappings.FirstOrDefault();
|
||||
return distinctMappings.FirstOrDefault();
|
||||
}
|
||||
|
||||
throw new InvalidSceneMappingException(mappings);
|
||||
|
Loading…
Reference in New Issue
Block a user