mirror of
https://github.com/Radarr/Radarr
synced 2025-01-03 22:04:43 +00:00
Fixed: Don't collapse episode titles when episode titles contain Part x only
This commit is contained in:
parent
cb43888496
commit
f0ca2bc11e
2 changed files with 23 additions and 4 deletions
|
@ -97,5 +97,17 @@ public void should_not_collapse_episode_titles_when_episode_titles_are_not_the_s
|
||||||
Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
|
Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
|
||||||
.Should().Be("South Park - S15E06-E07 - Hello + World");
|
.Should().Be("South Park - S15E06-E07 - Hello + World");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_not_collaspe_when_result_is_empty()
|
||||||
|
{
|
||||||
|
_namingConfig.StandardEpisodeFormat = "{Episode Title}";
|
||||||
|
|
||||||
|
_episode1.Title = "Part 1";
|
||||||
|
_episode2.Title = "Part 2";
|
||||||
|
|
||||||
|
Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
|
||||||
|
.Should().Be("Part 1 + Part 2");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -684,10 +684,17 @@ private string GetEpisodeTitle(List<Episode> episodes, string separator)
|
||||||
return episodes.First().Title.TrimEnd(EpisodeTitleTrimCharacters);
|
return episodes.First().Title.TrimEnd(EpisodeTitleTrimCharacters);
|
||||||
}
|
}
|
||||||
|
|
||||||
var titles = episodes
|
var titles = episodes.Select(c => c.Title.TrimEnd(EpisodeTitleTrimCharacters))
|
||||||
.Select(c => c.Title.TrimEnd(EpisodeTitleTrimCharacters))
|
.Select(CleanupEpisodeTitle)
|
||||||
.Select(CleanupEpisodeTitle)
|
.Distinct()
|
||||||
.Distinct();
|
.ToList();
|
||||||
|
|
||||||
|
if (titles.All(t => t.IsNullOrWhiteSpace()))
|
||||||
|
{
|
||||||
|
titles = episodes.Select(c => c.Title.TrimEnd(EpisodeTitleTrimCharacters))
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
return string.Join(separator, titles);
|
return string.Join(separator, titles);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue