Fixed: Original Filename/Title not being included when importing a new file
Closes #5010
This commit is contained in:
parent
704cf7aebe
commit
d01e6d32de
|
@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.With(e => e.AbsoluteEpisodeNumber = 100)
|
.With(e => e.AbsoluteEpisodeNumber = 100)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "SonarrTest" };
|
_episodeFile = new EpisodeFile { Id = 5, Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "SonarrTest" };
|
||||||
|
|
||||||
_namingConfig = NamingConfig.Default;
|
_namingConfig = NamingConfig.Default;
|
||||||
_namingConfig.RenameEpisodes = true;
|
_namingConfig.RenameEpisodes = true;
|
||||||
|
@ -47,16 +47,6 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.Returns<Quality>(v => Quality.DefaultQualityDefinitions.First(c => c.Quality == v));
|
.Returns<Quality>(v => Quality.DefaultQualityDefinitions.First(c => c.Quality == v));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_not_recursively_include_current_filename()
|
|
||||||
{
|
|
||||||
_episodeFile.RelativePath = "My Series - S15E06 - City Sushi";
|
|
||||||
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title} {[Original Title]}";
|
|
||||||
|
|
||||||
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
|
||||||
.Should().Be("My Series - S15E06 - City Sushi");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_include_original_title_if_not_current_file_name()
|
public void should_include_original_title_if_not_current_file_name()
|
||||||
{
|
{
|
||||||
|
@ -145,5 +135,42 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||||
.Should().Be("My Series - 123");
|
.Should().Be("My Series - 123");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_include_current_filename_for_new_file_if_including_season_and_episode_tokens_for_standard_series()
|
||||||
|
{
|
||||||
|
_episodeFile.Id = 0;
|
||||||
|
_episodeFile.RelativePath = "My Series - S15E06 - City Sushi";
|
||||||
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} {[Original Title]}";
|
||||||
|
|
||||||
|
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||||
|
.Should().Be("My Series - S15E06 [My Series - S15E06 - City Sushi]");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_include_current_filename_for_new_file_if_including_air_date_token_for_daily_series()
|
||||||
|
{
|
||||||
|
_series.SeriesType = SeriesTypes.Daily;
|
||||||
|
_episode.AirDate = "2022-04-28";
|
||||||
|
_episodeFile.Id = 0;
|
||||||
|
_episodeFile.RelativePath = "My Series - 2022-04-28 - City Sushi";
|
||||||
|
_namingConfig.DailyEpisodeFormat = "{Series Title} - {Air-Date} {[Original Title]}";
|
||||||
|
|
||||||
|
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||||
|
.Should().Be("My Series - 2022-04-28 [My Series - 2022-04-28 - City Sushi]");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_include_current_filename_for_new_file_if_including_absolute_episode_number_token_for_anime_series()
|
||||||
|
{
|
||||||
|
_series.SeriesType = SeriesTypes.Anime;
|
||||||
|
_episode.AbsoluteEpisodeNumber = 123;
|
||||||
|
_episodeFile.Id = 0;
|
||||||
|
_episodeFile.RelativePath = "My Series - 123 - City Sushi";
|
||||||
|
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:00} {[Original Title]}";
|
||||||
|
|
||||||
|
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||||
|
.Should().Be("My Series - 123 [My Series - 123 - City Sushi]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
AddIdTokens(tokenHandlers, series);
|
AddIdTokens(tokenHandlers, series);
|
||||||
AddEpisodeTokens(tokenHandlers, episodes);
|
AddEpisodeTokens(tokenHandlers, episodes);
|
||||||
AddEpisodeTitlePlaceholderTokens(tokenHandlers);
|
AddEpisodeTitlePlaceholderTokens(tokenHandlers);
|
||||||
AddEpisodeFileTokens(tokenHandlers, episodeFile, !patternHasEpisodeIdentifier);
|
AddEpisodeFileTokens(tokenHandlers, episodeFile, !patternHasEpisodeIdentifier || episodeFile.Id == 0);
|
||||||
AddQualityTokens(tokenHandlers, series, episodeFile);
|
AddQualityTokens(tokenHandlers, series, episodeFile);
|
||||||
AddMediaInfoTokens(tokenHandlers, episodeFile);
|
AddMediaInfoTokens(tokenHandlers, episodeFile);
|
||||||
AddPreferredWords(tokenHandlers, series, episodeFile, preferredWords);
|
AddPreferredWords(tokenHandlers, series, episodeFile, preferredWords);
|
||||||
|
|
Loading…
Reference in New Issue