diff --git a/Marr.Data/MapRepository.cs b/Marr.Data/MapRepository.cs
index c60dc4c09..682fc4729 100644
--- a/Marr.Data/MapRepository.cs
+++ b/Marr.Data/MapRepository.cs
@@ -54,7 +54,7 @@ namespace Marr.Data
// Register a default IReflectionStrategy
ReflectionStrategy = new CachedReflectionStrategy();
-
+
// Register a default type converter for Enums
TypeConverters.Add(typeof(Enum), new Converters.EnumStringConverter());
@@ -180,7 +180,7 @@ namespace Marr.Data
return Relationships[type];
}
-
+
#endregion
#region - Reflection Strategy -
diff --git a/NzbDrone.Api/Calendar/CalendarModule.cs b/NzbDrone.Api/Calendar/CalendarModule.cs
index 68fb8e280..799b98215 100644
--- a/NzbDrone.Api/Calendar/CalendarModule.cs
+++ b/NzbDrone.Api/Calendar/CalendarModule.cs
@@ -11,9 +11,9 @@ namespace NzbDrone.Api.Calendar
{
public class CalendarModule : NzbDroneApiModule
{
- private readonly EpisodeService _episodeService;
+ private readonly IEpisodeService _episodeService;
- public CalendarModule(EpisodeService episodeService)
+ public CalendarModule(IEpisodeService episodeService)
: base("/calendar")
{
_episodeService = episodeService;
diff --git a/NzbDrone.Api/Episodes/EpisodeModule.cs b/NzbDrone.Api/Episodes/EpisodeModule.cs
index 59db1477b..017d61479 100644
--- a/NzbDrone.Api/Episodes/EpisodeModule.cs
+++ b/NzbDrone.Api/Episodes/EpisodeModule.cs
@@ -9,9 +9,9 @@ namespace NzbDrone.Api.Episodes
{
public class EpisodeModule : NzbDroneApiModule
{
- private readonly EpisodeService _episodeService;
+ private readonly IEpisodeService _episodeService;
- public EpisodeModule(EpisodeService episodeService)
+ public EpisodeModule(IEpisodeService episodeService)
: base("/episodes")
{
_episodeService = episodeService;
diff --git a/NzbDrone.Api/Missing/MissingModule.cs b/NzbDrone.Api/Missing/MissingModule.cs
index 354fe8eab..026b9b4ed 100644
--- a/NzbDrone.Api/Missing/MissingModule.cs
+++ b/NzbDrone.Api/Missing/MissingModule.cs
@@ -10,9 +10,9 @@ namespace NzbDrone.Api.Missing
{
public class MissingModule : NzbDroneApiModule
{
- private readonly EpisodeService _episodeService;
+ private readonly IEpisodeService _episodeService;
- public MissingModule(EpisodeService episodeService)
+ public MissingModule(IEpisodeService episodeService)
: base("/missing")
{
_episodeService = episodeService;
diff --git a/NzbDrone.Api/Series/SeriesModule.cs b/NzbDrone.Api/Series/SeriesModule.cs
index 210445953..8057fe368 100644
--- a/NzbDrone.Api/Series/SeriesModule.cs
+++ b/NzbDrone.Api/Series/SeriesModule.cs
@@ -117,7 +117,7 @@ namespace NzbDrone.Api.Series
{
RuleSet("POST", () =>
{
- RuleFor(s => ((ModelBase)s).Id).GreaterThan(0);
+ RuleFor(s => s.Id).GreaterThan(0);
RuleFor(s => s.Path).NotEmpty().Must(_diskProvider.FolderExists);
RuleFor(s => s.QualityProfileId).GreaterThan(0);
});
diff --git a/NzbDrone.Common/UdpProvider.cs b/NzbDrone.Common/UdpProvider.cs
index 2f5727dc7..94956c125 100644
--- a/NzbDrone.Common/UdpProvider.cs
+++ b/NzbDrone.Common/UdpProvider.cs
@@ -56,8 +56,8 @@ namespace NzbDrone.Common
}
else
{
- header[6] = (byte)(((ushort)PacketType.Blob & 0xff00) >> 8);
- header[7] = (byte)((ushort)PacketType.Blob & 0x00ff);
+ header[6] = ((ushort)PacketType.Blob & 0xff00) >> 8;
+ header[7] = (ushort)PacketType.Blob & 0x00ff;
}
header[8] = (byte)((currentPacket & 0xff000000) >> 24);
diff --git a/NzbDrone.Console/app.config b/NzbDrone.Console/app.config
new file mode 100644
index 000000000..a6a2b7fa9
--- /dev/null
+++ b/NzbDrone.Console/app.config
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs
index 6b28557a4..070b82b6f 100644
--- a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs
+++ b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs
@@ -19,7 +19,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.DecisionEngineTests
{
[TestFixture]
-
+
public class UpgradeDiskSpecificationFixture : CoreTest
{
private UpgradeDiskSpecification _upgradeDisk;
@@ -35,8 +35,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
Mocker.Resolve();
_upgradeDisk = Mocker.Resolve();
- firstFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = true, DateAdded = DateTime.Now };
- secondFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = true, DateAdded = DateTime.Now };
+ firstFile = new EpisodeFile { Quality = new QualityModel(Quality.Bluray1080p, true), DateAdded = DateTime.Now };
+ secondFile = new EpisodeFile { Quality = new QualityModel(Quality.Bluray1080p, true), DateAdded = DateTime.Now };
var singleEpisodeList = new List { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = null } };
var doubleEpisodeList = new List { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = secondFile }, new Episode { EpisodeFile = null } };
@@ -66,12 +66,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
private void WithFirstFileUpgradable()
{
- firstFile.Quality = Quality.SDTV;
+ firstFile.Quality = new QualityModel(Quality.SDTV);
}
private void WithSecondFileUpgradable()
{
- secondFile.Quality = Quality.SDTV;
+ secondFile.Quality = new QualityModel(Quality.SDTV);
}
[Test]
@@ -120,8 +120,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_not_be_upgradable_if_qualities_are_the_same()
{
- firstFile.Quality = Quality.WEBDL1080p;
- firstFile.Proper = false;
+ firstFile.Quality = new QualityModel(Quality.WEBDL1080p);
parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false);
_upgradeDisk.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
}
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs
similarity index 94%
rename from NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs
rename to NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs
index 302513e8f..a0e9a9ca9 100644
--- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs
+++ b/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs
@@ -1,9 +1,5 @@
-using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Net;
-using System.Text;
using FluentAssertions;
using Moq;
using NUnit.Framework;
@@ -13,7 +9,7 @@ using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
-namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
+namespace NzbDrone.Core.Test.Download.DownloadClientTests
{
[TestFixture]
public class BlackholeProviderFixture : CoreTest
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs
similarity index 89%
rename from NzbDrone.Core.Test/ProviderTests/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs
rename to NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs
index 9e2bd61c5..8aaed0d77 100644
--- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs
+++ b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs
@@ -1,19 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
+using System;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
-using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Test.Framework;
-using NzbDrone.Test.Common;
-namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTests
+namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetProviderTests
{
public class DownloadNzbFixture : CoreTest
{
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs
similarity index 90%
rename from NzbDrone.Core.Test/ProviderTests/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs
rename to NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs
index ee7324cb1..e081053dd 100644
--- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs
+++ b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs
@@ -1,19 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
+using System;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
-using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Test.Framework;
-using NzbDrone.Test.Common;
-namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTests
+namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetProviderTests
{
public class QueueFixture : CoreTest
{
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs
similarity index 95%
rename from NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs
rename to NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs
index 9655a4f7f..2e49939bf 100644
--- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs
+++ b/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs
@@ -1,9 +1,5 @@
-using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Net;
-using System.Text;
using FluentAssertions;
using Moq;
using NUnit.Framework;
@@ -13,7 +9,7 @@ using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
-namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
+namespace NzbDrone.Core.Test.Download.DownloadClientTests
{
[TestFixture]
public class PneumaticProviderFixture : CoreTest
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs
similarity index 98%
rename from NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs
rename to NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs
index a27643ed4..6e6d79a41 100644
--- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs
+++ b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs
@@ -1,24 +1,19 @@
-
-
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.Configuration;
-using NzbDrone.Core.Download.Clients;
-using NzbDrone.Core.Qualities;
-using NzbDrone.Core.Tv;
-using NzbDrone.Core.Model;
using NzbDrone.Core.Download.Clients.Sabnzbd;
-
+using NzbDrone.Core.Model;
+using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
+using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
-namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
+namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
[TestFixture]
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs
similarity index 97%
rename from NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs
rename to NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs
index 8973b761a..2264b01b5 100644
--- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs
+++ b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs
@@ -1,24 +1,15 @@
-
-
using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
using System.Net;
-using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
-using NzbDrone.Core.Download.Clients;
-using NzbDrone.Core.Model;
using NzbDrone.Core.Download.Clients.Sabnzbd;
-
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
-namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
+namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
[TestFixture]
diff --git a/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs b/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs
new file mode 100644
index 000000000..1758c57f3
--- /dev/null
+++ b/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using FizzWare.NBuilder;
+using Moq;
+using NUnit.Framework;
+using NzbDrone.Core.Download;
+using NzbDrone.Core.Model;
+using NzbDrone.Core.Qualities;
+using NzbDrone.Core.Test.Framework;
+using NzbDrone.Core.Tv;
+
+namespace NzbDrone.Core.Test.Download
+{
+ [TestFixture]
+ public class DownloadServiceFixture : CoreTest
+ {
+ private EpisodeParseResult _parseResult;
+
+ [SetUp]
+ public void Setup()
+ {
+ Mocker.GetMock()
+ .Setup(c => c.GetDownloadClient()).Returns(Mocker.GetMock().Object);
+
+ var episodes = Builder.CreateListOfSize(2)
+ .TheFirst(1).With(s => s.Id = 12)
+ .TheNext(1).With(s => s.Id = 99)
+ .All().With(s => s.SeriesId = 5)
+ .Build().ToList();
+
+ _parseResult = Builder.CreateNew()
+ .With(c => c.Quality = new QualityModel(Quality.DVD, false))
+ .With(c => c.Series = Builder.CreateNew().Build())
+ .With(c => c.EpisodeNumbers = new List { 2 })
+ .With(c => c.Episodes = episodes)
+ .Build();
+ }
+
+ private void WithSuccessfulAdd()
+ {
+ Mocker.GetMock()
+ .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), It.IsAny()))
+ .Returns(true);
+ }
+
+ private void WithFailedAdd()
+ {
+ Mocker.GetMock()
+ .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), It.IsAny()))
+ .Returns(false);
+ }
+
+ [Test]
+ public void Download_report_should_publish_on_grab_event()
+ {
+ WithSuccessfulAdd();
+
+ Subject.DownloadReport(_parseResult);
+
+ VerifyEventPublished();
+ }
+
+ [Test]
+ public void Download_report_should_grab_using_client()
+ {
+ WithSuccessfulAdd();
+
+ Subject.DownloadReport(_parseResult);
+
+ Mocker.GetMock()
+ .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny(), true), Times.Once());
+ }
+
+ [Test]
+ public void Download_report_should_not_publish_on_failed_grab_event()
+ {
+ WithFailedAdd();
+
+ Subject.DownloadReport(_parseResult);
+ VerifyEventNotPublished();
+ }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/NzbDrone.Core.Test/IndexerSearchTests/TestSearch.cs b/NzbDrone.Core.Test/IndexerSearchTests/TestSearch.cs
index c7349614c..5948c88c6 100644
--- a/NzbDrone.Core.Test/IndexerSearchTests/TestSearch.cs
+++ b/NzbDrone.Core.Test/IndexerSearchTests/TestSearch.cs
@@ -18,10 +18,10 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
- public TestSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider,
+ public TestSearch(IEpisodeService episodeService, IDownloadService downloadService,
IIndexerService indexerService, ISceneMappingService sceneMappingService,
IDownloadDirector downloadDirector, ISeriesRepository seriesRepository)
- : base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
+ : base(seriesRepository, episodeService, downloadService, indexerService, sceneMappingService,
downloadDirector)
{
}
diff --git a/NzbDrone.Core.Test/MediaFileTests/EpisodeFileMoverFixture.cs b/NzbDrone.Core.Test/MediaFileTests/EpisodeFileMoverFixture.cs
index 8e1063e9d..57b6cf6d0 100644
--- a/NzbDrone.Core.Test/MediaFileTests/EpisodeFileMoverFixture.cs
+++ b/NzbDrone.Core.Test/MediaFileTests/EpisodeFileMoverFixture.cs
@@ -55,10 +55,10 @@ namespace NzbDrone.Core.Test.MediaFileTests
.Setup(e => e.BuildFilePath(It.IsAny(), fakeEpisode.First().SeasonNumber, filename, ".avi"))
.Returns(fi);
-
+
var result = Subject.MoveEpisodeFile(file, false);
-
+
result.Should().BeNull();
}
@@ -85,8 +85,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
var file = Builder.CreateNew()
.With(f => f.SeriesId = fakeSeries.Id)
.With(f => f.Path = currentFilename)
- .With(f => f.Quality = Quality.WEBDL720p)
- .With(f => f.Proper = false)
+ .With(f => f.Quality = new QualityModel(Quality.WEBDL720p))
.Build();
Mocker.GetMock()
@@ -137,8 +136,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
var file = Builder.CreateNew()
.With(f => f.SeriesId = fakeSeries.Id)
.With(f => f.Path = currentFilename)
- .With(f => f.Quality = Quality.WEBDL720p)
- .With(f => f.Proper = false)
+ .With(f => f.Quality = new QualityModel(Quality.WEBDL720p))
.Build();
Mocker.GetMock()
diff --git a/NzbDrone.Core.Test/MediaFileTests/MediaFileRepositoryFixture.cs b/NzbDrone.Core.Test/MediaFileTests/MediaFileRepositoryFixture.cs
index 865f2d88d..081333bd7 100644
--- a/NzbDrone.Core.Test/MediaFileTests/MediaFileRepositoryFixture.cs
+++ b/NzbDrone.Core.Test/MediaFileTests/MediaFileRepositoryFixture.cs
@@ -4,7 +4,9 @@ using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MediaFiles;
+using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
+using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Test.MediaFileTests
{
@@ -17,9 +19,10 @@ namespace NzbDrone.Core.Test.MediaFileTests
var files = Builder.CreateListOfSize(10)
.All()
.With(c => c.Id = 0)
+ .With(c => c.Quality =new QualityModel(Quality.Bluray720p))
.Random(4)
.With(s => s.SeriesId = 12)
- .Build();
+ .BuildListOfNew();
Db.InsertMany(files);
@@ -70,7 +73,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
.With(f => f.Path = path.NormalizePath())
.Build();
- Subject.Insert(episodeFile);
+ Subject.Insert(episodeFile);
var file = Subject.GetFileByPath(path);
diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
index 1e35c6cbb..f6a2400b9 100644
--- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
+++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
@@ -135,6 +135,13 @@
+
+
+
+
+
+
+
@@ -158,9 +165,6 @@
-
-
-
@@ -176,8 +180,6 @@
-
-
@@ -192,9 +194,7 @@
-
-
@@ -223,7 +223,6 @@
-
@@ -240,7 +239,6 @@
-
diff --git a/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs b/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
index 0f3b20624..e45d77d1b 100644
--- a/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
+++ b/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
@@ -17,7 +17,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.OrganizerTests
{
[TestFixture]
-
+
public class MediaFileProvider_GetNewFilenameTest : CoreTest
{
private Series _series;
@@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
[Test]
public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
{
-
+
@@ -62,17 +62,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result);
}
[Test]
public void GetNewFilename_Episode_Quality_1x05_Dash()
{
-
+
@@ -89,17 +89,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result);
}
[Test]
public void GetNewFilename_Series_Quality_01x05_Space()
{
-
+
@@ -116,17 +116,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("South Park 05x06 [HDTV-720p]", result);
}
[Test]
public void GetNewFilename_Series_s01e05_Space()
{
-
+
@@ -144,17 +144,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("South Park s05e06", result);
}
[Test]
public void GetNewFilename_Series_Episode_s01e05_Periods()
{
-
+
@@ -171,17 +171,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
}
[Test]
public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
{
-
+
@@ -198,17 +198,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result);
}
[Test]
public void GetNewFilename_S01E05_Dash()
{
-
+
@@ -226,17 +226,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("S15E06", result);
}
[Test]
public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
{
-
+
@@ -260,17 +260,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 24)
.Build();
-
- string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result);
}
[Test]
public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
{
-
+
@@ -294,17 +294,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 24)
.Build();
-
- string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result);
}
[Test]
public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
{
-
+
@@ -328,17 +328,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 24)
.Build();
-
- string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result);
}
[Test]
public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
{
-
+
@@ -362,17 +362,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 24)
.Build();
-
- string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result);
}
[Test]
public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
{
-
+
@@ -396,17 +396,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 24)
.Build();
-
- string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
}
[Test]
public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
{
-
+
@@ -430,17 +430,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 24)
.Build();
-
- string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("3x23x24", result);
}
[Test]
public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true()
{
-
+
nameSpecification.IncludeSeriesName = true;
nameSpecification.IncludeEpisodeTitle = true;
@@ -455,17 +455,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = true });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p, true) });
+
+
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]");
}
[Test]
public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true()
{
-
+
nameSpecification.IncludeSeriesName = true;
nameSpecification.IncludeEpisodeTitle = true;
@@ -480,17 +480,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
}
[Test]
public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false()
{
-
+
nameSpecification.IncludeSeriesName = true;
nameSpecification.IncludeEpisodeTitle = true;
@@ -505,17 +505,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = true });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p, true) });
+
+
result.Should().Be("South Park - S15E06 - City Sushi");
}
[Test]
public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order()
{
-
+
nameSpecification.IncludeSeriesName = true;
nameSpecification.IncludeEpisodeTitle = true;
@@ -537,17 +537,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 7)
.Build();
-
- string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
}
[Test]
public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
{
-
+
@@ -564,17 +564,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result);
}
[Test]
public void GetNewFilename_Episode_Quality_1x05_Period()
{
-
+
@@ -591,17 +591,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 6)
.Build();
-
- string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result);
}
[Test]
public void GetNewFilename_UseSceneName_when_sceneName_isNull()
{
-
+
nameSpecification.IncludeSeriesName = false;
nameSpecification.IncludeEpisodeTitle = true;
@@ -622,17 +622,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
.Build();
-
+
string result = Subject.BuildFilename(new List { episode }, _series, episodeFile);
-
+
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
}
[Test]
public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
{
-
+
nameSpecification.IncludeSeriesName = false;
nameSpecification.IncludeEpisodeTitle = true;
@@ -653,17 +653,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
.Build();
-
+
string result = Subject.BuildFilename(new List { episode }, _series, episodeFile);
-
+
result.Should().Be(episodeFile.SceneName);
}
[Test]
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
{
-
+
nameSpecification.IncludeSeriesName = true;
nameSpecification.IncludeEpisodeTitle = true;
@@ -685,17 +685,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 7)
.Build();
-
- string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
}
[Test]
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
{
-
+
nameSpecification.IncludeSeriesName = true;
nameSpecification.IncludeEpisodeTitle = true;
@@ -717,17 +717,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 7)
.Build();
-
- string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
}
[Test]
public void should_have_two_episodeTitles_when_distinct_count_is_two()
{
-
+
nameSpecification.IncludeSeriesName = true;
nameSpecification.IncludeEpisodeTitle = true;
@@ -755,10 +755,10 @@ namespace NzbDrone.Core.Test.OrganizerTests
.With(e => e.EpisodeNumber = 8)
.Build();
-
- string result = Subject.BuildFilename(new List { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
-
+ string result = Subject.BuildFilename(new List { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
+
+
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
}
@@ -787,7 +787,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
.Build();
var result = Subject
- .BuildFilename(episodes, series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
+ .BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV-720p]");
}
@@ -816,7 +816,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
.Build();
var result = Subject
- .BuildFilename(episodes, series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
+ .BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13");
}
@@ -845,7 +845,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
.Build();
var result = Subject
- .BuildFilename(episodes, series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
+ .BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
}
}
diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs
index c6038714a..37f29d96f 100644
--- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs
+++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs
@@ -18,7 +18,7 @@ using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
{
-
+
public class ImportFileFixture : CoreTest
{
public static object[] ImportTestCases =
@@ -70,10 +70,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode });
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, newFile);
-
+
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
}
@@ -87,20 +87,20 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeSeries = Builder.CreateNew().Build();
var fakeEpisode = Builder.CreateNew()
.With(e => e.EpisodeFile = Builder.CreateNew()
- .With(g => g.Quality = (Quality)currentFileQuality)
- .And(g => g.Proper = currentFileProper).Build()
+ .With(g => g.Quality = new QualityModel(currentFileQuality, currentFileProper))
+ .Build()
).Build();
-
+
With80MBFile();
Mocker.GetMock()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode });
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, newFile);
-
+
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
}
@@ -113,7 +113,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeSeries = Builder.CreateNew().Build();
var fakeEpisode = Builder.CreateNew()
.With(c => c.EpisodeFile = Builder.CreateNew()
- .With(e => e.Quality = Quality.Bluray720p).Build()
+ .With(e => e.Quality = new QualityModel(Quality.Bluray720p)).Build()
)
.Build();
@@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode });
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifySkipImport(result, Mocker);
}
@@ -146,10 +146,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile();
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifySkipImport(result, Mocker);
ExceptionVerification.ExpectedWarns(1);
}
@@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile();
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifySkipImport(result, Mocker);
}
@@ -199,10 +199,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(new List());
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifySkipImport(result, Mocker);
}
@@ -214,7 +214,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeSeries = Builder.CreateNew().Build();
var fakeEpisode = Builder.CreateNew()
.With(c => c.EpisodeFile = Builder.CreateNew()
- .With(e => e.Quality = Quality.SDTV).Build()
+ .With(e => e.Quality = new QualityModel(Quality.SDTV)).Build()
)
.Build();
@@ -228,10 +228,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode });
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
Mocker.GetMock().Verify(p => p.DeleteFile(It.IsAny()), Times.Once());
}
@@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeEpisodes = Builder.CreateListOfSize(2)
.All()
.With(e => e.EpisodeFile = Builder.CreateNew()
- .With(f => f.Quality = Quality.SDTV)
+ .With(f => f.Quality = new QualityModel(Quality.SDTV))
.Build())
.Build().ToList();
@@ -260,10 +260,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(fakeEpisodes);
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifyFileImport(result, Mocker, fakeEpisodes[0], SIZE);
Mocker.GetMock().Verify(p => p.DeleteFile(It.IsAny()), Times.Once());
}
@@ -278,12 +278,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeEpisodes = Builder.CreateListOfSize(2)
.All()
.With(e => e.EpisodeFile = Builder.CreateNew()
- .With(f => f.Quality = Quality.Bluray720p)
+ .With(f => f.Quality = new QualityModel(Quality.Bluray720p))
.Build())
.Build().ToList();
//Mocks
-
+
With80MBFile();
Mocker.GetMock()
@@ -293,10 +293,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(fakeEpisodes);
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifySkipImport(result, Mocker);
}
@@ -310,7 +310,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
var fakeEpisodeFiles = Builder.CreateListOfSize(2)
.All()
- .With(e => e.Quality = Quality.SDTV)
+ .With(e => e.Quality = new QualityModel(Quality.SDTV))
.Build();
var fakeEpisode1 = Builder.CreateNew()
@@ -331,10 +331,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.GetMock()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode1, fakeEpisode2 });
-
+
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifyFileImport(result, Mocker, fakeEpisode1, SIZE);
Mocker.GetMock().Verify(p => p.DeleteFile(It.IsAny()), Times.Exactly(2));
}
@@ -358,12 +358,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock()
- .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode});
+ .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode });
+
-
var result = Mocker.Resolve().ImportFile(fakeSeries, fileName);
-
+
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
Mocker.GetMock().Verify(p => p.DeleteFile(It.IsAny()), Times.Never());
}
@@ -377,7 +377,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Build();
const string path = @"C:\Test\Unsorted TV\30 Rock\30.rock.s01e01.pilot.mkv";
-
+
With80MBFile();
Mocker.GetMock().Setup(s => s.GetEpisodesByParseResult(It.IsAny()))
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/ContainsRecentEpisode.cs b/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/ContainsRecentEpisode.cs
deleted file mode 100644
index 053845d72..000000000
--- a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/ContainsRecentEpisode.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using FizzWare.NBuilder;
-using FluentAssertions;
-using NUnit.Framework;
-using NzbDrone.Core.Download;
-using NzbDrone.Core.Tv;
-using NzbDrone.Core.Model;
-using NzbDrone.Core.Test.Framework;
-
-namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
-{
- [TestFixture]
- public class ContainsRecentEpisode : CoreTest
- {
- private Episode _recentEpisode;
- private Episode _oldEpisode;
-
- [SetUp]
- public void Setup()
- {
- _recentEpisode = Builder
- .CreateNew()
- .With(e => e.AirDate = DateTime.Today)
- .Build();
-
- _oldEpisode = Builder
- .CreateNew()
- .With(e => e.AirDate = DateTime.Today.AddDays(-365))
- .Build();
- }
-
- [Test]
- public void should_return_true_if_episode_aired_recently()
- {
- var epr = Builder
- .CreateNew()
- .With(p => p.Episodes = new List
- {
- _recentEpisode
- })
- .Build();
-
- Mocker.Resolve().ContainsRecentEpisode(epr).Should().BeTrue();
- }
-
- [Test]
- public void should_return_true_if_one_episode_aired_recently()
- {
- var epr = Builder
- .CreateNew()
- .With(p => p.Episodes = new List
- {
- _recentEpisode,
- _oldEpisode
- })
- .Build();
-
- Mocker.Resolve().ContainsRecentEpisode(epr).Should().BeTrue();
- }
-
- [Test]
- public void should_return_false_if_episode_did_not_air_recently()
- {
- var epr = Builder
- .CreateNew()
- .With(p => p.Episodes = new List
- {
- _oldEpisode
- })
- .Build();
-
- Mocker.Resolve().ContainsRecentEpisode(epr).Should().BeFalse();
- }
-
- [Test]
- public void should_return_false_if_no_episode_aired_recently()
- {
- var epr = Builder
- .CreateNew()
- .With(p => p.Episodes = new List
- {
- _oldEpisode,
- _oldEpisode
- })
- .Build();
-
- Mocker.Resolve().ContainsRecentEpisode(epr).Should().BeFalse();
- }
- }
-}
diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs
deleted file mode 100644
index 0903a6128..000000000
--- a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using FizzWare.NBuilder;
-using FluentAssertions;
-using Moq;
-using NUnit.Framework;
-using NzbDrone.Core.Configuration;
-using NzbDrone.Core.Download;
-using NzbDrone.Core.Download.Clients;
-using NzbDrone.Core.Download.Clients.Sabnzbd;
-using NzbDrone.Core.Qualities;
-using NzbDrone.Core.Tv;
-using NzbDrone.Core.Model;
-using NzbDrone.Core.Test.Framework;
-
-
-
-namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
-{
- [TestFixture]
- public class DownloadProviderFixture : CoreTest
- {
-
-
- private void SetDownloadClient(DownloadClientType clientType)
- {
- Mocker.GetMock()
- .Setup(c => c.DownloadClient)
- .Returns(clientType);
- }
-
- private EpisodeParseResult SetupParseResult()
- {
- var episodes = Builder.CreateListOfSize(2)
- .TheFirst(1).With(s => s.Id = 12)
- .TheNext(1).With(s => s.Id = 99)
- .All().With(s => s.SeriesId = 5)
- .Build().ToList();
-
- Mocker.GetMock()
- .Setup(c => c.GetEpisodesByParseResult(It.IsAny())).Returns(episodes);
-
- return Builder.CreateNew()
- .With(c => c.Quality = new QualityModel(Quality.DVD, false))
- .With(c => c.Series = Builder.CreateNew().Build())
- .With(c => c.EpisodeNumbers = new List { 2 })
- .With(c => c.Episodes = episodes)
- .Build();
- }
-
- private void WithSuccessfullAdd()
- {
- Mocker.GetMock()
- .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), It.IsAny()))
- .Returns(true);
-
- Mocker.GetMock()
- .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), It.IsAny()))
- .Returns(true);
- }
-
- private void WithFailedAdd()
- {
- Mocker.GetMock()
- .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false))
- .Returns(false);
-
- Mocker.GetMock()
- .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), false))
- .Returns(false);
- }
-
- [Test]
- public void Download_report_should_publish_on_grab_event()
- {
- WithSuccessfullAdd();
- SetDownloadClient(DownloadClientType.Sabnzbd);
-
- var parseResult = SetupParseResult();
-
-
- Subject.DownloadReport(parseResult);
-
-
-
- Mocker.GetMock()
- .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny(), true), Times.Once());
-
- Mocker.GetMock()
- .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny(), true), Times.Never());
-
-
- VerifyEventPublished();
- }
-
- [TestCase(DownloadClientType.Sabnzbd)]
- [TestCase(DownloadClientType.Blackhole)]
- public void Download_report_should_not_publish_grabbed_event(DownloadClientType clientType)
- {
- WithFailedAdd();
- SetDownloadClient(clientType);
-
- var parseResult = SetupParseResult();
-
- Subject.DownloadReport(parseResult);
-
-
- VerifyEventNotPublished();
- }
-
- [Test]
- public void should_return_sab_as_active_client()
- {
- SetDownloadClient(DownloadClientType.Sabnzbd);
- Subject.GetActiveDownloadClient().Should().BeAssignableTo();
- }
-
- [Test]
- public void should_return_blackhole_as_active_client()
- {
- SetDownloadClient(DownloadClientType.Blackhole);
- Subject.GetActiveDownloadClient().Should().BeAssignableTo();
- }
-
-
- }
-}
\ No newline at end of file
diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs
deleted file mode 100644
index 46e48cc05..000000000
--- a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-using System.Linq;
-using FizzWare.NBuilder;
-using FluentAssertions;
-using NUnit.Framework;
-using NzbDrone.Core.Tv;
-using NzbDrone.Core.Test.Framework;
-
-namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
-{
- [TestFixture]
-
- public class GetEpisodeBySceneNumberFixture : DbTest
- {
- private Series _series;
- private Episode _episode;
-
- [SetUp]
- public void Setup()
- {
-
-
- _series = Builder
- .CreateNew()
- .Build();
-
- Db.Insert(_series);
- }
-
- public void WithNullSceneNumbering()
- {
- _episode = Builder
- .CreateNew()
- .With(e => e.SeriesId = _series.Id)
- .Build();
-
- Db.Insert(_episode);
- }
-
- public void WithSceneNumbering()
- {
- _episode = Builder
- .CreateNew()
- .With(e => e.SeriesId = _series.Id)
- .Build();
-
- Db.Insert(_episode);
- }
-
- [Test]
- public void should_return_null_if_no_episodes_in_db()
- {
- Mocker.Resolve().GetEpisodeBySceneNumbering(_series.Id, 1, 1).Should().BeNull();
- }
-
- [Test]
- public void should_return_null_if_no_matching_episode_is_found()
- {
- WithNullSceneNumbering();
- Mocker.Resolve().GetEpisodeBySceneNumbering(_series.Id, 1, 1).Should().BeNull();
- }
-
- [Test]
- public void should_return_episode_if_matching_episode_is_found()
- {
- WithSceneNumbering();
-
- var result = Mocker.Resolve()
- .GetEpisodeBySceneNumbering(_series.Id, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber);
-
- result.Id.Should().Be(_episode.Id);
- }
- }
-}
diff --git a/NzbDrone.Core/Datastore/Migration/Migration20130324.cs b/NzbDrone.Core/Datastore/Migration/Migration20130324.cs
index 0be6fcbf9..27d37e943 100644
--- a/NzbDrone.Core/Datastore/Migration/Migration20130324.cs
+++ b/NzbDrone.Core/Datastore/Migration/Migration20130324.cs
@@ -68,8 +68,7 @@ namespace NzbDrone.Core.Datastore.Migration
Create.TableForModel("EpisodeFiles")
.WithColumn("SeriesId").AsInt32()
.WithColumn("Path").AsString().Unique()
- .WithColumn("Quality").AsInt32()
- .WithColumn("Proper").AsBoolean()
+ .WithColumn("Quality").AsString()
.WithColumn("Size").AsInt64()
.WithColumn("DateAdded").AsDateTime()
.WithColumn("SeasonNumber").AsInt32()
diff --git a/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs
index 2c1a8a168..ea4e6b4a4 100644
--- a/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs
+++ b/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs
@@ -6,13 +6,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
public class NotInQueueSpecification : IFetchableSpecification
{
- private readonly DownloadProvider _downloadProvider;
+ private readonly IProvideDownloadClient _downloadClientProvider;
-
- public NotInQueueSpecification(DownloadProvider downloadProvider)
+ public NotInQueueSpecification(IProvideDownloadClient downloadClientProvider)
{
- _downloadProvider = downloadProvider;
-
+ _downloadClientProvider = downloadClientProvider;
}
public string RejectionReason
@@ -25,7 +23,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
{
- return !_downloadProvider.GetActiveDownloadClient().IsInQueue(subject);
+ return !_downloadClientProvider.GetDownloadClient().IsInQueue(subject);
}
}
diff --git a/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs
index 3260d84b2..064910baa 100644
--- a/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs
+++ b/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs
@@ -29,8 +29,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
foreach (var file in subject.Episodes.Select(c => c.EpisodeFile).Where(c => c != null))
{
- _logger.Trace("Comparing file quality with report. Existing file is {0} proper:{1}", file.Quality, file.Proper);
- if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.QualityProfile, new QualityModel { Quality = file.Quality, Proper = file.Proper }, subject.Quality))
+ _logger.Trace("Comparing file quality with report. Existing file is {0}", file.Quality);
+ if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.QualityProfile, file.Quality, subject.Quality))
return false;
if (subject.Quality.Proper && file.DateAdded < DateTime.Today.AddDays(-7))
diff --git a/NzbDrone.Core/Download/DownloadClientProvider.cs b/NzbDrone.Core/Download/DownloadClientProvider.cs
new file mode 100644
index 000000000..6073edf55
--- /dev/null
+++ b/NzbDrone.Core/Download/DownloadClientProvider.cs
@@ -0,0 +1,54 @@
+using NzbDrone.Core.Configuration;
+using NzbDrone.Core.Download.Clients;
+using NzbDrone.Core.Download.Clients.Nzbget;
+using NzbDrone.Core.Download.Clients.Sabnzbd;
+using NzbDrone.Core.Model;
+
+namespace NzbDrone.Core.Download
+{
+ public interface IProvideDownloadClient
+ {
+ IDownloadClient GetDownloadClient();
+ }
+
+ public class DownloadClientProvider : IProvideDownloadClient
+ {
+
+ private readonly SabProvider _sabProvider;
+ private readonly IConfigService _configService;
+ private readonly BlackholeProvider _blackholeProvider;
+ private readonly PneumaticProvider _pneumaticProvider;
+ private readonly NzbgetProvider _nzbgetProvider;
+
+
+ public DownloadClientProvider(SabProvider sabProvider, IConfigService configService,
+ BlackholeProvider blackholeProvider,
+ PneumaticProvider pneumaticProvider,
+ NzbgetProvider nzbgetProvider)
+ {
+ _sabProvider = sabProvider;
+ _configService = configService;
+ _blackholeProvider = blackholeProvider;
+ _pneumaticProvider = pneumaticProvider;
+ _nzbgetProvider = nzbgetProvider;
+ }
+
+ public IDownloadClient GetDownloadClient()
+ {
+ switch (_configService.DownloadClient)
+ {
+ case DownloadClientType.Blackhole:
+ return _blackholeProvider;
+
+ case DownloadClientType.Pneumatic:
+ return _pneumaticProvider;
+
+ case DownloadClientType.Nzbget:
+ return _nzbgetProvider;
+
+ default:
+ return _sabProvider;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/NzbDrone.Core/Download/DownloadProvider.cs b/NzbDrone.Core/Download/DownloadProvider.cs
deleted file mode 100644
index 0118d37a2..000000000
--- a/NzbDrone.Core/Download/DownloadProvider.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using System;
-using System.Linq;
-using NLog;
-using NzbDrone.Common.Eventing;
-using NzbDrone.Core.Configuration;
-using NzbDrone.Core.Download.Clients;
-using NzbDrone.Core.Download.Clients.Nzbget;
-using NzbDrone.Core.Download.Clients.Sabnzbd;
-using NzbDrone.Core.Model;
-
-namespace NzbDrone.Core.Download
-{
- public interface IDownloadProvider
- {
- bool DownloadReport(EpisodeParseResult parseResult);
- IDownloadClient GetActiveDownloadClient();
- bool ContainsRecentEpisode(EpisodeParseResult parseResult);
- }
-
- public class DownloadProvider : IDownloadProvider
- {
- private readonly SabProvider _sabProvider;
- private readonly IConfigService _configService;
- private readonly BlackholeProvider _blackholeProvider;
- private readonly PneumaticProvider _pneumaticProvider;
- private readonly NzbgetProvider _nzbgetProvider;
- private readonly IEventAggregator _eventAggregator;
- private readonly Logger _logger;
-
-
- public DownloadProvider(SabProvider sabProvider, IConfigService configService,
- BlackholeProvider blackholeProvider,
- PneumaticProvider pneumaticProvider,
- NzbgetProvider nzbgetProvider,
- IEventAggregator eventAggregator, Logger logger)
- {
- _sabProvider = sabProvider;
- _configService = configService;
- _blackholeProvider = blackholeProvider;
- _pneumaticProvider = pneumaticProvider;
- _nzbgetProvider = nzbgetProvider;
- _eventAggregator = eventAggregator;
- _logger = logger;
- }
-
-
- public virtual bool DownloadReport(EpisodeParseResult parseResult)
- {
- var downloadTitle = parseResult.OriginalString;
- if (!_configService.DownloadClientUseSceneName)
- {
- downloadTitle = parseResult.GetDownloadTitle();
- }
-
- var provider = GetActiveDownloadClient();
- var recentEpisode = ContainsRecentEpisode(parseResult);
-
- bool success = provider.DownloadNzb(parseResult.NzbUrl, downloadTitle, recentEpisode);
-
- if (success)
- {
- _logger.Trace("Download added to Queue: {0}", downloadTitle);
- _eventAggregator.Publish(new EpisodeGrabbedEvent(parseResult));
- }
-
- return success;
- }
-
- public virtual IDownloadClient GetActiveDownloadClient()
- {
- switch (_configService.DownloadClient)
- {
- case DownloadClientType.Blackhole:
- return _blackholeProvider;
-
- case DownloadClientType.Pneumatic:
- return _pneumaticProvider;
-
- case DownloadClientType.Nzbget:
- return _nzbgetProvider;
-
- default:
- return _sabProvider;
- }
- }
-
- public virtual bool ContainsRecentEpisode(EpisodeParseResult parseResult)
- {
- return parseResult.Episodes.Any(e => e.AirDate >= DateTime.Today.AddDays(-7));
- }
- }
-}
\ No newline at end of file
diff --git a/NzbDrone.Core/Download/DownloadService.cs b/NzbDrone.Core/Download/DownloadService.cs
new file mode 100644
index 000000000..b5ad09c63
--- /dev/null
+++ b/NzbDrone.Core/Download/DownloadService.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Linq;
+using NLog;
+using NzbDrone.Common.Eventing;
+using NzbDrone.Core.Configuration;
+using NzbDrone.Core.Model;
+
+namespace NzbDrone.Core.Download
+{
+ public interface IDownloadService
+ {
+ bool DownloadReport(EpisodeParseResult parseResult);
+ }
+
+ public class DownloadService : IDownloadService
+ {
+ private readonly IProvideDownloadClient _downloadClientProvider;
+ private readonly IConfigService _configService;
+ private readonly IEventAggregator _eventAggregator;
+ private readonly Logger _logger;
+
+
+ public DownloadService(IProvideDownloadClient downloadClientProvider, IConfigService configService,
+ IEventAggregator eventAggregator, Logger logger)
+ {
+ _downloadClientProvider = downloadClientProvider;
+ _configService = configService;
+ _eventAggregator = eventAggregator;
+ _logger = logger;
+ }
+
+
+ public bool DownloadReport(EpisodeParseResult parseResult)
+ {
+ var downloadTitle = parseResult.OriginalString;
+ if (!_configService.DownloadClientUseSceneName)
+ {
+ downloadTitle = parseResult.GetDownloadTitle();
+ }
+
+ var provider = _downloadClientProvider.GetDownloadClient();
+ var recentEpisode = ContainsRecentEpisode(parseResult);
+
+ bool success = provider.DownloadNzb(parseResult.NzbUrl, downloadTitle, recentEpisode);
+
+ if (success)
+ {
+ _logger.Trace("Download added to Queue: {0}", downloadTitle);
+ _eventAggregator.Publish(new EpisodeGrabbedEvent(parseResult));
+ }
+
+ return success;
+ }
+
+ private static bool ContainsRecentEpisode(EpisodeParseResult parseResult)
+ {
+ return parseResult.Episodes.Any(e => e.AirDate >= DateTime.Today.AddDays(-7));
+ }
+ }
+}
\ No newline at end of file
diff --git a/NzbDrone.Core/IndexerSearch/DailyEpisodeSearch.cs b/NzbDrone.Core/IndexerSearch/DailyEpisodeSearch.cs
index 61b3848a2..bccbecd25 100644
--- a/NzbDrone.Core/IndexerSearch/DailyEpisodeSearch.cs
+++ b/NzbDrone.Core/IndexerSearch/DailyEpisodeSearch.cs
@@ -19,10 +19,10 @@ namespace NzbDrone.Core.IndexerSearch
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
- public DailyEpisodeSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider, IIndexerService indexerService,
+ public DailyEpisodeSearch(IEpisodeService episodeService, IDownloadService downloadService, IIndexerService indexerService,
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
ISeriesRepository seriesRepository)
- : base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
+ : base(seriesRepository, episodeService, downloadService, indexerService, sceneMappingService,
downloadDirector)
{
}
diff --git a/NzbDrone.Core/IndexerSearch/EpisodeSearch.cs b/NzbDrone.Core/IndexerSearch/EpisodeSearch.cs
index af25d7135..7ebb616f8 100644
--- a/NzbDrone.Core/IndexerSearch/EpisodeSearch.cs
+++ b/NzbDrone.Core/IndexerSearch/EpisodeSearch.cs
@@ -18,10 +18,10 @@ namespace NzbDrone.Core.IndexerSearch
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
- public EpisodeSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider, IIndexerService indexerService,
+ public EpisodeSearch(IEpisodeService episodeService, IDownloadService downloadService, IIndexerService indexerService,
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
ISeriesRepository seriesRepository)
- : base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
+ : base(seriesRepository, episodeService, downloadService, indexerService, sceneMappingService,
downloadDirector)
{
}
diff --git a/NzbDrone.Core/IndexerSearch/IndexerSearchBase.cs b/NzbDrone.Core/IndexerSearch/IndexerSearchBase.cs
index 28c57f1df..f21b73483 100644
--- a/NzbDrone.Core/IndexerSearch/IndexerSearchBase.cs
+++ b/NzbDrone.Core/IndexerSearch/IndexerSearchBase.cs
@@ -18,7 +18,7 @@ namespace NzbDrone.Core.IndexerSearch
{
private readonly ISeriesRepository _seriesRepository;
private readonly IEpisodeService _episodeService;
- private readonly IDownloadProvider _downloadProvider;
+ private readonly IDownloadService _downloadService;
private readonly ISceneMappingService _sceneMappingService;
private readonly IDownloadDirector DownloadDirector;
@@ -26,13 +26,13 @@ namespace NzbDrone.Core.IndexerSearch
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
- protected IndexerSearchBase(ISeriesRepository seriesRepository, IEpisodeService episodeService, IDownloadProvider downloadProvider,
+ protected IndexerSearchBase(ISeriesRepository seriesRepository, IEpisodeService episodeService, IDownloadService downloadService,
IIndexerService indexerService, ISceneMappingService sceneMappingService,
IDownloadDirector downloadDirector)
{
_seriesRepository = seriesRepository;
_episodeService = episodeService;
- _downloadProvider = downloadProvider;
+ _downloadService = downloadService;
_indexerService = indexerService;
_sceneMappingService = sceneMappingService;
DownloadDirector = downloadDirector;
@@ -117,7 +117,7 @@ namespace NzbDrone.Core.IndexerSearch
logger.Debug("Found '{0}'. Adding to download queue.", episodeParseResult);
try
{
- if (_downloadProvider.DownloadReport(episodeParseResult))
+ if (_downloadService.DownloadReport(episodeParseResult))
{
return true;
}
diff --git a/NzbDrone.Core/IndexerSearch/PartialSeasonSearch.cs b/NzbDrone.Core/IndexerSearch/PartialSeasonSearch.cs
index a4228bd49..931381881 100644
--- a/NzbDrone.Core/IndexerSearch/PartialSeasonSearch.cs
+++ b/NzbDrone.Core/IndexerSearch/PartialSeasonSearch.cs
@@ -18,10 +18,10 @@ namespace NzbDrone.Core.IndexerSearch
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
- public PartialSeasonSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider, IIndexerService indexerService,
+ public PartialSeasonSearch(IEpisodeService episodeService, IDownloadService downloadService, IIndexerService indexerService,
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
ISeriesRepository seriesRepository)
- : base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
+ : base(seriesRepository, episodeService, downloadService, indexerService, sceneMappingService,
downloadDirector)
{
}
diff --git a/NzbDrone.Core/Jobs/Implementations/EpisodeSearchJob.cs b/NzbDrone.Core/Jobs/Implementations/EpisodeSearchJob.cs
index 39d8af3ba..38a85ef3e 100644
--- a/NzbDrone.Core/Jobs/Implementations/EpisodeSearchJob.cs
+++ b/NzbDrone.Core/Jobs/Implementations/EpisodeSearchJob.cs
@@ -54,7 +54,7 @@ namespace NzbDrone.Core.Jobs.Implementations
return;
}
- if (!_qualityUpgradableSpecification.IsUpgradable(episode.Series.QualityProfile, episode.EpisodeFile.QualityModel))
+ if (!_qualityUpgradableSpecification.IsUpgradable(episode.Series.QualityProfile, episode.EpisodeFile.Quality))
{
logger.Info("Search for {0} was aborted, file in disk meets or exceeds Profile's Cutoff", episode);
notification.CurrentMessage = String.Format("Skipping search for {0}, the file you have is already at cutoff", episode);
diff --git a/NzbDrone.Core/Jobs/Implementations/RssSyncJob.cs b/NzbDrone.Core/Jobs/Implementations/RssSyncJob.cs
index 6e8db02da..4d6d99fa9 100644
--- a/NzbDrone.Core/Jobs/Implementations/RssSyncJob.cs
+++ b/NzbDrone.Core/Jobs/Implementations/RssSyncJob.cs
@@ -13,7 +13,7 @@ namespace NzbDrone.Core.Jobs.Implementations
{
public class RssSyncJob : IJob
{
- private readonly DownloadProvider _downloadProvider;
+ private readonly DownloadService _downloadService;
private readonly IIndexerService _indexerService;
private readonly IDownloadDirector DownloadDirector;
private readonly IConfigService _configService;
@@ -21,9 +21,9 @@ namespace NzbDrone.Core.Jobs.Implementations
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
- public RssSyncJob(DownloadProvider downloadProvider, IIndexerService indexerService, IDownloadDirector downloadDirector, IConfigService configService)
+ public RssSyncJob(DownloadService downloadService, IIndexerService indexerService, IDownloadDirector downloadDirector, IConfigService configService)
{
- _downloadProvider = downloadProvider;
+ _downloadService = downloadService;
_indexerService = indexerService;
DownloadDirector = downloadDirector;
_configService = configService;
@@ -71,7 +71,7 @@ namespace NzbDrone.Core.Jobs.Implementations
{
if (DownloadDirector.GetDownloadDecision(episodeParseResult).Approved)
{
- _downloadProvider.DownloadReport(episodeParseResult);
+ _downloadService.DownloadReport(episodeParseResult);
}
}
catch (Exception e)
diff --git a/NzbDrone.Core/MediaFiles/EpisodeFile.cs b/NzbDrone.Core/MediaFiles/EpisodeFile.cs
index d0eb274d1..38bea3ba8 100644
--- a/NzbDrone.Core/MediaFiles/EpisodeFile.cs
+++ b/NzbDrone.Core/MediaFiles/EpisodeFile.cs
@@ -1,7 +1,5 @@
-using System.Linq;
-using System;
+using System;
using NzbDrone.Core.Datastore;
-using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.MediaFiles
@@ -10,7 +8,7 @@ namespace NzbDrone.Core.MediaFiles
{
public EpisodeFile()
{
-
+
}
public EpisodeFile(EpisodeFile source)
@@ -19,32 +17,17 @@ namespace NzbDrone.Core.MediaFiles
SeriesId = source.SeriesId;
SeasonNumber = source.SeasonNumber;
Path = source.Path;
- Quality = source.Quality;
- Proper = source.Proper;
Size = source.Size;
}
public int SeriesId { get; set; }
public int SeasonNumber { get; set; }
public string Path { get; set; }
- public Quality Quality { get; set; }
- public bool Proper { get; set; }
public long Size { get; set; }
public DateTime DateAdded { get; set; }
public string SceneName { get; set; }
public string ReleaseGroup { get; set; }
- public QualityModel QualityModel
- {
- get
- {
- return new QualityModel(Quality, Proper);
- }
- set
- {
- Quality = value.Quality;
- Proper = value.Proper;
- }
- }
+ public QualityModel Quality { get; set; }
}
}
\ No newline at end of file
diff --git a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs b/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs
index 5a7ef9ba6..248811f0f 100644
--- a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs
+++ b/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs
@@ -80,7 +80,7 @@ namespace NzbDrone.Core.MediaFiles
var parseResult = Parser.ParsePath(episodeFile.Path);
parseResult.Series = series;
- parseResult.Quality = new QualityModel { Quality = episodeFile.Quality, Proper = episodeFile.Proper };
+ parseResult.Quality = episodeFile.Quality;
parseResult.Episodes = episodes;
diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj
index e0cba9cec..743f48ac7 100644
--- a/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/NzbDrone.Core/NzbDrone.Core.csproj
@@ -230,6 +230,7 @@
+
@@ -402,7 +403,7 @@
Code
-
+
Code
diff --git a/NzbDrone.Core/Organizer/FileNameBuilder.cs b/NzbDrone.Core/Organizer/FileNameBuilder.cs
index 427a16bd6..fc10a8202 100644
--- a/NzbDrone.Core/Organizer/FileNameBuilder.cs
+++ b/NzbDrone.Core/Organizer/FileNameBuilder.cs
@@ -118,7 +118,7 @@ namespace NzbDrone.Core.Organizer
{
result += String.Format(" [{0}]", episodeFile.Quality);
- if (episodeFile.Proper)
+ if (episodeFile.Quality.Proper)
result += " [Proper]";
}
diff --git a/NzbDrone.Core/Providers/DiskScanProvider.cs b/NzbDrone.Core/Providers/DiskScanProvider.cs
index 2db056e60..b3cb95931 100644
--- a/NzbDrone.Core/Providers/DiskScanProvider.cs
+++ b/NzbDrone.Core/Providers/DiskScanProvider.cs
@@ -133,7 +133,7 @@ namespace NzbDrone.Core.Providers
}
//Make sure this file is an upgrade for ALL episodes already on disk
- if (episodes.All(e => e.EpisodeFile == null || e.EpisodeFile.QualityModel <= parseResult.Quality))
+ if (episodes.All(e => e.EpisodeFile == null || e.EpisodeFile.Quality <= parseResult.Quality))
{
Logger.Debug("Deleting the existing file(s) on disk to upgrade to: {0}", filePath);
//Do the delete for files where there is already an episode on disk
@@ -152,8 +152,7 @@ namespace NzbDrone.Core.Providers
episodeFile.SeriesId = series.Id;
episodeFile.Path = filePath.NormalizePath();
episodeFile.Size = size;
- episodeFile.Quality = parseResult.Quality.Quality;
- episodeFile.Proper = parseResult.Quality.Proper;
+ episodeFile.Quality = parseResult.Quality;
episodeFile.SeasonNumber = parseResult.SeasonNumber;
episodeFile.SceneName = Path.GetFileNameWithoutExtension(filePath.NormalizePath());
episodeFile.ReleaseGroup = parseResult.ReleaseGroup;
diff --git a/NzbDrone.Core/Providers/Xbmc/EventClientProvider.cs b/NzbDrone.Core/Providers/Xbmc/EventClientProvider.cs
index 0e64424cd..081bcbec6 100644
--- a/NzbDrone.Core/Providers/Xbmc/EventClientProvider.cs
+++ b/NzbDrone.Core/Providers/Xbmc/EventClientProvider.cs
@@ -42,7 +42,7 @@ namespace NzbDrone.Core.Providers.Xbmc
payload[offset++] = (byte)iconType;
for (int i = 0; i < 4; i++)
- payload[offset++] = (byte)0;
+ payload[offset++] = 0;
Array.Copy(icon, 0, payload, caption.Length + message.Length + 7, icon.Length);
diff --git a/NzbDrone.Core/Tv/EpisodeService.cs b/NzbDrone.Core/Tv/EpisodeService.cs
index 96c7aac5a..e90cc980f 100644
--- a/NzbDrone.Core/Tv/EpisodeService.cs
+++ b/NzbDrone.Core/Tv/EpisodeService.cs
@@ -4,19 +4,16 @@ using System.Linq;
using NLog;
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Configuration;
-using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Model;
-using NzbDrone.Core.Providers;
using NzbDrone.Core.Tv.Events;
namespace NzbDrone.Core.Tv
{
public interface IEpisodeService
{
- void AddEpisode(Episode episode);
Episode GetEpisode(int id);
Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber);
Episode GetEpisode(int seriesId, DateTime date);
@@ -33,7 +30,6 @@ namespace NzbDrone.Core.Tv
bool IsFirstOrLastEpisodeOfSeason(int seriesId, int seasonNumber, int episodeNumber);
void SetPostDownloadStatus(List episodeIds, PostDownloadStatusType postDownloadStatus);
void UpdateEpisodes(List episodes);
- Episode GetEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber);
List EpisodesBetweenDates(DateTime start, DateTime end);
}
@@ -63,11 +59,6 @@ namespace NzbDrone.Core.Tv
_logger = logger;
}
- public void AddEpisode(Episode episode)
- {
- episode.Ignored = _seasonRepository.IsIgnored(episode.SeriesId, episode.SeasonNumber);
- _episodeRepository.Insert(episode);
- }
public Episode GetEpisode(int id)
{
@@ -107,7 +98,7 @@ namespace NzbDrone.Core.Tv
return new List();
}
- var episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.AirDate.Value);
+ var episodeInfo = GetEpisode(parseResult.Series.Id, parseResult.AirDate.Value);
if (episodeInfo != null)
{
@@ -129,14 +120,14 @@ namespace NzbDrone.Core.Tv
Episode episodeInfo = null;
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering)
- episodeInfo = GetEpisodeBySceneNumbering(((ModelBase)parseResult.Series).Id, parseResult.SeasonNumber, episodeNumber);
+ episodeInfo = _episodeRepository.GetEpisodeBySceneNumbering(parseResult.Series.Id, parseResult.SeasonNumber, episodeNumber);
if (episodeInfo == null)
{
- episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.SeasonNumber, episodeNumber);
+ episodeInfo = GetEpisode(parseResult.Series.Id, parseResult.SeasonNumber, episodeNumber);
if (episodeInfo == null && parseResult.AirDate != null)
{
- episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.AirDate.Value);
+ episodeInfo = GetEpisode(parseResult.Series.Id, parseResult.AirDate.Value);
}
}
@@ -362,11 +353,6 @@ namespace NzbDrone.Core.Tv
_episodeRepository.UpdateMany(episodes);
}
- public Episode GetEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber)
- {
- return _episodeRepository.GetEpisodeBySceneNumbering(seriesId, seasonNumber, episodeNumber);
- }
-
public List EpisodesBetweenDates(DateTime start, DateTime end)
{
return _episodeRepository.EpisodesBetweenDates(start.ToUniversalTime(), end.ToUniversalTime());
diff --git a/NzbDrone.Core/Tv/QualityModel.cs b/NzbDrone.Core/Tv/QualityModel.cs
index d1b83e483..0fd73afef 100644
--- a/NzbDrone.Core/Tv/QualityModel.cs
+++ b/NzbDrone.Core/Tv/QualityModel.cs
@@ -11,12 +11,13 @@ namespace NzbDrone.Core.Tv
public Boolean Proper { get; set; }
- public QualityModel():this(Quality.Unknown, false)
+ public QualityModel()
+ : this(Quality.Unknown)
{
-
+
}
- public QualityModel(Quality quality, Boolean proper)
+ public QualityModel(Quality quality, Boolean proper = false)
{
Quality = quality;
Proper = proper;
@@ -113,8 +114,8 @@ namespace NzbDrone.Core.Tv
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (QualityModel)) return false;
- return Equals((QualityModel) obj);
+ if (obj.GetType() != typeof(QualityModel)) return false;
+ return Equals((QualityModel)obj);
}
}
}
diff --git a/NzbDrone.Core/Tv/SeriesService.cs b/NzbDrone.Core/Tv/SeriesService.cs
index d27b079da..debff39c5 100644
--- a/NzbDrone.Core/Tv/SeriesService.cs
+++ b/NzbDrone.Core/Tv/SeriesService.cs
@@ -120,7 +120,7 @@ namespace NzbDrone.Core.Tv
foreach (var series in allSeries)
{
//Only update parameters that can be changed in MassEdit
- var edited = editedSeries.Single(s => ((ModelBase)s).Id == series.Id);
+ var edited = editedSeries.Single(s => s.Id == series.Id);
series.QualityProfileId = edited.QualityProfileId;
series.Monitored = edited.Monitored;
series.SeasonFolder = edited.SeasonFolder;