mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-25 12:12:58 +01:00
GetNewFilename takes series instead of string now
This commit is contained in:
parent
4ade27427b
commit
62b10a56df
@ -105,7 +105,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByFileId(episodeFile.EpisodeFileId))
|
||||
.Returns(episode);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>().Setup(s => s.GetNewFilename(It.IsAny<IList<Episode>>(), series.Title, QualityTypes.Unknown, false, It.IsAny<EpisodeFile>()))
|
||||
Mocker.GetMock<MediaFileProvider>().Setup(s => s.GetNewFilename(It.IsAny<IList<Episode>>(), series, QualityTypes.Unknown, false, It.IsAny<EpisodeFile>()))
|
||||
.Returns(newFilename);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>().Setup(s => s.CalculateFilePath(It.IsAny<Series>(), It.IsAny<int>(), It.IsAny<string>(), It.IsAny<string>()))
|
||||
|
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
.Returns(fakeEpisode);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries.Title, It.IsAny<QualityTypes>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>()))
|
||||
.Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny<QualityTypes>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>()))
|
||||
.Returns(filename);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
@ -104,7 +104,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
.Returns(fakeEpisode);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries.Title, It.IsAny<QualityTypes>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>()))
|
||||
.Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny<QualityTypes>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>()))
|
||||
.Returns(filename);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
|
@ -18,6 +18,17 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class MediaFileProvider_GetNewFilenameTest : CoreTest
|
||||
{
|
||||
private Series _series;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.Title = "South Park")
|
||||
.Build();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
|
||||
{
|
||||
@ -39,7 +50,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV]", result);
|
||||
@ -66,7 +77,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("15x06 - City Sushi [HDTV]", result);
|
||||
@ -93,7 +104,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("South Park 05x06 [HDTV]", result);
|
||||
@ -121,7 +132,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("South Park s05e06", result);
|
||||
@ -148,7 +159,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
||||
@ -175,7 +186,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV]", result);
|
||||
@ -203,7 +214,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("S15E06", result);
|
||||
@ -237,7 +248,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV]", result);
|
||||
@ -271,7 +282,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV]", result);
|
||||
@ -305,7 +316,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV]", result);
|
||||
@ -339,7 +350,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result);
|
||||
@ -373,7 +384,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
||||
@ -407,7 +418,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("3x23x24", result);
|
||||
@ -432,7 +443,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, true, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, true, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
result.Should().Be("South Park - S15E06 - City Sushi [HDTV] [Proper]");
|
||||
@ -457,7 +468,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
result.Should().Be("South Park - S15E06 - City Sushi [HDTV]");
|
||||
@ -482,7 +493,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, true, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, true, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
result.Should().Be("South Park - S15E06 - City Sushi");
|
||||
@ -514,7 +525,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, "30 Rock", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
||||
@ -541,7 +552,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV]", result);
|
||||
@ -568,7 +579,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual("15x06.City Sushi [HDTV]", result);
|
||||
@ -599,7 +610,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, episodeFile);
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, episodeFile);
|
||||
|
||||
//Assert
|
||||
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
|
||||
@ -630,7 +641,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, episodeFile);
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, episodeFile);
|
||||
|
||||
//Assert
|
||||
result.Should().Be(episodeFile.SceneName);
|
||||
@ -662,7 +673,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, "30 Rock", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
||||
@ -694,7 +705,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, "30 Rock", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
|
||||
@ -732,7 +743,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode, episode2, episode3 }, "30 Rock", QualityTypes.HDTV, false, new EpisodeFile());
|
||||
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
|
||||
//Assert
|
||||
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
|
||||
|
@ -49,11 +49,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Returns("Title1");
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Returns("Title2");
|
||||
|
||||
//Act
|
||||
@ -98,11 +98,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Returns("New Title 1");
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Returns("New Title 2");
|
||||
|
||||
//Act
|
||||
@ -147,11 +147,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Returns("New Title 1");
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Returns("Title2");
|
||||
|
||||
//Act
|
||||
@ -198,11 +198,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0], episodes[1] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0], episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Returns("New Title 1");
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[2] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Returns("Title2");
|
||||
|
||||
//Act
|
||||
@ -249,11 +249,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0], episodes[1] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[0], episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0]))
|
||||
.Returns("Title1");
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[2] }, "SeriesTitle", It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Setup(c => c.GetNewFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1]))
|
||||
.Returns("Title2");
|
||||
|
||||
//Act
|
||||
|
@ -183,7 +183,7 @@ namespace NzbDrone.Core.Providers
|
||||
|
||||
var series = _seriesProvider.GetSeries(episodeFile.SeriesId);
|
||||
var episodes = _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId);
|
||||
string newFileName = _mediaFileProvider.GetNewFilename(episodes, series.Title, episodeFile.Quality, episodeFile.Proper, episodeFile);
|
||||
string newFileName = _mediaFileProvider.GetNewFilename(episodes, series, episodeFile.Quality, episodeFile.Proper, episodeFile);
|
||||
var newFile = _mediaFileProvider.CalculateFilePath(series, episodes.First().SeasonNumber, newFileName, Path.GetExtension(episodeFile.Path));
|
||||
|
||||
//Only rename if existing and new filenames don't match
|
||||
|
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Providers
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string GetNewFilename(IList<Episode> episodes, string seriesTitle, QualityTypes quality, bool proper, EpisodeFile episodeFile)
|
||||
public virtual string GetNewFilename(IList<Episode> episodes, Series series, QualityTypes quality, bool proper, EpisodeFile episodeFile)
|
||||
{
|
||||
if (_configProvider.SortingUseSceneName)
|
||||
{
|
||||
@ -171,7 +171,7 @@ namespace NzbDrone.Core.Providers
|
||||
|
||||
if (_configProvider.SortingIncludeSeriesName)
|
||||
{
|
||||
result += seriesTitle + separatorStyle.Pattern;
|
||||
result += series.Title + separatorStyle.Pattern;
|
||||
}
|
||||
|
||||
result += numberStyle.Pattern.Replace("%0e", String.Format("{0:00}", sortedEpisodes.First().EpisodeNumber));
|
||||
|
@ -35,7 +35,7 @@ namespace NzbDrone.Core.Providers
|
||||
var misnamedFilesSelect = episodesWithFiles.AsParallel().Where(
|
||||
w =>
|
||||
w.First().EpisodeFile.Path !=
|
||||
_mediaFileProvider.GetNewFilename(w.Select(e => e).ToList(), w.First().Series.Title,
|
||||
_mediaFileProvider.GetNewFilename(w.Select(e => e).ToList(), w.First().Series,
|
||||
w.First().EpisodeFile.Quality, w.First().EpisodeFile.Proper, w.First().EpisodeFile)).Skip(Math.Max(pageSize * (pageNumber - 1), 0)).Take(pageSize);
|
||||
|
||||
//Process the episodes
|
||||
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Providers
|
||||
var episodes = f.Select(e => e).ToList();
|
||||
var firstEpisode = episodes[0];
|
||||
var properName = _mediaFileProvider.GetNewFilename(episodes,
|
||||
firstEpisode.Series.Title,
|
||||
firstEpisode.Series,
|
||||
firstEpisode.EpisodeFile.Quality, firstEpisode.EpisodeFile.Proper, firstEpisode.EpisodeFile);
|
||||
|
||||
var currentName = Path.GetFileNameWithoutExtension(firstEpisode.EpisodeFile.Path);
|
||||
|
Loading…
Reference in New Issue
Block a user