|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
@ -8,7 +8,7 @@ using NzbDrone.Core.MediaFiles;
|
|
|
|
|
using NzbDrone.Core.Organizer;
|
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
using NzbDrone.Core.Music;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|
|
|
|
{
|
|
|
|
@ -16,35 +16,39 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|
|
|
|
|
|
|
|
|
public class FileNameBuilderFixture : CoreTest<FileNameBuilder>
|
|
|
|
|
{
|
|
|
|
|
private Series _series;
|
|
|
|
|
private Episode _episode1;
|
|
|
|
|
private EpisodeFile _episodeFile;
|
|
|
|
|
private Artist _artist;
|
|
|
|
|
private Album _album;
|
|
|
|
|
private Track _track1;
|
|
|
|
|
private TrackFile _trackFile;
|
|
|
|
|
private NamingConfig _namingConfig;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void Setup()
|
|
|
|
|
{
|
|
|
|
|
_series = Builder<Series>
|
|
|
|
|
_artist = Builder<Artist>
|
|
|
|
|
.CreateNew()
|
|
|
|
|
.With(s => s.Title = "South Park")
|
|
|
|
|
.With(s => s.Name = "Linkin Park")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
_album = Builder<Album>
|
|
|
|
|
.CreateNew()
|
|
|
|
|
.With(s => s.Title = "Hybrid Theory")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_namingConfig = NamingConfig.Default;
|
|
|
|
|
_namingConfig.RenameEpisodes = true;
|
|
|
|
|
_namingConfig.RenameTracks = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<INamingConfigService>()
|
|
|
|
|
.Setup(c => c.GetConfig()).Returns(_namingConfig);
|
|
|
|
|
|
|
|
|
|
_episode1 = Builder<Episode>.CreateNew()
|
|
|
|
|
_track1 = Builder<Track>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.With(e => e.AbsoluteEpisodeNumber = 100)
|
|
|
|
|
.With(e => e.TrackNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.MP3_256), ReleaseGroup = "LidarrTest" };
|
|
|
|
|
_trackFile = new TrackFile { Quality = new QualityModel(Quality.MP3_256), ReleaseGroup = "LidarrTest" };
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IQualityDefinitionService>()
|
|
|
|
|
.Setup(v => v.Get(Moq.It.IsAny<Quality>()))
|
|
|
|
@ -53,592 +57,413 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|
|
|
|
|
|
|
|
|
private void GivenProper()
|
|
|
|
|
{
|
|
|
|
|
_episodeFile.Quality.Revision.Version = 2;
|
|
|
|
|
_trackFile.Quality.Revision.Version = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GivenReal()
|
|
|
|
|
{
|
|
|
|
|
_episodeFile.Quality.Revision.Real = 1;
|
|
|
|
|
_trackFile.Quality.Revision.Real = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_Series_space_Title()
|
|
|
|
|
public void should_replace_Artist_space_Name()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist Name}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> {_track1}, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin Park");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_Series_underscore_Title()
|
|
|
|
|
public void should_replace_Artist_underscore_Name()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series_Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist_Name}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South_Park");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> {_track1}, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin_Park");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_Series_dot_Title()
|
|
|
|
|
public void should_replace_Artist_dot_Name()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.Name}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> {_track1}, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin.Park");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_Series_dash_Title()
|
|
|
|
|
public void should_replace_Artist_dash_Name()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series-Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist-Name}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South-Park");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> {_track1}, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin-Park");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_SERIES_TITLE_with_all_caps()
|
|
|
|
|
public void should_replace_ARTIST_NAME_with_all_caps()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{SERIES TITLE}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{ARTIST NAME}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
.Should().Be("SOUTH PARK");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> {_track1}, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("LINKIN PARK");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_SERIES_TITLE_with_random_casing_should_keep_original_casing()
|
|
|
|
|
public void should_replace_ARTIST_NAME_with_random_casing_should_keep_original_casing()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{sErIES-tItLE}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{aRtIST-nAmE}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be(_series.Title.Replace(' ', '-'));
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(_artist.Name.Replace(' ', '-'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_series_title_with_all_lower_case()
|
|
|
|
|
public void should_replace_artist_name_with_all_lower_case()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{series title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{artist name}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
.Should().Be("south park");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> {_track1}, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("linkin park");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_cleanup_Series_Title()
|
|
|
|
|
public void should_cleanup_Artist_Name()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.CleanTitle}";
|
|
|
|
|
_series.Title = "South Park (1997)";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.CleanName}";
|
|
|
|
|
_artist.Name = "Linkin Park (1997)";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.1997");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin.Park.1997");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_episode_title()
|
|
|
|
|
public void should_replace_Album_space_Title()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Episode Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Album Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
.Should().Be("City Sushi");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Hybrid Theory");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_episode_title_if_pattern_has_random_casing()
|
|
|
|
|
public void should_replace_Album_underscore_Title()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{ePisOde-TitLe}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Album_Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("City-Sushi");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Hybrid_Theory");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_season_number_with_single_digit()
|
|
|
|
|
public void should_replace_Album_dot_Title()
|
|
|
|
|
{
|
|
|
|
|
_episode1.SeasonNumber = 1;
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{season}x{episode}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Album.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("1x6");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Hybrid.Theory");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_season00_number_with_two_digits()
|
|
|
|
|
public void should_replace_Album_dash_Title()
|
|
|
|
|
{
|
|
|
|
|
_episode1.SeasonNumber = 1;
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{season:00}x{episode}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Album-Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("01x6");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Hybrid-Theory");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_episode_number_with_single_digit()
|
|
|
|
|
public void should_replace_ALBUM_TITLE_with_all_caps()
|
|
|
|
|
{
|
|
|
|
|
_episode1.SeasonNumber = 1;
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{season}x{episode}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{ALBUM TITLE}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("1x6");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("HYBRID THEORY");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_episode00_number_with_two_digits()
|
|
|
|
|
public void should_replace_ALBUM_TITLE_with_random_casing_should_keep_original_casing()
|
|
|
|
|
{
|
|
|
|
|
_episode1.SeasonNumber = 1;
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{season}x{episode:00}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{aLbUM-tItLE}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("1x06");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(_album.Title.Replace(' ', '-'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_quality_title()
|
|
|
|
|
public void should_replace_album_title_with_all_lower_case()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Quality Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{album title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("HDTV-720p");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("hybrid theory");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_quality_proper_with_proper()
|
|
|
|
|
public void should_cleanup_Album_Title()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Quality Proper}";
|
|
|
|
|
GivenProper();
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.CleanName}";
|
|
|
|
|
_artist.Name = "Hybrid Theory (2000)";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("Proper");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Hybrid.Theory.2000");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_quality_real_with_real()
|
|
|
|
|
public void should_replace_track_title()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Quality Real}";
|
|
|
|
|
GivenReal();
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Track Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("REAL");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> {_track1}, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("City Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_all_contents_in_pattern()
|
|
|
|
|
public void should_replace_track_title_if_pattern_has_random_casing()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title} [{Quality Title}]";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{tRaCK-TitLe}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("City-Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void use_file_name_when_sceneName_is_null()
|
|
|
|
|
public void should_replace_track_number_with_single_digit()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.RenameEpisodes = false;
|
|
|
|
|
_episodeFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
_track1.TrackNumber = 1;
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{track}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be(Path.GetFileNameWithoutExtension(_episodeFile.RelativePath));
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void use_path_when_sceneName_and_relative_path_are_null()
|
|
|
|
|
public void should_replace_track00_number_with_two_digits()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.RenameEpisodes = false;
|
|
|
|
|
_episodeFile.RelativePath = null;
|
|
|
|
|
_episodeFile.Path = @"C:\Test\Unsorted\Series - S01E01 - Test";
|
|
|
|
|
_track1.TrackNumber = 1;
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{track:00}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be(Path.GetFileNameWithoutExtension(_episodeFile.Path));
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("01");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void use_file_name_when_sceneName_is_not_null()
|
|
|
|
|
public void should_replace_quality_title()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.RenameEpisodes = false;
|
|
|
|
|
_episodeFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
|
_episodeFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Quality Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("30.Rock.S01E01.xvid-LOL");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("MP3-256");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_use_airDate_if_series_isDaily()
|
|
|
|
|
public void should_replace_all_contents_in_pattern()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.DailyEpisodeFormat = "{Series Title} - {air-date} - {Episode Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist Name} - {Album Title} - {track:00} - {Track Title} [{Quality Title}]";
|
|
|
|
|
|
|
|
|
|
_series.Title = "The Daily Show with Jon Stewart";
|
|
|
|
|
_series.SeriesType = SeriesTypes.Daily;
|
|
|
|
|
|
|
|
|
|
_episode1.AirDate = "2012-12-13";
|
|
|
|
|
_episode1.Title = "Kristen Stewart";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> {_track1}, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin Park - Hybrid Theory - 06 - City Sushi [MP3-256]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_set_airdate_to_unknown_if_not_available()
|
|
|
|
|
public void use_file_name_when_sceneName_is_null()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title}";
|
|
|
|
|
|
|
|
|
|
_series.Title = "The Daily Show with Jon Stewart";
|
|
|
|
|
_series.SeriesType = SeriesTypes.Daily;
|
|
|
|
|
_namingConfig.RenameTracks = false;
|
|
|
|
|
_trackFile.RelativePath = "Linkin Park - 06 - Test";
|
|
|
|
|
|
|
|
|
|
_episode1.AirDate = null;
|
|
|
|
|
_episode1.Title = "Kristen Stewart";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(Path.GetFileNameWithoutExtension(_trackFile.RelativePath));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_clean_episode_title_if_there_is_only_one()
|
|
|
|
|
public void use_path_when_sceneName_and_relative_path_are_null()
|
|
|
|
|
{
|
|
|
|
|
var title = "City Sushi (1)";
|
|
|
|
|
_episode1.Title = title;
|
|
|
|
|
_namingConfig.RenameTracks = false;
|
|
|
|
|
_trackFile.RelativePath = null;
|
|
|
|
|
_trackFile.Path = @"C:\Test\Unsorted\Artist - 01 - Test";
|
|
|
|
|
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Episode Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be(title);
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(Path.GetFileNameWithoutExtension(_trackFile.Path));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_should_replace_release_group()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Release Group}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be(_episodeFile.ReleaseGroup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_be_able_to_use_original_title()
|
|
|
|
|
public void should_not_clean_track_title_if_there_is_only_one()
|
|
|
|
|
{
|
|
|
|
|
_series.Title = "30 Rock";
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - {Original Title}";
|
|
|
|
|
var title = "City Sushi (1)";
|
|
|
|
|
_track1.Title = title;
|
|
|
|
|
|
|
|
|
|
_episodeFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
|
_episodeFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Track Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("30 Rock - 30.Rock.S01E01.xvid-LOL");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_trim_periods_from_end_of_episode_title()
|
|
|
|
|
public void should_should_replace_release_group()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
|
|
|
|
|
_namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Part 1.")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Release Group}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { episode }, new Series { Title = "30 Rock" }, _episodeFile)
|
|
|
|
|
.Should().Be("30 Rock - S06E06 - Part 1");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(_trackFile.ReleaseGroup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_trim_question_marks_from_end_of_episode_title()
|
|
|
|
|
public void should_be_able_to_use_original_title()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
|
|
|
|
|
_namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Part 1?")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
_artist.Name = "Linkin Park";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist Name} - {Original Title} - {Track Title}";
|
|
|
|
|
|
|
|
|
|
_trackFile.SceneName = "Linkin.Park.Meteora.320-LOL";
|
|
|
|
|
_trackFile.RelativePath = "30 Rock - 01 - Test";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { episode }, new Series { Title = "30 Rock" }, _episodeFile)
|
|
|
|
|
.Should().Be("30 Rock - S06E06 - Part 1");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin Park - Linkin.Park.Meteora.320-LOL - City Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_double_period_with_single_period()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}.{Episode.Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.Name}.{track:00}.{Track.Title}";
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
var track = Builder<Track>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Part 1")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.With(e => e.TrackNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { episode }, new Series { Title = "Chicago P.D." }, _episodeFile)
|
|
|
|
|
.Should().Be("Chicago.P.D.S06E06.Part.1");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { track }, new Artist { Name = "In The Woods." }, new Album { Title = "30 Rock" }, _trackFile)
|
|
|
|
|
.Should().Be("In.The.Woods.06.Part.1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_triple_period_with_single_period()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}.{Episode.Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.Name}.{track:00}.{Track.Title}";
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
var track = Builder<Track>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Part 1")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.With(e => e.TrackNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { episode }, new Series { Title = "Chicago P.D.." }, _episodeFile)
|
|
|
|
|
.Should().Be("Chicago.P.D.S06E06.Part.1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_replace_absolute_numbering_when_series_is_not_anime()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}.{absolute:00}.{Episode.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.S15E06.City.Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_standard_and_absolute_numbering_when_series_is_anime()
|
|
|
|
|
{
|
|
|
|
|
_series.SeriesType = SeriesTypes.Anime;
|
|
|
|
|
_namingConfig.AnimeEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}.{absolute:00}.{Episode.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.S15E06.100.City.Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_standard_numbering_when_series_is_anime()
|
|
|
|
|
{
|
|
|
|
|
_series.SeriesType = SeriesTypes.Anime;
|
|
|
|
|
_namingConfig.AnimeEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}.{Episode.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.S15E06.City.Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_absolute_numbering_when_series_is_anime()
|
|
|
|
|
{
|
|
|
|
|
_series.SeriesType = SeriesTypes.Anime;
|
|
|
|
|
_namingConfig.AnimeEpisodeFormat = "{Series.Title}.{absolute:00}.{Episode.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.100.City.Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_duplicate_numbering_individually()
|
|
|
|
|
{
|
|
|
|
|
_series.SeriesType = SeriesTypes.Anime;
|
|
|
|
|
_namingConfig.AnimeEpisodeFormat = "{Series.Title}.{season}x{episode:00}.{absolute:000}\\{Series.Title}.S{season:00}E{episode:00}.{absolute:00}.{Episode.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.15x06.100\\South.Park.S15E06.100.City.Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_individual_season_episode_tokens()
|
|
|
|
|
{
|
|
|
|
|
_series.SeriesType = SeriesTypes.Anime;
|
|
|
|
|
_namingConfig.AnimeEpisodeFormat = "{Series Title} Season {season:0000} Episode {episode:0000}\\{Series.Title}.S{season:00}E{episode:00}.{absolute:00}.{Episode.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park Season 0015 Episode 0006\\South.Park.S15E06.100.City.Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_use_standard_naming_when_anime_episode_has_no_absolute_number()
|
|
|
|
|
{
|
|
|
|
|
_series.SeriesType = SeriesTypes.Anime;
|
|
|
|
|
_episode1.AbsoluteEpisodeNumber = null;
|
|
|
|
|
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - {season:0}x{episode:00} - {Episode Title}";
|
|
|
|
|
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1, }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park - 15x06 - City Sushi");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { track }, new Artist { Name = "In The Woods..." }, new Album { Title = "30 Rock" }, _trackFile)
|
|
|
|
|
.Should().Be("In.The.Woods.06.Part.1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_include_affixes_if_value_not_empty()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}{_Episode.Title_}{Quality.Title}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.Name}.{track:00}{_Track.Title_}{Quality.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.S15E06_City.Sushi_HDTV-720p");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin.Park.06_City.Sushi_MP3-256");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_include_affixes_if_value_empty()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}{_Episode.Title_}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.Name}.{track:00}{_Track.Title_}";
|
|
|
|
|
|
|
|
|
|
_episode1.Title = "";
|
|
|
|
|
_track1.Title = "";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.S15E06");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin.Park.06");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_format_mediainfo_properly()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}.{Episode.Title}.{MEDIAINFO.FULL}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.Name}.{track:00}.{Track.Title}.{MEDIAINFO.FULL}";
|
|
|
|
|
|
|
|
|
|
_episodeFile.MediaInfo = new Core.MediaFiles.MediaInfo.MediaInfoModel()
|
|
|
|
|
_trackFile.MediaInfo = new Core.MediaFiles.MediaInfo.MediaInfoModel()
|
|
|
|
|
{
|
|
|
|
|
VideoCodec = "AVC",
|
|
|
|
|
AudioFormat = "DTS",
|
|
|
|
|
AudioFormat = "FLAC",
|
|
|
|
|
AudioLanguages = "English/Spanish",
|
|
|
|
|
Subtitles = "English/Spanish/Italian"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.S15E06.City.Sushi.X264.DTS[EN+ES].[EN+ES+IT]");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin.Park.06.City.Sushi.FLAC[EN+ES].[EN+ES+IT]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_exclude_english_in_mediainfo_audio_language()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.S{season:00}E{episode:00}.{Episode.Title}.{MEDIAINFO.FULL}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.Name}.{track:00}.{Track.Title}.{MEDIAINFO.FULL}";
|
|
|
|
|
|
|
|
|
|
_episodeFile.MediaInfo = new Core.MediaFiles.MediaInfo.MediaInfoModel()
|
|
|
|
|
_trackFile.MediaInfo = new Core.MediaFiles.MediaInfo.MediaInfoModel
|
|
|
|
|
{
|
|
|
|
|
VideoCodec = "AVC",
|
|
|
|
|
AudioFormat = "DTS",
|
|
|
|
|
AudioFormat = "FLAC",
|
|
|
|
|
AudioLanguages = "English",
|
|
|
|
|
Subtitles = "English/Spanish/Italian"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.S15E06.City.Sushi.X264.DTS.[EN+ES+IT]");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin.Park.06.City.Sushi.FLAC.[EN+ES+IT]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_remove_duplicate_non_word_characters()
|
|
|
|
|
{
|
|
|
|
|
_series.Title = "Venture Bros.";
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.{season}x{episode:00}";
|
|
|
|
|
_artist.Name = "Venture Bros.";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist.Name}.{Album.Title}-{track:00}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("Venture.Bros.15x06");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Venture.Bros.Hybrid.Theory-06");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_use_existing_filename_when_scene_name_is_not_available()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.RenameEpisodes = true;
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Original Title}";
|
|
|
|
|
_namingConfig.RenameTracks = true;
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Original Title}";
|
|
|
|
|
|
|
|
|
|
_episodeFile.SceneName = null;
|
|
|
|
|
_episodeFile.RelativePath = "existing.file.mkv";
|
|
|
|
|
_trackFile.SceneName = null;
|
|
|
|
|
_trackFile.RelativePath = "existing.file.mkv";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be(Path.GetFileNameWithoutExtension(_episodeFile.RelativePath));
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(Path.GetFileNameWithoutExtension(_trackFile.RelativePath));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_be_able_to_use_only_original_title()
|
|
|
|
|
{
|
|
|
|
|
_series.Title = "30 Rock";
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Original Title}";
|
|
|
|
|
_artist.Name = "30 Rock";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Original Title}";
|
|
|
|
|
|
|
|
|
|
_episodeFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
|
_episodeFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
_trackFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
|
_trackFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("30.Rock.S01E01.xvid-LOL");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_allow_period_between_season_and_episode()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}.S{season:00}.E{episode:00}.{Episode.Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South.Park.S15.E06.City.Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_allow_space_between_season_and_episode()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00} E{episode:00} - {Episode Title}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park - S15 E06 - City Sushi");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_quality_proper_with_v2_for_anime_v2()
|
|
|
|
|
{
|
|
|
|
|
_series.SeriesType = SeriesTypes.Anime;
|
|
|
|
|
_namingConfig.AnimeEpisodeFormat = "{Quality Proper}";
|
|
|
|
|
|
|
|
|
|
GivenProper();
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("v2");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_include_quality_proper_when_release_is_not_a_proper()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Quality Title} {Quality Proper}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Quality Title} {Quality Proper}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("HDTV-720p");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_wrap_proper_in_square_brackets()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} [{Quality Title}] {[Quality Proper]}";
|
|
|
|
|
|
|
|
|
|
GivenProper();
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park - S15E06 [HDTV-720p] [Proper]");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("MP3-256");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_wrap_proper_in_square_brackets_when_not_a_proper()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} [{Quality Title}] {[Quality Proper]}";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park - S15E06 [HDTV-720p]");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin Park - 06 [MP3-256]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_quality_full_with_quality_title_only_when_not_a_proper()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} [{Quality Full}]";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist Name} - {track:00} [{Quality Full}]";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park - S15E06 [HDTV-720p]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_quality_full_with_quality_title_and_proper_only_when_a_proper()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} [{Quality Full}]";
|
|
|
|
|
|
|
|
|
|
GivenProper();
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park - S15E06 [HDTV-720p Proper]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_quality_full_with_quality_title_and_real_when_a_real()
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} [{Quality Full}]";
|
|
|
|
|
GivenReal();
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("South Park - S15E06 [HDTV-720p REAL]");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Linkin Park - 06 [MP3-256]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase(' ')]
|
|
|
|
@ -647,10 +472,10 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|
|
|
|
[TestCase('_')]
|
|
|
|
|
public void should_trim_extra_separators_from_end_when_quality_proper_is_not_included(char separator)
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = string.Format("{{Quality{0}Title}}{0}{{Quality{0}Proper}}", separator);
|
|
|
|
|
_namingConfig.StandardTrackFormat = string.Format("{{Quality{0}Title}}{0}{{Quality{0}Proper}}", separator);
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("HDTV-720p");
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("MP3-256");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase(' ')]
|
|
|
|
@ -659,67 +484,59 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|
|
|
|
[TestCase('_')]
|
|
|
|
|
public void should_trim_extra_separators_from_middle_when_quality_proper_is_not_included(char separator)
|
|
|
|
|
{
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = string.Format("{{Quality{0}Title}}{0}{{Quality{0}Proper}}{0}{{Episode{0}Title}}", separator);
|
|
|
|
|
_namingConfig.StandardTrackFormat = string.Format("{{Quality{0}Title}}{0}{{Quality{0}Proper}}{0}{{Track{0}Title}}", separator);
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be(string.Format("HDTV-720p{0}City{0}Sushi", separator));
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(string.Format("MP3-256{0}City{0}Sushi", separator));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_not_require_a_separator_between_tokens()
|
|
|
|
|
{
|
|
|
|
|
_series.SeriesType = SeriesTypes.Anime;
|
|
|
|
|
_namingConfig.AnimeEpisodeFormat = "[{Release Group}]{Series.CleanTitle}.{absolute:000}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
.Should().Be("[LidarrTest]South.Park.100");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_be_able_to_use_original_filename()
|
|
|
|
|
{
|
|
|
|
|
_series.Title = "30 Rock";
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - {Original Filename}";
|
|
|
|
|
_artist.Name = "30 Rock";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Artist Name} - {Original Filename}";
|
|
|
|
|
|
|
|
|
|
_episodeFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
|
_episodeFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
_trackFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
|
_trackFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("30 Rock - 30 Rock - S01E01 - Test");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_be_able_to_use_original_filename_only()
|
|
|
|
|
{
|
|
|
|
|
_series.Title = "30 Rock";
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Original Filename}";
|
|
|
|
|
_artist.Name = "30 Rock";
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Original Filename}";
|
|
|
|
|
|
|
|
|
|
_episodeFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
|
_episodeFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
_trackFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
|
_trackFile.RelativePath = "30 Rock - S01E01 - Test";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("30 Rock - S01E01 - Test");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_use_Lidarr_as_release_group_when_not_available()
|
|
|
|
|
{
|
|
|
|
|
_episodeFile.ReleaseGroup = null;
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Release Group}";
|
|
|
|
|
_trackFile.ReleaseGroup = null;
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Release Group}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be("Lidarr");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase("{Episode Title}{-Release Group}", "City Sushi")]
|
|
|
|
|
[TestCase("{Episode Title}{ Release Group}", "City Sushi")]
|
|
|
|
|
[TestCase("{Episode Title}{ [Release Group]}", "City Sushi")]
|
|
|
|
|
[TestCase("{Track Title}{-Release Group}", "City Sushi")]
|
|
|
|
|
[TestCase("{Track Title}{ Release Group}", "City Sushi")]
|
|
|
|
|
[TestCase("{Track Title}{ [Release Group]}", "City Sushi")]
|
|
|
|
|
public void should_not_use_Lidarr_as_release_group_if_pattern_has_separator(string pattern, string expectedFileName)
|
|
|
|
|
{
|
|
|
|
|
_episodeFile.ReleaseGroup = null;
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = pattern;
|
|
|
|
|
_trackFile.ReleaseGroup = null;
|
|
|
|
|
_namingConfig.StandardTrackFormat = pattern;
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(expectedFileName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -728,10 +545,10 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|
|
|
|
[TestCase("IMMERSE")]
|
|
|
|
|
public void should_use_existing_casing_for_release_group(string releaseGroup)
|
|
|
|
|
{
|
|
|
|
|
_episodeFile.ReleaseGroup = releaseGroup;
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Release Group}";
|
|
|
|
|
_trackFile.ReleaseGroup = releaseGroup;
|
|
|
|
|
_namingConfig.StandardTrackFormat = "{Release Group}";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
|
|
|
|
.Should().Be(releaseGroup);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|