1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 15:32:31 +01:00

GetSabName will return cleaner Season naming when it is a FullSeason release.

This commit is contained in:
Mark McDowall 2011-08-28 15:22:19 -07:00
parent 704084a5c8
commit 2980c91f19
2 changed files with 41 additions and 2 deletions

View File

@ -267,7 +267,7 @@ namespace NzbDrone.Core.Test
[TestCase(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, false, "My Series Name - 1x2-1x4 - My Episode Title [HDTV]")]
[TestCase(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - My Episode Title [HDTV] [Proper]")]
[TestCase(1, new[] { 2, 4 }, "", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - [HDTV] [Proper]")]
public void sab_title(int seasons, int[] episodes, string title, QualityTypes quality, bool proper, string excpected)
public void sab_title(int seasons, int[] episodes, string title, QualityTypes quality, bool proper, string expected)
{
var mocker = new AutoMoqer();
@ -289,7 +289,34 @@ namespace NzbDrone.Core.Test
var actual = mocker.Resolve<SabProvider>().GetSabTitle(parsResult);
//Assert
Assert.AreEqual(excpected, actual);
Assert.AreEqual(expected, actual);
}
[TestCase(true, "My Series Name - Season 1 [Bluray720p] [Proper]")]
[TestCase(false, "My Series Name - Season 1 [Bluray720p]")]
public void sab_season_title(bool proper, string expected)
{
var mocker = new AutoMoqer();
var series = Builder<Series>.CreateNew()
.With(c => c.Path = @"d:\tv shows\My Series Name")
.Build();
var parsResult = new EpisodeParseResult()
{
AirDate = DateTime.Now,
Quality = new Quality(QualityTypes.Bluray720p, proper),
SeasonNumber = 1,
Series = series,
EpisodeTitle = "My Episode Title",
FullSeason = true
};
//Act
var actual = mocker.Resolve<SabProvider>().GetSabTitle(parsResult);
//Assert
Assert.AreEqual(expected, actual);
}
[Test]

View File

@ -105,6 +105,18 @@ namespace NzbDrone.Core.Providers
public virtual String GetSabTitle(EpisodeParseResult parseResult)
{
//Handle Full Naming
if (parseResult.FullSeason)
{
var seasonResult = String.Format("{0} - Season {1} [{2}]", new DirectoryInfo(parseResult.Series.Path).Name,
parseResult.SeasonNumber, parseResult.Quality.QualityType);
if (parseResult.Quality.Proper)
seasonResult += " [Proper]";
return seasonResult;
}
//Show Name - 1x01-1x02 - Episode Name
//Show Name - 1x01 - Episode Name
var episodeString = new List<String>();