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

pull/4/head
Mark McDowall 9 years ago
parent cb43888496
commit f0ca2bc11e

@ -97,5 +97,17 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
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");
}
}
}

@ -684,10 +684,17 @@ namespace NzbDrone.Core.Organizer
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);
}

Loading…
Cancel
Save