mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-15 10:39:47 +02:00
Merge branch 'master' into backbone
This commit is contained in:
commit
b3874dbdb0
@ -193,8 +193,8 @@ public virtual void InheritFolderPermissions(string filename)
|
||||
|
||||
public virtual ulong FreeDiskSpace(DirectoryInfo directoryInfo)
|
||||
{
|
||||
if (!directoryInfo.Exists)
|
||||
throw new DirectoryNotFoundException();
|
||||
if(!directoryInfo.Exists)
|
||||
throw new DirectoryNotFoundException(directoryInfo.FullName);
|
||||
|
||||
ulong freeBytesAvailable;
|
||||
ulong totalNumberOfBytes;
|
||||
|
@ -1,24 +1,24 @@
|
||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
|
||||
<channel>
|
||||
<generator>omgwtfnzbs.com rss feeds generator</generator>
|
||||
<generator>omgwtfnzbs.org rss feeds generator</generator>
|
||||
<language>en-us</language>
|
||||
<title>Search NZB Download Feed</title>
|
||||
<link>http://rss.omgwtfnzbs.com</link>
|
||||
<description>auto-dl feed for omgwtfnzbs.com</description>
|
||||
<link>http://rss.omgwtfnzbs.org</link>
|
||||
<description>auto-dl feed for omgwtfnzbs.org</description>
|
||||
<copyright>2010 - 2012 omgwtfnzbs</copyright>
|
||||
<atom:link href="http://rss.omgwtfnzbs.com/rss-search.php?catid=19,20&eng=1" rel="self" type="application/rss+xml" />
|
||||
<atom:link href="http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&eng=1" rel="self" type="application/rss+xml" />
|
||||
<pubDate>Mon, 17 Dec 2012 23:30:16 +0000</pubDate>
|
||||
|
||||
<item>
|
||||
<title>Stephen.Fry.Gadget.Man.S01E05.HDTV.x264-C4TV</title>
|
||||
<pubDate>Mon, 17 Dec 2012 23:30:13 +0000</pubDate>
|
||||
<guid>http://api.omgwtfnzbs.com/sn.php?id=OAl4g&user=nzbdrone&api=nzbdrone</guid>
|
||||
<link>http://api.omgwtfnzbs.com/sn.php?id=OAl4g&user=nzbdrone&api=nzbdrone</link>
|
||||
<description><![CDATA[<b>Category:</b> TV: STD<br /><b>Size:</b> 225.85 MB<br /><b>Group:</b> alt.binaries.teevee<br /><b>Added to index:</b> 17/12/2012 23:30:04<br /><b>Added to usenet:</b> 17/12/2012 23:30:13<br /><b>Weblink:</b> <a href="http://www.tvrage.com/shows/id-33431" target="_blank">http://www.tvrage.com/shows/id-33431</a><br /><b>View NZB:</b> <a href="http://omgwtfnzbs.com/details.php?id=OAl4g" target="_blank">http://omgwtfnzbs.com/details.php?id=OAl4g</a>]]></description>
|
||||
<guid>http://api.omgwtfnzbs.org/sn.php?id=OAl4g&user=nzbdrone&api=nzbdrone</guid>
|
||||
<link>http://api.omgwtfnzbs.org/sn.php?id=OAl4g&user=nzbdrone&api=nzbdrone</link>
|
||||
<description><![CDATA[<b>Category:</b> TV: STD<br /><b>Size:</b> 225.85 MB<br /><b>Group:</b> alt.binaries.teevee<br /><b>Added to index:</b> 17/12/2012 23:30:04<br /><b>Added to usenet:</b> 17/12/2012 23:30:13<br /><b>Weblink:</b> <a href="http://www.tvrage.com/shows/id-33431" target="_blank">http://www.tvrage.com/shows/id-33431</a><br /><b>View NZB:</b> <a href="http://omgwtfnzbs.org/details.php?id=OAl4g" target="_blank">http://omgwtfnzbs.org/details.php?id=OAl4g</a>]]></description>
|
||||
<category>TV: STD</category>
|
||||
<cattext>tv.sd</cattext>
|
||||
<categoryid>19</categoryid>
|
||||
<enclosure url="http://api.omgwtfnzbs.com/sn.php?id=OAl4g&user=nzbdrone&api=nzbdrone" length="236822906" type="application/x-nzb" />
|
||||
<enclosure url="http://api.omgwtfnzbs.org/sn.php?id=OAl4g&user=nzbdrone&api=nzbdrone" length="236822906" type="application/x-nzb" />
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
File diff suppressed because it is too large
Load Diff
@ -219,7 +219,7 @@ public void size_omgwtfnzbs()
|
||||
WithConfiguredIndexers();
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.com/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny<NetworkCredential>()))
|
||||
.Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny<NetworkCredential>()))
|
||||
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\omgwtfnzbs.xml"));
|
||||
|
||||
//Act
|
||||
@ -479,14 +479,14 @@ public void should_get_nzbInfoUrl_for_omgwtfnzbs()
|
||||
WithConfiguredIndexers();
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.com/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny<NetworkCredential>()))
|
||||
.Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny<NetworkCredential>()))
|
||||
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\omgwtfnzbs.xml"));
|
||||
|
||||
//Act
|
||||
var parseResults = Mocker.Resolve<Omgwtfnzbs>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
parseResults[0].NzbInfoUrl.Should().Be("http://omgwtfnzbs.com/details.php?id=OAl4g");
|
||||
parseResults[0].NzbInfoUrl.Should().Be("http://omgwtfnzbs.org/details.php?id=OAl4g");
|
||||
}
|
||||
}
|
||||
}
|
@ -147,6 +147,7 @@
|
||||
<Compile Include="HelperTests\XElementHelperTests\ConvertToTFixture.cs" />
|
||||
<Compile Include="IndexerTests\NzbxFixture.cs" />
|
||||
<Compile Include="JobTests\RenameSeasonJobFixture.cs" />
|
||||
<Compile Include="ProviderTests\RootDirProviderTests\FreeSpaceOnDrivesFixture.cs" />
|
||||
<Compile Include="ProviderTests\SearchProviderTests\GetSeriesTitleFixture.cs" />
|
||||
<Compile Include="ProviderTests\TvRageMappingProviderTests\FindMatchingTvRageSeriesFixture.cs" />
|
||||
<Compile Include="ProviderTests\TvRageMappingProviderTests\ProcessResultsFixture.cs" />
|
||||
@ -242,7 +243,7 @@
|
||||
<Compile Include="ProviderTests\DecisionEngineTests\AllowedDownloadSpecificationFixture.cs" />
|
||||
<Compile Include="ProviderTests\JobProviderTests\JobProviderFixture.cs" />
|
||||
<Compile Include="QualityTest.cs" />
|
||||
<Compile Include="ProviderTests\RootDirProviderTest.cs" />
|
||||
<Compile Include="ProviderTests\RootDirProviderTests\RootDirProviderFixture.cs" />
|
||||
<Compile Include="ProviderTests\IndexerProviderTest.cs" />
|
||||
<Compile Include="ProviderTests\HistoryProviderTest.cs" />
|
||||
<Compile Include="ProviderTests\MediaFileProviderTest.cs" />
|
||||
|
@ -105,7 +105,7 @@ public void should_move_file_if_a_conflict_is_found()
|
||||
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 @@ public void should_not_move_file_if_source_and_destination_are_the_same_path()
|
||||
.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 @@ public void should_use_EpisodeFiles_quality()
|
||||
.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>()
|
||||
|
@ -1,7 +1,9 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
@ -18,6 +20,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 +52,7 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
|
||||
.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 +79,7 @@ public void GetNewFilename_Episode_Quality_1x05_Dash()
|
||||
.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 +106,7 @@ public void GetNewFilename_Series_Quality_01x05_Space()
|
||||
.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 +134,7 @@ public void GetNewFilename_Series_s01e05_Space()
|
||||
.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 +161,7 @@ public void GetNewFilename_Series_Episode_s01e05_Periods()
|
||||
.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 +188,7 @@ public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
|
||||
.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 +216,7 @@ public void GetNewFilename_S01E05_Dash()
|
||||
.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 +250,7 @@ public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
|
||||
.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 +284,7 @@ public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
|
||||
.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 +318,7 @@ public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
|
||||
.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 +352,7 @@ public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
|
||||
.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 +386,7 @@ public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
|
||||
.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 +420,7 @@ public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
|
||||
.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 +445,7 @@ public void GetNewFilename_should_append_proper_when_proper_and_append_quality_i
|
||||
.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 +470,7 @@ public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_q
|
||||
.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 +495,7 @@ public void GetNewFilename_should_not_append_proper_when_proper_and_append_quali
|
||||
.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 +527,7 @@ public void GetNewFilename_should_order_multiple_episode_files_in_numerical_orde
|
||||
.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 +554,7 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
|
||||
.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 +581,7 @@ public void GetNewFilename_Episode_Quality_1x05_Period()
|
||||
.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 +612,7 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNull()
|
||||
.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 +643,7 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
|
||||
.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 +675,7 @@ public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
|
||||
.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 +707,7 @@ public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
|
||||
.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,10 +745,97 @@ public void should_have_two_episodeTitles_when_distinct_count_is_two()
|
||||
.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");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_airDate_if_series_isDaily()
|
||||
{
|
||||
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(true);
|
||||
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
||||
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
||||
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
||||
|
||||
var series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.IsDaily = true)
|
||||
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
||||
.Build();
|
||||
|
||||
var episodes = Builder<Episode>
|
||||
.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.AirDate = new DateTime(2012, 12, 13))
|
||||
.With(e => e.Title = "Kristen Stewart")
|
||||
.Build();
|
||||
|
||||
var result = Mocker.Resolve<MediaFileProvider>()
|
||||
.GetNewFilename(episodes, series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV]");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_airDate_if_series_isDaily_no_episode_title()
|
||||
{
|
||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
||||
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
||||
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
||||
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);
|
||||
|
||||
var series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.IsDaily = true)
|
||||
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
||||
.Build();
|
||||
|
||||
var episodes = Builder<Episode>
|
||||
.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.AirDate = new DateTime(2012, 12, 13))
|
||||
.With(e => e.Title = "Kristen Stewart")
|
||||
.Build();
|
||||
|
||||
var result = Mocker.Resolve<MediaFileProvider>()
|
||||
.GetNewFilename(episodes, series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_set_airdate_to_unknown_if_not_available()
|
||||
{
|
||||
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);
|
||||
|
||||
var series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.IsDaily = true)
|
||||
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
||||
.Build();
|
||||
|
||||
var episodes = Builder<Episode>
|
||||
.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.AirDate = null)
|
||||
.With(e => e.Title = "Kristen Stewart")
|
||||
.Build();
|
||||
|
||||
var result = Mocker.Resolve<MediaFileProvider>()
|
||||
.GetNewFilename(episodes, series, QualityTypes.HDTV, false, new EpisodeFile());
|
||||
result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
|
||||
}
|
||||
}
|
||||
}
|
@ -49,11 +49,11 @@ public void no_misnamed_files()
|
||||
.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 @@ public void all_misnamed_files()
|
||||
.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 @@ public void one_misnamed_file()
|
||||
.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 @@ public void misnamed_multi_episode_file()
|
||||
.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 @@ public void no_misnamed_multi_episode_file()
|
||||
.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
|
||||
|
@ -100,6 +100,7 @@ public void Save_should_clean_url_before_updating_when_url_is_not_empty()
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("No longer clean newznab URLs")]
|
||||
public void SaveAll_should_clean_urls_before_updating()
|
||||
{
|
||||
//Setup
|
||||
|
@ -0,0 +1,114 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Test.Common.AutoMoq;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.RootDirProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class FreeSpaceOnDrivesFixture : CoreTest
|
||||
{
|
||||
[Test]
|
||||
public void should_return_one_drive_when_only_one_root_dir_exists()
|
||||
{
|
||||
Mocker.GetMock<IDatabase>()
|
||||
.Setup(s => s.Fetch<RootDir>())
|
||||
.Returns(new List<RootDir> { new RootDir { Id = 1, Path = @"C:\Test\TV" } });
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.GetPathRoot(@"C:\Test\TV"))
|
||||
.Returns(@"C:\");
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.FreeDiskSpace(new DirectoryInfo(@"C:\")))
|
||||
.Returns(123456);
|
||||
|
||||
var result = Mocker.Resolve<RootDirProvider>().FreeSpaceOnDrives();
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_one_drive_when_two_rootDirs_on_the_same_drive_exist()
|
||||
{
|
||||
Mocker.GetMock<IDatabase>()
|
||||
.Setup(s => s.Fetch<RootDir>())
|
||||
.Returns(new List<RootDir> { new RootDir { Id = 1, Path = @"C:\Test\TV" },
|
||||
new RootDir { Id = 2, Path = @"C:\Test\TV2" }});
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.GetPathRoot(It.IsAny<String>()))
|
||||
.Returns(@"C:\");
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.FreeDiskSpace(new DirectoryInfo(@"C:\")))
|
||||
.Returns(123456);
|
||||
|
||||
var result = Mocker.Resolve<RootDirProvider>().FreeSpaceOnDrives();
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_two_drives_when_two_rootDirs_on_the_different_drive_exist()
|
||||
{
|
||||
Mocker.GetMock<IDatabase>()
|
||||
.Setup(s => s.Fetch<RootDir>())
|
||||
.Returns(new List<RootDir> { new RootDir { Id = 1, Path = @"C:\Test\TV" },
|
||||
new RootDir { Id = 2, Path = @"D:\Test\TV" }});
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.GetPathRoot(@"C:\Test\TV"))
|
||||
.Returns(@"C:\");
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.GetPathRoot(@"D:\Test\TV"))
|
||||
.Returns(@"D:\");
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.FreeDiskSpace(It.IsAny<DirectoryInfo>()))
|
||||
.Returns(123456);
|
||||
|
||||
var result = Mocker.Resolve<RootDirProvider>().FreeSpaceOnDrives();
|
||||
|
||||
result.Should().HaveCount(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_skip_rootDir_if_not_found_on_disk()
|
||||
{
|
||||
Mocker.GetMock<IDatabase>()
|
||||
.Setup(s => s.Fetch<RootDir>())
|
||||
.Returns(new List<RootDir> { new RootDir { Id = 1, Path = @"C:\Test\TV" } });
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.GetPathRoot(@"C:\Test\TV"))
|
||||
.Returns(@"C:\");
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(s => s.FreeDiskSpace(It.IsAny<DirectoryInfo>()))
|
||||
.Throws(new DirectoryNotFoundException());
|
||||
|
||||
var result = Mocker.Resolve<RootDirProvider>().FreeSpaceOnDrives();
|
||||
|
||||
result.Should().HaveCount(0);
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,11 +14,11 @@
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common.AutoMoq;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
namespace NzbDrone.Core.Test.ProviderTests.RootDirProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class RootDirProviderTest : CoreTest
|
||||
public class RootDirProviderFixture : CoreTest
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@ -35,7 +35,6 @@ private void WithNoneExistingFolder()
|
||||
.Returns(false);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void GetRootDir_should_return_all_existing_roots()
|
||||
{
|
||||
@ -48,7 +47,6 @@ public void GetRootDir_should_return_all_existing_roots()
|
||||
result.Should().HaveCount(2);
|
||||
}
|
||||
|
||||
|
||||
[TestCase("D:\\TV Shows\\")]
|
||||
[TestCase("//server//folder")]
|
||||
public void should_be_able_to_add_root_dir(string path)
|
||||
@ -74,7 +72,6 @@ public void should_throw_if_folder_being_added_doesnt_exist()
|
||||
Assert.Throws<DirectoryNotFoundException>(() => rootDirProvider.Add(new RootDir { Path = "C:\\TEST" }));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_remove_root_dir()
|
||||
{
|
||||
@ -91,7 +88,6 @@ public void should_be_able_to_remove_root_dir()
|
||||
rootDirs.Should().HaveCount(1);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void None_existing_folder_returns_empty_list()
|
||||
{
|
||||
@ -132,6 +128,5 @@ public void adding_duplicated_root_folder_should_throw()
|
||||
rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
|
||||
Assert.Throws<InvalidOperationException>(() => rootDirProvider.Add(new RootDir { Path = @"C:\TV" }));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ public void Setup()
|
||||
.With(s => s.TvRageId = 0)
|
||||
.With(s => s.TvRageTitle = null)
|
||||
.With(s => s.UtcOffset = 0)
|
||||
.With(s => s.FirstAired = DateTime.Today.AddDays(-180))
|
||||
.Build();
|
||||
|
||||
_episode = Builder<Episode>
|
||||
|
@ -25,7 +25,10 @@ public void Setup()
|
||||
.CreateListOfSize(5)
|
||||
.Build();
|
||||
|
||||
_series = Builder<Series>.CreateNew().Build();
|
||||
_series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.FirstAired = DateTime.Today.AddDays(-180))
|
||||
.Build();
|
||||
|
||||
_episode = Builder<Episode>
|
||||
.CreateNew()
|
||||
@ -63,7 +66,18 @@ public void should_return_result_if_scene_clean_name_matches()
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_result_if_firstAired_matches()
|
||||
public void should_return_result_if_series_firstAired_matches()
|
||||
{
|
||||
_series.FirstAired = _searchResults.Last().Started;
|
||||
|
||||
Mocker.Resolve<TvRageMappingProvider>()
|
||||
.ProcessResults(_searchResults, _series, "nomatchhere", _episode)
|
||||
.Should()
|
||||
.Be(_searchResults.Last());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_result_if_episode_firstAired_matches()
|
||||
{
|
||||
_episode.AirDate = _searchResults.Last().Started;
|
||||
|
||||
|
17
NzbDrone.Core/Datastore/Migrations/Migration20121223.cs
Normal file
17
NzbDrone.Core/Datastore/Migrations/Migration20121223.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using Migrator.Framework;
|
||||
using NzbDrone.Common;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migrations
|
||||
{
|
||||
[Migration(20121223)]
|
||||
public class Migration20121223 : NzbDroneMigration
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Database.AddColumn("SceneMappings", new Column("SeasonNumber", DbType.Int32, ColumnProperty.Null));
|
||||
Database.ExecuteNonQuery("UPDATE SceneMappings SET SeasonNumber = -1 WHERE SeasonNumber IS NULL");
|
||||
}
|
||||
}
|
||||
}
|
16
NzbDrone.Core/Datastore/Migrations/Migration20121226.cs
Normal file
16
NzbDrone.Core/Datastore/Migrations/Migration20121226.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using Migrator.Framework;
|
||||
using NzbDrone.Common;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migrations
|
||||
{
|
||||
[Migration(20121226)]
|
||||
public class Migration20121226 : NzbDroneMigration
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Database.AddColumn("Series", new Column("FirstAired", DbType.DateTime, ColumnProperty.Null));
|
||||
}
|
||||
}
|
||||
}
|
@ -229,6 +229,7 @@
|
||||
<Compile Include="Datastore\MigrationLogger.cs" />
|
||||
<Compile Include="Datastore\MigrationsHelper.cs" />
|
||||
<Compile Include="Datastore\CustomeMapper.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121226.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121218.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121209.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121202.cs" />
|
||||
@ -255,6 +256,7 @@
|
||||
<Compile Include="Datastore\Migrations\Migration20110707.cs" />
|
||||
<Compile Include="Datastore\DbProviderFactory.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20120707.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121223.cs" />
|
||||
<Compile Include="Datastore\Migrations\NzbDroneMigration.cs" />
|
||||
<Compile Include="Datastore\Migrations\SchemaInfo.cs" />
|
||||
<Compile Include="Datastore\PetaPoco\EpisodeSeasonRelator.cs" />
|
||||
|
@ -183,7 +183,7 @@ public virtual EpisodeFile MoveEpisodeFile(EpisodeFile episodeFile, bool newDown
|
||||
|
||||
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
|
||||
|
@ -30,7 +30,7 @@ protected override string[] Urls
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
String.Format("http://rss.omgwtfnzbs.com/rss-search.php?catid=19,20&user={0}&api={1}&eng=1",
|
||||
String.Format("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user={0}&api={1}&eng=1",
|
||||
_configProvider.OmgwtfnzbsUsername, _configProvider.OmgwtfnzbsApiKey)
|
||||
};
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ LEFT OUTER JOIN Episodes
|
||||
}
|
||||
}
|
||||
|
||||
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,36 +171,50 @@ public virtual string GetNewFilename(IList<Episode> episodes, string seriesTitle
|
||||
|
||||
if (_configProvider.SortingIncludeSeriesName)
|
||||
{
|
||||
result += seriesTitle + separatorStyle.Pattern;
|
||||
result += series.Title + separatorStyle.Pattern;
|
||||
}
|
||||
|
||||
result += numberStyle.Pattern.Replace("%0e", String.Format("{0:00}", sortedEpisodes.First().EpisodeNumber));
|
||||
|
||||
if (episodes.Count > 1)
|
||||
if(!series.IsDaily)
|
||||
{
|
||||
var multiEpisodeStyle = EpisodeSortingHelper.GetMultiEpisodeStyle(_configProvider.SortingMultiEpisodeStyle);
|
||||
result += numberStyle.Pattern.Replace("%0e",
|
||||
String.Format("{0:00}", sortedEpisodes.First().EpisodeNumber));
|
||||
|
||||
foreach (var episode in sortedEpisodes.Skip(1))
|
||||
if(episodes.Count > 1)
|
||||
{
|
||||
if (multiEpisodeStyle.Name == "Duplicate")
|
||||
{
|
||||
result += separatorStyle.Pattern + numberStyle.Pattern;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += multiEpisodeStyle.Pattern;
|
||||
}
|
||||
var multiEpisodeStyle =
|
||||
EpisodeSortingHelper.GetMultiEpisodeStyle(_configProvider.SortingMultiEpisodeStyle);
|
||||
|
||||
result = result.Replace("%0e", String.Format("{0:00}", episode.EpisodeNumber));
|
||||
episodeNames.Add(Parser.CleanupEpisodeTitle(episode.Title));
|
||||
foreach(var episode in sortedEpisodes.Skip(1))
|
||||
{
|
||||
if(multiEpisodeStyle.Name == "Duplicate")
|
||||
{
|
||||
result += separatorStyle.Pattern + numberStyle.Pattern;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += multiEpisodeStyle.Pattern;
|
||||
}
|
||||
|
||||
result = result.Replace("%0e", String.Format("{0:00}", episode.EpisodeNumber));
|
||||
episodeNames.Add(Parser.CleanupEpisodeTitle(episode.Title));
|
||||
}
|
||||
}
|
||||
|
||||
result = result
|
||||
.Replace("%s", String.Format("{0}", episodes.First().SeasonNumber))
|
||||
.Replace("%0s", String.Format("{0:00}", episodes.First().SeasonNumber))
|
||||
.Replace("%x", numberStyle.EpisodeSeparator)
|
||||
.Replace("%p", separatorStyle.Pattern);
|
||||
}
|
||||
|
||||
result = result
|
||||
.Replace("%s", String.Format("{0}", episodes.First().SeasonNumber))
|
||||
.Replace("%0s", String.Format("{0:00}", episodes.First().SeasonNumber))
|
||||
.Replace("%x", numberStyle.EpisodeSeparator)
|
||||
.Replace("%p", separatorStyle.Pattern);
|
||||
else
|
||||
{
|
||||
if(episodes.First().AirDate.HasValue)
|
||||
result += episodes.First().AirDate.Value.ToString("yyyy-MM-dd");
|
||||
|
||||
else
|
||||
result += "Unknown";
|
||||
}
|
||||
|
||||
if (_configProvider.SortingIncludeEpisodeTitle)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ public virtual List<MisnamedEpisodeModel> MisnamedFiles(int pageNumber, int page
|
||||
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 @@ public virtual List<MisnamedEpisodeModel> MisnamedFiles(int pageNumber, int page
|
||||
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);
|
||||
|
@ -60,7 +60,7 @@ public virtual void SaveAll(IEnumerable<NewznabDefinition> definitions)
|
||||
foreach(var newznabDefinition in definitionsList)
|
||||
{
|
||||
CheckHostname(newznabDefinition.Url);
|
||||
newznabDefinition.Url = new Uri(newznabDefinition.Url).ParentUriString();
|
||||
//newznabDefinition.Url = new Uri(newznabDefinition.Url).ParentUriString();
|
||||
}
|
||||
|
||||
_database.UpdateMany(definitionsList);
|
||||
|
@ -98,8 +98,17 @@ public virtual Dictionary<string, ulong> FreeSpaceOnDrives()
|
||||
{
|
||||
var pathRoot = _diskProvider.GetPathRoot(rootDir.Path);
|
||||
|
||||
if (!freeSpace.ContainsKey(pathRoot))
|
||||
freeSpace.Add(pathRoot, _diskProvider.FreeDiskSpace(new DirectoryInfo(rootDir.Path)));
|
||||
if(!freeSpace.ContainsKey(pathRoot))
|
||||
{
|
||||
try
|
||||
{
|
||||
freeSpace.Add(pathRoot, _diskProvider.FreeDiskSpace(new DirectoryInfo(rootDir.Path)));
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Logger.WarnException("Error getting fromm space for: " + pathRoot, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return freeSpace;
|
||||
|
@ -112,6 +112,11 @@ public virtual Series UpdateSeriesInfo(int seriesId)
|
||||
series.BannerUrl = tvDbSeries.BannerPath;
|
||||
series.Network = tvDbSeries.Network;
|
||||
|
||||
if (tvDbSeries.FirstAired.Year > 1900)
|
||||
series.FirstAired = tvDbSeries.FirstAired.Date;
|
||||
else
|
||||
series.FirstAired = null;
|
||||
|
||||
try
|
||||
{
|
||||
if(series.TvRageId == 0)
|
||||
|
@ -59,7 +59,10 @@ public TvRageSearchResult ProcessResults(IList<TvRageSearchResult> searchResults
|
||||
if (!String.IsNullOrWhiteSpace(sceneCleanName) && Parser.NormalizeTitle(result.Name).Equals(sceneCleanName))
|
||||
return result;
|
||||
|
||||
if (firstEpisode.AirDate.HasValue && result.Started == firstEpisode.AirDate.Value)
|
||||
if (series.FirstAired.HasValue && result.Started == series.FirstAired.Value)
|
||||
return result;
|
||||
|
||||
if (firstEpisode != null && firstEpisode.AirDate.HasValue && result.Started == firstEpisode.AirDate.Value)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -14,5 +14,8 @@ public class SceneMapping
|
||||
|
||||
[JsonProperty(PropertyName = "Title")]
|
||||
public string SceneName { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "Season")]
|
||||
public int SeasonNumber { get; set; }
|
||||
}
|
||||
}
|
@ -58,6 +58,8 @@ public class Series
|
||||
|
||||
public int UtcOffset { get; set; }
|
||||
|
||||
public DateTime? FirstAired { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Series"/> is hidden.
|
||||
/// </summary>
|
||||
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Migrator.Framework;
|
||||
|
||||
namespace NzbDrone.Services.Service.Migrations
|
||||
{
|
||||
[Migration(20121223)]
|
||||
public class Migration20121223 : Migration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
Database.AddColumn("SceneMappings", new Column("Season", DbType.Int32, ColumnProperty.Null));
|
||||
Database.ExecuteNonQuery("UPDATE SceneMappings SET Season = -1 WHERE Season IS NULL");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -286,6 +286,7 @@
|
||||
<Compile Include="Helpers\HtmlIncludeExtentions.cs" />
|
||||
<Compile Include="Migrations\Migration20120226.cs" />
|
||||
<Compile Include="Migrations\Migration20120229.cs" />
|
||||
<Compile Include="Migrations\Migration20121223.cs" />
|
||||
<Compile Include="Services.PetaPoco.cs" />
|
||||
<Compile Include="Datastore\Connection.cs" />
|
||||
<Compile Include="Controllers\DailySeriesController.cs" />
|
||||
|
@ -69,7 +69,8 @@ public bool Promote(int mappingId)
|
||||
{
|
||||
CleanTitle = pendingItem.CleanTitle,
|
||||
Id = pendingItem.Id,
|
||||
Title = pendingItem.Title
|
||||
Title = pendingItem.Title,
|
||||
Season = -1
|
||||
};
|
||||
|
||||
Insert(mapping);
|
||||
|
@ -13,5 +13,6 @@ public class SceneMapping
|
||||
public string CleanTitle { get; set; }
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public int Season { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user