mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-29 11:23:02 +02:00
Download naming uses tvdb numbering
Searching by scene name added Removed American Dad
This commit is contained in:
parent
59bfa16462
commit
2fd1263619
@ -195,7 +195,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var fakeEpisodes = new List<Episode>();
|
||||
|
||||
foreach(var episode in episodes)
|
||||
fakeEpisodes.Add(Builder<Episode>.CreateNew().With(e => e.EpisodeNumber = episode).Build());
|
||||
fakeEpisodes.Add(Builder<Episode>
|
||||
.CreateNew()
|
||||
.With(e => e.EpisodeNumber = episode)
|
||||
.With(e => e.Title = title)
|
||||
.Build());
|
||||
|
||||
var parsResult = new EpisodeParseResult()
|
||||
{
|
||||
@ -241,16 +245,49 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.With(c => c.Title = "My Series Name")
|
||||
.Build();
|
||||
|
||||
var episode = Builder<Episode>.CreateNew()
|
||||
.With(e => e.Title = "My Episode Title")
|
||||
.Build();
|
||||
|
||||
var parsResult = new EpisodeParseResult
|
||||
{
|
||||
AirDate = new DateTime(2011, 12, 1),
|
||||
Quality = new Quality(QualityTypes.Bluray720p, proper),
|
||||
Series = series,
|
||||
EpisodeTitle = "My Episode Title",
|
||||
Episodes = new List<Episode>{ episode }
|
||||
};
|
||||
|
||||
return Mocker.Resolve<DownloadProvider>().GetDownloadTitle(parsResult);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_repeat_the_same_episode_title()
|
||||
{
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(c => c.Title = "My Series Name")
|
||||
.Build();
|
||||
|
||||
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(e => e.SeasonNumber = 5)
|
||||
.TheFirst(1)
|
||||
.With(e => e.Title = "My Episode Title (1)")
|
||||
.TheLast(1)
|
||||
.With(e => e.Title = "My Episode Title (2)")
|
||||
.Build();
|
||||
|
||||
var parsResult = new EpisodeParseResult
|
||||
{
|
||||
AirDate = DateTime.Now,
|
||||
EpisodeNumbers = new List<int>{ 10, 11 },
|
||||
Quality = new Quality(QualityTypes.HDTV, false),
|
||||
SeasonNumber = 35,
|
||||
Series = series,
|
||||
Episodes = fakeEpisodes
|
||||
};
|
||||
|
||||
Mocker.Resolve<DownloadProvider>().GetDownloadTitle(parsResult).Should().Be("My Series Name - 5x01-5x02 - My Episode Title [HDTV]");
|
||||
}
|
||||
}
|
||||
}
|
@ -699,5 +699,43 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
//Assert
|
||||
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_two_episodeTitles_when_distinct_count_is_two()
|
||||
{
|
||||
//Setup
|
||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
||||
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
||||
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
||||
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
||||
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
||||
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
||||
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
||||
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(3);
|
||||
|
||||
var episode = Builder<Episode>.CreateNew()
|
||||
.With(e => e.Title = "Hello (3)")
|
||||
.With(e => e.SeasonNumber = 6)
|
||||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
var episode2 = Builder<Episode>.CreateNew()
|
||||
.With(e => e.Title = "Hello (2)")
|
||||
.With(e => e.SeasonNumber = 6)
|
||||
.With(e => e.EpisodeNumber = 7)
|
||||
.Build();
|
||||
|
||||
var episode3 = Builder<Episode>.CreateNew()
|
||||
.With(e => e.Title = "World")
|
||||
.With(e => e.SeasonNumber = 6)
|
||||
.With(e => e.EpisodeNumber = 8)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode, episode2, episode3 }, "30 Rock", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
|
||||
}
|
||||
}
|
||||
}
|
@ -185,7 +185,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchProviderTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EpisodeSearch_should_skip_if_air_date_is_null()
|
||||
public void EpisodeSearch_should_skip_if_air_date_is_null_and_is_a_daily_series()
|
||||
{
|
||||
//Setup
|
||||
_series.IsDaily = true;
|
||||
@ -206,5 +206,29 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchProviderTests
|
||||
result.Should().BeFalse();
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EpisodeSearch_should_skip_if_sceneNumbering_is_invalid_and_should_use_sceneNumbering()
|
||||
{
|
||||
//Setup
|
||||
_series.UseSceneNumbering = true;
|
||||
var episode = _episodes.First();
|
||||
episode.SceneSeasonNumber = 0;
|
||||
episode.SceneEpisodeNumber = 0;
|
||||
episode.Series = _series;
|
||||
|
||||
Mocker.GetMock<UpgradePossibleSpecification>().Setup(s => s.IsSatisfiedBy(It.IsAny<Episode>()))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisode(episode.EpisodeId))
|
||||
.Returns(episode);
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<SearchProvider>().EpisodeSearch(MockNotification, episode.EpisodeId);
|
||||
|
||||
//Assert
|
||||
result.Should().BeFalse();
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -833,5 +833,41 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Update_UseSceneNumbering_should_update_applicable_series()
|
||||
{
|
||||
WithRealDb();
|
||||
var series = Builder<Series>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(s => s.UseSceneNumbering = false)
|
||||
.Build();
|
||||
|
||||
Db.InsertMany(series);
|
||||
|
||||
Mocker.Resolve<SeriesProvider>().UpdateUseSceneNumbering(new []{ 2, 3 });
|
||||
|
||||
var seriesResults = Db.Fetch<Series>();
|
||||
seriesResults.Single(s => s.SeriesId == 2).UseSceneNumbering.Should().BeTrue();
|
||||
seriesResults.Single(s => s.SeriesId == 3).UseSceneNumbering.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Update_UseSceneNumbering_should_not_update_other_series()
|
||||
{
|
||||
WithRealDb();
|
||||
var series = Builder<Series>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(s => s.UseSceneNumbering = false)
|
||||
.Build();
|
||||
|
||||
Db.InsertMany(series);
|
||||
|
||||
Mocker.Resolve<SeriesProvider>().UpdateUseSceneNumbering(new [] { 2, 3 });
|
||||
|
||||
var seriesResults = Db.Fetch<Series>();
|
||||
seriesResults.Where(s => !s.UseSceneNumbering).Should().HaveCount(3);
|
||||
seriesResults.Where(s => !s.UseSceneNumbering).Should().NotContain(s => s.SeriesId == 2 || s.SeriesId == 3);
|
||||
}
|
||||
}
|
||||
} |