1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: Don't collapse episode titles when episode titles contain Part x only

This commit is contained in:
Mark McDowall 2016-02-16 21:28:32 -08:00
parent cb43888496
commit f0ca2bc11e
2 changed files with 23 additions and 4 deletions

View File

@ -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)
.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");
}
}
}

View File

@ -684,10 +684,17 @@ private string GetEpisodeTitle(List<Episode> episodes, string separator)
return episodes.First().Title.TrimEnd(EpisodeTitleTrimCharacters);
}
var titles = episodes
.Select(c => c.Title.TrimEnd(EpisodeTitleTrimCharacters))
.Select(CleanupEpisodeTitle)
.Distinct();
var titles = episodes.Select(c => c.Title.TrimEnd(EpisodeTitleTrimCharacters))
.Select(CleanupEpisodeTitle)
.Distinct()
.ToList();
if (titles.All(t => t.IsNullOrWhiteSpace()))
{
titles = episodes.Select(c => c.Title.TrimEnd(EpisodeTitleTrimCharacters))
.Distinct()
.ToList();
}
return string.Join(separator, titles);
}