Speicals go in Specials folder

This commit is contained in:
Mark McDowall 2013-10-04 22:23:10 -07:00
parent ba4193cc46
commit 7ef2fb0242
2 changed files with 13 additions and 2 deletions

View File

@ -31,6 +31,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
[TestCase("30 Rock - S01E05 - Episode Title", 1, false, "Season %0s", @"C:\Test\30 Rock\30 Rock - S01E05 - Episode Title.mkv")]
[TestCase("30 Rock - S01E05 - Episode Title", 1, false, "Season %s", @"C:\Test\30 Rock\30 Rock - S01E05 - Episode Title.mkv")]
[TestCase("30 Rock - S01E05 - Episode Title", 1, true, "ReallyUglySeasonFolder %s", @"C:\Test\30 Rock\ReallyUglySeasonFolder 1\30 Rock - S01E05 - Episode Title.mkv")]
[TestCase("30 Rock - S00E05 - Episode Title", 0, true, "Season %s", @"C:\Test\30 Rock\Specials\30 Rock - S00E05 - Episode Title.mkv")]
public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int seasonNumber, bool useSeasonFolder, string seasonFolderFormat, string expectedPath)
{
var fakeSeries = Builder<Series>.CreateNew()
@ -41,7 +42,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
Mocker.GetMock<IConfigService>().Setup(e => e.SeasonFolderFormat).Returns(seasonFolderFormat);
Subject.BuildFilePath(fakeSeries, 1, filename, ".mkv").Should().Be(expectedPath.AsOsAgnostic());
Subject.BuildFilePath(fakeSeries, seasonNumber, filename, ".mkv").Should().Be(expectedPath.AsOsAgnostic());
}
}
}

View File

@ -170,12 +170,22 @@ namespace NzbDrone.Core.Organizer
string path = series.Path;
if (series.SeasonFolder)
{
var seasonFolder = _configService.SeasonFolderFormat
string seasonFolder;
if (seasonNumber == 0)
{
seasonFolder = "Specials";
}
else
{
seasonFolder = _configService.SeasonFolderFormat
.Replace("%sn", series.Title)
.Replace("%s.n", series.Title.Replace(' ', '.'))
.Replace("%s_n", series.Title.Replace(' ', '_'))
.Replace("%0s", seasonNumber.ToString("00"))
.Replace("%s", seasonNumber.ToString());
}
path = Path.Combine(path, seasonFolder);
}