From c6836e0cb1af4dc84e88d0b456468e1e463c4836 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 26 Feb 2013 19:19:22 -0800 Subject: [PATCH] Quality moved to ObjectDb. --- NzbDrone.Api/AutomapperBootstraper.cs | 16 +- .../QualityProfiles/QualityProfilesModule.cs | 8 +- NzbDrone.Api/QualityType/QualityTypeModule.cs | 13 +- .../Resolvers/AllowedToQualitiesResolver.cs | 8 +- NzbDrone.Api/Resolvers/EndTimeResolver.cs | 1 - .../Resolvers/NullableDatetimeToString.cs | 1 - .../Resolvers/QualitiesToAllowedResolver.cs | 10 +- .../Resolvers/QualityTypesToIntResolver.cs | 6 +- NzbDrone.Core.Test/CentralDispatchFixture.cs | 3 +- .../AcceptableSizeSpecificationFixture.cs | 44 ++--- .../AllowedDownloadSpecificationFixture.cs | 1 - ...AllowedReleaseGroupSpecificationFixture.cs | 4 +- ...ityAllowedByProfileSpecificationFixture.cs | 26 +-- .../QualityUpgradeSpecificationFixture.cs | 22 +-- .../UpgradeDiskSpecificationFixture.cs | 20 +-- .../UpgradeHistorySpecificationFixture.cs | 22 +-- .../UpgradePossibleSpecificationFixture.cs | 12 +- NzbDrone.Core.Test/EpisodeParseResultTest.cs | 38 ++--- NzbDrone.Core.Test/Framework/TestDbHelper.cs | 1 - .../HistoryTests/HistoryServiceTest.cs | 18 +- .../IndexerTests/IndexerFixture.cs | 4 +- .../IndexerTests/NzbxFixture.cs | 1 - NzbDrone.Core.Test/NzbDrone.Core.Test.csproj | 8 +- .../ParserTests/QualityParserFixture.cs | 150 ++++++++--------- .../ProviderTests/BannerProviderTest.cs | 1 - .../CleanUpDropFolderFixture.cs | 4 +- .../DiskScanProviderTests/CleanUpFixture.cs | 1 - .../GetVideoFilesFixture.cs | 1 - .../ImportFileFixture.cs | 22 +-- .../MoveEpisodeFileFixture.cs | 12 +- .../SabProviderTests/QueueFixture.cs | 60 +++---- .../SabProviderTests/SabProviderFixture.cs | 1 - .../DownloadProviderFixture.cs | 4 +- .../ProviderTests/GrowlProviderTest.cs | 1 - .../ProviderTests/MediaFileProviderTest.cs | 14 +- .../CleanUpDatabaseFixture.cs | 4 +- .../GetNewFilenameFixture.cs | 56 +++---- .../Metadata/Xbmc_ForEpisodeFile_Fixture.cs | 1 - .../Metadata/Xbmc_ForSeries_Fixture.cs | 1 - .../ProviderTests/MisnamedProviderTest.cs | 22 +-- .../ProviderTests/ProwlProviderTest.cs | 1 - .../ProviderTests/QualityTypeProviderTest.cs | 95 ----------- .../RecycleBinProviderTests/CleanupFixture.cs | 1 - .../DeleteDirectoryFixture.cs | 1 - .../DeleteFileFixture.cs | 1 - .../RecycleBinProviderTests/EmptyFixture.cs | 1 - .../SearchTests/ProcessResultsFixture.cs | 32 ++-- .../GetSceneTvdbMappingsFixture.cs | 1 - .../GetXemSeriesIdsFixture.cs | 1 - .../QualityFixture.cs} | 73 ++++---- .../Qualities/QualityProfileFixture.cs | 44 +++++ .../Qualities/QualitySizeServiceFixture.cs | 59 +++++++ NzbDrone.Core.Test/QualityProfileTest.cs | 158 ------------------ .../EpisodeProviderTest.cs | 10 +- .../QualityModelFixture.cs} | 59 ++++--- NzbDrone.Core.Test/XbmcVersionTests.cs | 1 - NzbDrone.Core/Datastore/CustomeMapper.cs | 10 +- .../AcceptableSizeSpecification.cs | 8 +- .../QualityUpgradeSpecification.cs | 4 +- .../UpgradePossibleSpecification.cs | 5 +- NzbDrone.Core/NzbDrone.Core.csproj | 12 +- NzbDrone.Core/Parser.cs | 44 ++--- NzbDrone.Core/Providers/MediaFileProvider.cs | 8 +- NzbDrone.Core/Providers/QualityProvider.cs | 79 --------- .../Providers/QualityTypeProvider.cs | 74 -------- .../QualityTypes.cs => Qualities/Quality.cs} | 56 +++---- NzbDrone.Core/Qualities/QualityProfile.cs | 13 ++ .../Qualities/QualityProfileRepository.cs | 21 +++ .../Qualities/QualityProfileService.cs | 76 +++++++++ .../QualitySize.cs} | 9 +- .../Qualities/QualitySizeRepository.cs | 26 +++ NzbDrone.Core/Qualities/QualitySizeService.cs | 73 ++++++++ .../Repository/Quality/QualityProfile.cs | 49 ------ .../Repository/Search/SearchHistory.cs | 1 - .../Repository/Search/SearchHistoryItem.cs | 4 +- NzbDrone.Core/Tv/EpisodeFile.cs | 4 +- NzbDrone.Core/Tv/QualityModel.cs | 8 +- NzbDrone.Core/Tv/Series.cs | 2 +- SqlCe/NzbDrone.SqlCe.dll | Bin 4096 -> 4096 bytes 79 files changed, 800 insertions(+), 966 deletions(-) delete mode 100644 NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs rename NzbDrone.Core.Test/{QualityTypesTest.cs => Qualities/QualityFixture.cs} (50%) create mode 100644 NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs create mode 100644 NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs delete mode 100644 NzbDrone.Core.Test/QualityProfileTest.cs rename NzbDrone.Core.Test/{QualityTest.cs => TvTests/QualityModelFixture.cs} (50%) delete mode 100644 NzbDrone.Core/Providers/QualityProvider.cs delete mode 100644 NzbDrone.Core/Providers/QualityTypeProvider.cs rename NzbDrone.Core/{Repository/Quality/QualityTypes.cs => Qualities/Quality.cs} (54%) create mode 100644 NzbDrone.Core/Qualities/QualityProfile.cs create mode 100644 NzbDrone.Core/Qualities/QualityProfileRepository.cs create mode 100644 NzbDrone.Core/Qualities/QualityProfileService.cs rename NzbDrone.Core/{Repository/Quality/QualityType.cs => Qualities/QualitySize.cs} (56%) create mode 100644 NzbDrone.Core/Qualities/QualitySizeRepository.cs create mode 100644 NzbDrone.Core/Qualities/QualitySizeService.cs delete mode 100644 NzbDrone.Core/Repository/Quality/QualityProfile.cs diff --git a/NzbDrone.Api/AutomapperBootstraper.cs b/NzbDrone.Api/AutomapperBootstraper.cs index 783ba9984..8d30bba7d 100644 --- a/NzbDrone.Api/AutomapperBootstraper.cs +++ b/NzbDrone.Api/AutomapperBootstraper.cs @@ -7,7 +7,7 @@ using NzbDrone.Api.Series; using NzbDrone.Api.Upcoming; using NzbDrone.Core.Datastore; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; namespace NzbDrone.Api @@ -19,24 +19,22 @@ public static void InitializeAutomapper() { //QualityProfiles Mapper.CreateMap() - .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityProfileId)) .ForMember(dest => dest.Qualities, opt => opt.ResolveUsing().FromMember(src => src.Allowed)); Mapper.CreateMap() - .ForMember(dest => dest.QualityProfileId, opt => opt.MapFrom(src => src.Id)) .ForMember(dest => dest.Allowed, opt => opt.ResolveUsing().FromMember(src => src.Qualities)); - Mapper.CreateMap() + Mapper.CreateMap() .ForMember(dest => dest.Allowed, opt => opt.Ignore()); - //QualityTypes - Mapper.CreateMap() - .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityTypeId)); + //QualitySize + Mapper.CreateMap() + .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityId)); - Mapper.CreateMap() - .ForMember(dest => dest.QualityTypeId, opt => opt.MapFrom(src => src.Id)); + Mapper.CreateMap() + .ForMember(dest => dest.QualityId, opt => opt.MapFrom(src => src.Id)); //Series Mapper.CreateMap() diff --git a/NzbDrone.Api/QualityProfiles/QualityProfilesModule.cs b/NzbDrone.Api/QualityProfiles/QualityProfilesModule.cs index 17c5c6ebb..6b9d72b52 100644 --- a/NzbDrone.Api/QualityProfiles/QualityProfilesModule.cs +++ b/NzbDrone.Api/QualityProfiles/QualityProfilesModule.cs @@ -4,16 +4,16 @@ using Nancy; using NzbDrone.Api.Extensions; using NzbDrone.Core.Providers; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Api.QualityType; +using NzbDrone.Core.Qualities; namespace NzbDrone.Api.QualityProfiles { public class QualityProfilesModule : NzbDroneApiModule { - private readonly QualityProvider _qualityProvider; + private readonly QualityProfileService _qualityProvider; - public QualityProfilesModule(QualityProvider qualityProvider) + public QualityProfilesModule(QualityProfileService qualityProvider) : base("/QualityProfiles") { _qualityProvider = qualityProvider; @@ -39,7 +39,7 @@ private Response OnPost() { var request = Request.Body.FromJson(); var profile = Mapper.Map(request); - request.Id = _qualityProvider.Add(profile); + request.Id = _qualityProvider.Add(profile).Id; return request.AsResponse(); } diff --git a/NzbDrone.Api/QualityType/QualityTypeModule.cs b/NzbDrone.Api/QualityType/QualityTypeModule.cs index e0f1d1b40..4c9ba2889 100644 --- a/NzbDrone.Api/QualityType/QualityTypeModule.cs +++ b/NzbDrone.Api/QualityType/QualityTypeModule.cs @@ -5,14 +5,15 @@ using NzbDrone.Api.Extensions; using NzbDrone.Api.QualityProfiles; using NzbDrone.Core.Providers; +using NzbDrone.Core.Qualities; namespace NzbDrone.Api.QualityType { public class QualityTypeModule : NzbDroneApiModule { - private readonly QualityTypeProvider _qualityTypeProvider; + private readonly QualitySizeService _qualityTypeProvider; - public QualityTypeModule(QualityTypeProvider qualityTypeProvider) + public QualityTypeModule(QualitySizeService qualityTypeProvider) : base("/QualityTypes") { _qualityTypeProvider = qualityTypeProvider; @@ -26,7 +27,7 @@ private Response PutQualityType() { var model = Request.Body.FromJson(); - var type = Mapper.Map(model); + var type = Mapper.Map(model); _qualityTypeProvider.Update(type); return model.AsResponse(); @@ -36,13 +37,13 @@ private Response PutQualityType() private Response GetQualityType(int id) { var type = _qualityTypeProvider.Get(id); - return Mapper.Map(type).AsResponse(); + return Mapper.Map(type).AsResponse(); } private Response GetQualityType() { - var types = _qualityTypeProvider.All().Where(qualityType => qualityType.QualityTypeId != 0 && qualityType.QualityTypeId != 10).ToList(); - var responseModel = Mapper.Map, List>(types); + var types = _qualityTypeProvider.All().Where(qualityType => qualityType.QualityId != 0 && qualityType.QualityId != 10).ToList(); + var responseModel = Mapper.Map, List>(types); return responseModel.AsResponse(); } diff --git a/NzbDrone.Api/Resolvers/AllowedToQualitiesResolver.cs b/NzbDrone.Api/Resolvers/AllowedToQualitiesResolver.cs index 162914b27..f082e7388 100644 --- a/NzbDrone.Api/Resolvers/AllowedToQualitiesResolver.cs +++ b/NzbDrone.Api/Resolvers/AllowedToQualitiesResolver.cs @@ -3,15 +3,15 @@ using System.Linq; using AutoMapper; using NzbDrone.Api.QualityProfiles; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; namespace NzbDrone.Api.Resolvers { - public class AllowedToQualitiesResolver : ValueResolver, List> + public class AllowedToQualitiesResolver : ValueResolver, List> { - protected override List ResolveCore(List source) + protected override List ResolveCore(List source) { - var qualities = Mapper.Map, List>(QualityTypes.All().Where(q => q.Id > 0).ToList()); + var qualities = Mapper.Map, List>(Quality.All().Where(q => q.Id > 0).ToList()); qualities.ForEach(quality => { diff --git a/NzbDrone.Api/Resolvers/EndTimeResolver.cs b/NzbDrone.Api/Resolvers/EndTimeResolver.cs index 224f61bab..6e078c52f 100644 --- a/NzbDrone.Api/Resolvers/EndTimeResolver.cs +++ b/NzbDrone.Api/Resolvers/EndTimeResolver.cs @@ -3,7 +3,6 @@ using System.Linq; using AutoMapper; using NzbDrone.Api.QualityProfiles; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Tv; namespace NzbDrone.Api.Resolvers diff --git a/NzbDrone.Api/Resolvers/NullableDatetimeToString.cs b/NzbDrone.Api/Resolvers/NullableDatetimeToString.cs index d7138fdbc..d83ef4fbb 100644 --- a/NzbDrone.Api/Resolvers/NullableDatetimeToString.cs +++ b/NzbDrone.Api/Resolvers/NullableDatetimeToString.cs @@ -3,7 +3,6 @@ using System.Linq; using AutoMapper; using NzbDrone.Api.QualityProfiles; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Api.Resolvers { diff --git a/NzbDrone.Api/Resolvers/QualitiesToAllowedResolver.cs b/NzbDrone.Api/Resolvers/QualitiesToAllowedResolver.cs index 901644223..ca8fc399a 100644 --- a/NzbDrone.Api/Resolvers/QualitiesToAllowedResolver.cs +++ b/NzbDrone.Api/Resolvers/QualitiesToAllowedResolver.cs @@ -4,21 +4,21 @@ using System.Text; using AutoMapper; using NzbDrone.Api.QualityProfiles; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; namespace NzbDrone.Api.Resolvers { - public class QualitiesToAllowedResolver : ValueResolver, List> + public class QualitiesToAllowedResolver : ValueResolver, List> { - protected override List ResolveCore(List source) + protected override List ResolveCore(List source) { var ids = source.Where(s => s.Allowed).Select(s => s.Id).ToList(); - var qualityTypes = new List(); + var qualityTypes = new List(); ids.ForEach(id => { - qualityTypes.Add(QualityTypes.FindById(id)); + qualityTypes.Add(Quality.FindById(id)); }); return qualityTypes; diff --git a/NzbDrone.Api/Resolvers/QualityTypesToIntResolver.cs b/NzbDrone.Api/Resolvers/QualityTypesToIntResolver.cs index 673485565..e030b410f 100644 --- a/NzbDrone.Api/Resolvers/QualityTypesToIntResolver.cs +++ b/NzbDrone.Api/Resolvers/QualityTypesToIntResolver.cs @@ -3,13 +3,13 @@ using System.Linq; using System.Text; using AutoMapper; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; namespace NzbDrone.Api.Resolvers { - public class QualityTypesToIntResolver : ValueResolver + public class QualityTypesToIntResolver : ValueResolver { - protected override int ResolveCore(QualityTypes source) + protected override int ResolveCore(Quality source) { return source.Id; } diff --git a/NzbDrone.Core.Test/CentralDispatchFixture.cs b/NzbDrone.Core.Test/CentralDispatchFixture.cs index 95f273d44..92e65ecde 100644 --- a/NzbDrone.Core.Test/CentralDispatchFixture.cs +++ b/NzbDrone.Core.Test/CentralDispatchFixture.cs @@ -12,6 +12,7 @@ using NzbDrone.Core.Jobs; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Metadata; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test @@ -124,7 +125,7 @@ public void metadata_clients_are_initialized() [Test] public void quality_profile_initialized() { - kernel.Resolve().All().Should().HaveCount(2); + kernel.Resolve().All().Should().HaveCount(2); } [Test] diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs index f4a429b24..4bccc0a71 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs @@ -7,12 +7,12 @@ using FluentAssertions; using Moq; using NUnit.Framework; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests @@ -25,7 +25,7 @@ public class AcceptableSizeSpecificationFixture : CoreTest private EpisodeParseResult parseResultSingle; private Series series30minutes; private Series series60minutes; - private QualityType qualityType; + private QualitySize qualityType; [SetUp] public void Setup() @@ -34,7 +34,7 @@ public void Setup() { SeriesTitle = "Title", Language = LanguageType.English, - Quality = new QualityModel(QualityTypes.SDTV, true), + Quality = new QualityModel(Quality.SDTV, true), EpisodeNumbers = new List { 3, 4 }, SeasonNumber = 12, AirDate = DateTime.Now.AddDays(-12).Date @@ -44,7 +44,7 @@ public void Setup() { SeriesTitle = "Title", Language = LanguageType.English, - Quality = new QualityModel(QualityTypes.SDTV, true), + Quality = new QualityModel(Quality.SDTV, true), EpisodeNumbers = new List { 3 }, SeasonNumber = 12, AirDate = DateTime.Now.AddDays(-12).Date @@ -62,10 +62,10 @@ public void Setup() .With(c => c.Runtime = 60) .Build(); - qualityType = Builder.CreateNew() + qualityType = Builder.CreateNew() .With(q => q.MinSize = 0) .With(q => q.MaxSize = 10) - .With(q => q.QualityTypeId = 1) + .With(q => q.QualityId = 1) .Build(); } @@ -78,7 +78,7 @@ public void IsAcceptableSize_true_single_episode_not_first_or_last_30_minute() parseResultSingle.Series = series30minutes; parseResultSingle.Size = 184572800; - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -99,7 +99,7 @@ public void IsAcceptableSize_true_single_episode_not_first_or_last_60_minute() parseResultSingle.Series = series60minutes; parseResultSingle.Size = 368572800; - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -120,7 +120,7 @@ public void IsAcceptableSize_false_single_episode_not_first_or_last_30_minute() parseResultSingle.Series = series30minutes; parseResultSingle.Size = 1.Gigabytes(); - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -141,7 +141,7 @@ public void IsAcceptableSize_false_single_episode_not_first_or_last_60_minute() parseResultSingle.Series = series60minutes; parseResultSingle.Size = 1.Gigabytes(); - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -162,7 +162,7 @@ public void IsAcceptableSize_true_multi_episode_not_first_or_last_30_minute() parseResultMulti.Series = series30minutes; parseResultMulti.Size = 184572800; - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -183,7 +183,7 @@ public void IsAcceptableSize_true_multi_episode_not_first_or_last_60_minute() parseResultMulti.Series = series60minutes; parseResultMulti.Size = 368572800; - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -204,7 +204,7 @@ public void IsAcceptableSize_false_multi_episode_not_first_or_last_30_minute() parseResultMulti.Series = series30minutes; parseResultMulti.Size = 1.Gigabytes(); - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -225,7 +225,7 @@ public void IsAcceptableSize_false_multi_episode_not_first_or_last_60_minute() parseResultMulti.Series = series60minutes; parseResultMulti.Size = 10.Gigabytes(); - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -246,7 +246,7 @@ public void IsAcceptableSize_true_single_episode_first_30_minute() parseResultSingle.Series = series30minutes; parseResultSingle.Size = 184572800; - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -267,7 +267,7 @@ public void IsAcceptableSize_true_single_episode_first_60_minute() parseResultSingle.Series = series60minutes; parseResultSingle.Size = 368572800; - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -288,7 +288,7 @@ public void IsAcceptableSize_false_single_episode_first_30_minute() parseResultSingle.Series = series30minutes; parseResultSingle.Size = 1.Gigabytes(); - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -309,7 +309,7 @@ public void IsAcceptableSize_false_single_episode_first_60_minute() parseResultSingle.Series = series60minutes; parseResultSingle.Size = 10.Gigabytes(); - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -331,7 +331,7 @@ public void IsAcceptableSize_true_unlimited_30_minute() parseResultSingle.Size = 18457280000; qualityType.MaxSize = 0; - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -353,7 +353,7 @@ public void IsAcceptableSize_true_unlimited_60_minute() parseResultSingle.Size = 36857280000; qualityType.MaxSize = 0; - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -376,7 +376,7 @@ public void IsAcceptableSize_should_treat_daily_series_as_single_episode() qualityType.MaxSize = (int)600.Megabytes(); - Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); + Mocker.GetMock().Setup(s => s.Get(1)).Returns(qualityType); Mocker.GetMock().Setup( s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) @@ -394,7 +394,7 @@ public void should_return_true_if_RAWHD() { var parseResult = new EpisodeParseResult { - Quality = new QualityModel(QualityTypes.RAWHD, false) + Quality = new QualityModel(Quality.RAWHD, false) }; Mocker.Resolve().IsSatisfiedBy(parseResult).Should().BeTrue(); diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs index 0480370ee..06e2d5952 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs @@ -11,7 +11,6 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs index 854f89a23..b2468ccc7 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs @@ -8,13 +8,13 @@ using Moq; using NUnit.Framework; using NzbDrone.Core.Configuration; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests @@ -32,7 +32,7 @@ public void Setup() { SeriesTitle = "Title", Language = LanguageType.English, - Quality = new QualityModel(QualityTypes.SDTV, true), + Quality = new QualityModel(Quality.SDTV, true), EpisodeNumbers = new List { 3 }, SeasonNumber = 12, AirDate = DateTime.Now.AddDays(-12).Date, diff --git a/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs index 34573c10c..9ac0fee49 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs @@ -5,11 +5,11 @@ using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests @@ -23,16 +23,16 @@ public class QualityAllowedByProfileSpecificationFixture : CoreTest public static object[] AllowedTestCases = { - new object[] { QualityTypes.DVD }, - new object[] { QualityTypes.HDTV720p }, - new object[] { QualityTypes.Bluray1080p } + new object[] { Quality.DVD }, + new object[] { Quality.HDTV720p }, + new object[] { Quality.Bluray1080p } }; public static object[] DeniedTestCases = { - new object[] { QualityTypes.SDTV }, - new object[] { QualityTypes.WEBDL720p }, - new object[] { QualityTypes.Bluray720p } + new object[] { Quality.SDTV }, + new object[] { Quality.WEBDL720p }, + new object[] { Quality.Bluray720p } }; [SetUp] @@ -41,32 +41,32 @@ public void Setup() _qualityAllowedByProfile = Mocker.Resolve(); var fakeSeries = Builder.CreateNew() - .With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p }) + .With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p }) .Build(); parseResult = new EpisodeParseResult { Series = fakeSeries, - Quality = new QualityModel(QualityTypes.DVD, true), + Quality = new QualityModel(Quality.DVD, true), EpisodeNumbers = new List { 3 }, SeasonNumber = 12, }; } [Test, TestCaseSource("AllowedTestCases")] - public void should_allow_if_quality_is_defined_in_profile(QualityTypes qualityType) + public void should_allow_if_quality_is_defined_in_profile(Quality qualityType) { parseResult.Quality.Quality = qualityType; - parseResult.Series.QualityProfile.Allowed = new List { QualityTypes.DVD, QualityTypes.HDTV720p, QualityTypes.Bluray1080p }; + parseResult.Series.QualityProfile.Allowed = new List { Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p }; _qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeTrue(); } [Test, TestCaseSource("DeniedTestCases")] - public void should_not_allow_if_quality_is_not_defined_in_profile(QualityTypes qualityType) + public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType) { parseResult.Quality.Quality = qualityType; - parseResult.Series.QualityProfile.Allowed = new List { QualityTypes.DVD, QualityTypes.HDTV720p, QualityTypes.Bluray1080p }; + parseResult.Series.QualityProfile.Allowed = new List { Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p }; _qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeFalse(); } diff --git a/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs index f4a064a1c..88231660b 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs @@ -3,10 +3,10 @@ using System.Linq; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.DecisionEngine; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests @@ -17,19 +17,19 @@ public class QualityUpgradeSpecificationFixture : CoreTest { public static object[] IsUpgradeTestCases = { - new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true }, - new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, true, QualityTypes.WEBDL720p, true }, - new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, false, QualityTypes.SDTV, false }, - new object[] { QualityTypes.SDTV, false, QualityTypes.DVD, true, QualityTypes.SDTV, false }, - new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.Bluray720p, false }, - new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.WEBDL720p, false }, - new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false }, - new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true }, - new object[] { QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false } + new object[] { Quality.SDTV, false, Quality.SDTV, true, Quality.SDTV, true }, + new object[] { Quality.WEBDL720p, false, Quality.WEBDL720p, true, Quality.WEBDL720p, true }, + new object[] { Quality.SDTV, false, Quality.SDTV, false, Quality.SDTV, false }, + new object[] { Quality.SDTV, false, Quality.DVD, true, Quality.SDTV, false }, + new object[] { Quality.WEBDL720p, false, Quality.HDTV720p, true, Quality.Bluray720p, false }, + new object[] { Quality.WEBDL720p, false, Quality.HDTV720p, true, Quality.WEBDL720p, false }, + new object[] { Quality.WEBDL720p, false, Quality.WEBDL720p, false, Quality.WEBDL720p, false }, + new object[] { Quality.SDTV, false, Quality.SDTV, true, Quality.SDTV, true }, + new object[] { Quality.WEBDL1080p, false, Quality.WEBDL1080p, false, Quality.WEBDL1080p, false } }; [Test, TestCaseSource("IsUpgradeTestCases")] - public void IsUpgradeTest(QualityTypes current, bool currentProper, QualityTypes newQuality, bool newProper, QualityTypes cutoff, bool expected) + public void IsUpgradeTest(Quality current, bool currentProper, Quality newQuality, bool newProper, Quality cutoff, bool expected) { new QualityUpgradeSpecification().IsSatisfiedBy(new QualityModel(current, currentProper), new QualityModel(newQuality, newProper), cutoff) .Should().Be(expected); diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs index 240a6c9c6..eb62f1225 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs @@ -6,12 +6,12 @@ using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests @@ -33,20 +33,20 @@ public void Setup() Mocker.Resolve(); _upgradeDisk = Mocker.Resolve(); - firstFile = new EpisodeFile { Quality = QualityTypes.Bluray1080p, Proper = true, DateAdded = DateTime.Now }; - secondFile = new EpisodeFile { Quality = QualityTypes.Bluray1080p, Proper = true, DateAdded = DateTime.Now }; + firstFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = true, DateAdded = DateTime.Now }; + secondFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = 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 } }; var fakeSeries = Builder.CreateNew() - .With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p }) + .With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p }) .Build(); parseResultMulti = new EpisodeParseResult { Series = fakeSeries, - Quality = new QualityModel(QualityTypes.DVD, true), + Quality = new QualityModel(Quality.DVD, true), EpisodeNumbers = new List { 3, 4 }, SeasonNumber = 12, Episodes = doubleEpisodeList @@ -55,7 +55,7 @@ public void Setup() parseResultSingle = new EpisodeParseResult { Series = fakeSeries, - Quality = new QualityModel(QualityTypes.DVD, true), + Quality = new QualityModel(Quality.DVD, true), EpisodeNumbers = new List { 3 }, SeasonNumber = 12, Episodes = singleEpisodeList @@ -64,12 +64,12 @@ public void Setup() private void WithFirstFileUpgradable() { - firstFile.Quality = QualityTypes.SDTV; + firstFile.Quality = Quality.SDTV; } private void WithSecondFileUpgradable() { - secondFile.Quality = QualityTypes.SDTV; + secondFile.Quality = Quality.SDTV; } [Test] @@ -118,9 +118,9 @@ public void should_be_not_upgradable_if_only_second_episodes_is_upgradable() [Test] public void should_not_be_upgradable_if_qualities_are_the_same() { - firstFile.Quality = QualityTypes.WEBDL1080p; + firstFile.Quality = Quality.WEBDL1080p; firstFile.Proper = false; - parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false); + parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false); _upgradeDisk.IsSatisfiedBy(parseResultSingle).Should().BeFalse(); } diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs index f38c6f8d0..7d7dcca5e 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs @@ -6,12 +6,12 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.History; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests @@ -42,13 +42,13 @@ public void Setup() }; fakeSeries = Builder.CreateNew() - .With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p }) + .With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p }) .Build(); parseResultMulti = new EpisodeParseResult { Series = fakeSeries, - Quality = new QualityModel(QualityTypes.DVD, true), + Quality = new QualityModel(Quality.DVD, true), EpisodeNumbers = new List { 3, 4 }, SeasonNumber = 12, Episodes = doubleEpisodeList @@ -57,14 +57,14 @@ public void Setup() parseResultSingle = new EpisodeParseResult { Series = fakeSeries, - Quality = new QualityModel(QualityTypes.DVD, true), + Quality = new QualityModel(Quality.DVD, true), EpisodeNumbers = new List { 3 }, SeasonNumber = 12, Episodes = singleEpisodeList }; - firstQuality = new QualityModel(QualityTypes.Bluray1080p, true); - secondQuality = new QualityModel(QualityTypes.Bluray1080p, true); + firstQuality = new QualityModel(Quality.Bluray1080p, true); + secondQuality = new QualityModel(Quality.Bluray1080p, true); Mocker.GetMock().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality); Mocker.GetMock().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 4)).Returns(secondQuality); @@ -73,12 +73,12 @@ public void Setup() private void WithFirstReportUpgradable() { - firstQuality.Quality = QualityTypes.SDTV; + firstQuality.Quality = Quality.SDTV; } private void WithSecondReportUpgradable() { - secondQuality.Quality = QualityTypes.SDTV; + secondQuality.Quality = Quality.SDTV; } @@ -120,9 +120,9 @@ public void should_be_not_upgradable_if_only_second_episodes_is_upgradable() [Test] public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing() { - fakeSeries.QualityProfile = new QualityProfile { Cutoff = QualityTypes.WEBDL1080p }; - parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false); - firstQuality = new QualityModel(QualityTypes.WEBDL1080p, false); + fakeSeries.QualityProfile = new QualityProfile { Cutoff = Quality.WEBDL1080p }; + parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false); + firstQuality = new QualityModel(Quality.WEBDL1080p, false); Mocker.GetMock().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality); diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradePossibleSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/UpgradePossibleSpecificationFixture.cs index f2d958c55..d63634341 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/UpgradePossibleSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/UpgradePossibleSpecificationFixture.cs @@ -5,11 +5,11 @@ using FluentAssertions; using Moq; using NUnit.Framework; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Providers; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests @@ -20,8 +20,8 @@ public class UpgradePossibleSpecificationFixture : CoreTest { private void WithWebdlCutoff() { - var profile = new QualityProfile { Cutoff = QualityTypes.WEBDL720p }; - Mocker.GetMock().Setup(s => s.Get(It.IsAny())).Returns(profile); + var profile = new QualityProfile { Cutoff = Quality.WEBDL720p }; + Mocker.GetMock().Setup(s => s.Get(It.IsAny())).Returns(profile); } private Series _series; @@ -35,7 +35,7 @@ public void SetUp() .Build(); _episodeFile = Builder.CreateNew() - .With(f => f.Quality = QualityTypes.SDTV) + .With(f => f.Quality = Quality.SDTV) .Build(); _episode = Builder.CreateNew() @@ -76,7 +76,7 @@ public void IsUpgradePossible_should_return_false_if_current_episode_is_equal_to { WithWebdlCutoff(); - _episodeFile.Quality = QualityTypes.WEBDL720p; + _episodeFile.Quality = Quality.WEBDL720p; //Act bool result = Mocker.Resolve().IsSatisfiedBy(_episode); @@ -90,7 +90,7 @@ public void IsUpgradePossible_should_return_false_if_current_episode_is_greater_ { WithWebdlCutoff(); - _episodeFile.Quality = QualityTypes.Bluray720p; + _episodeFile.Quality = Quality.Bluray720p; //Act bool result = Mocker.Resolve().IsSatisfiedBy(_episode); diff --git a/NzbDrone.Core.Test/EpisodeParseResultTest.cs b/NzbDrone.Core.Test/EpisodeParseResultTest.cs index d962cde88..594f8b9d8 100644 --- a/NzbDrone.Core.Test/EpisodeParseResultTest.cs +++ b/NzbDrone.Core.Test/EpisodeParseResultTest.cs @@ -4,9 +4,9 @@ using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test @@ -24,7 +24,7 @@ public void tostring_single_season_episode() parseResult.EpisodeNumbers = new List { 3 }; parseResult.FullSeason = false; parseResult.AirDate = null; - parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, false); + parseResult.Quality = new QualityModel(Quality.HDTV720p, false); parseResult.ToString().Should().Be("My Series - S12E03 HDTV-720p"); @@ -39,7 +39,7 @@ public void tostring_single_season_episode_proper() parseResult.EpisodeNumbers = new List { 3 }; parseResult.FullSeason = false; parseResult.AirDate = null; - parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, true); + parseResult.Quality = new QualityModel(Quality.HDTV720p, true); parseResult.ToString().Should().Be("My Series - S12E03 HDTV-720p [proper]"); @@ -54,7 +54,7 @@ public void tostring_multi_season_episode() parseResult.EpisodeNumbers = new List { 3, 4, 5 }; parseResult.FullSeason = false; parseResult.AirDate = null; - parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, false); + parseResult.Quality = new QualityModel(Quality.HDTV720p, false); parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV-720p"); @@ -69,7 +69,7 @@ public void tostring_multi_season_episode_proper() parseResult.EpisodeNumbers = new List { 3, 4, 5 }; parseResult.FullSeason = false; parseResult.AirDate = null; - parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, true); + parseResult.Quality = new QualityModel(Quality.HDTV720p, true); parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV-720p [proper]"); @@ -84,7 +84,7 @@ public void tostring_full_season() parseResult.SeasonNumber = 12; parseResult.FullSeason = true; parseResult.AirDate = null; - parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, false); + parseResult.Quality = new QualityModel(Quality.HDTV720p, false); parseResult.ToString().Should().Be("My Series - Season 12 HDTV-720p"); @@ -99,7 +99,7 @@ public void tostring_full_season_proper() parseResult.SeasonNumber = 12; parseResult.FullSeason = true; parseResult.AirDate = null; - parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, true); + parseResult.Quality = new QualityModel(Quality.HDTV720p, true); parseResult.ToString().Should().Be("My Series - Season 12 HDTV-720p [proper]"); @@ -113,7 +113,7 @@ public void tostring_daily_show() parseResult.SeasonNumber = 12; parseResult.FullSeason = true; parseResult.AirDate = new DateTime(2010, 12, 30); - parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, false); + parseResult.Quality = new QualityModel(Quality.HDTV720p, false); parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV-720p"); @@ -127,7 +127,7 @@ public void tostring_daily_show_proper() parseResult.SeasonNumber = 12; parseResult.FullSeason = true; parseResult.AirDate = new DateTime(2010, 12, 30); - parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, true); + parseResult.Quality = new QualityModel(Quality.HDTV720p, true); parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV-720p [proper]"); @@ -137,17 +137,17 @@ public void tostring_daily_show_proper() public static readonly object[] SabNamingCases = { - new object[] { 1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, false, "My Series Name - 1x02 - My Episode Title [DVD]" }, - new object[] { 1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, true, "My Series Name - 1x02 - My Episode Title [DVD] [Proper]" }, - new object[] { 1, new[] { 2 }, "", QualityTypes.DVD, true, "My Series Name - 1x02 - [DVD] [Proper]" }, - new object[] { 1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV720p, false, "My Series Name - 1x02-1x04 - My Episode Title [HDTV-720p]" }, - new object[] { 1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV720p, true, "My Series Name - 1x02-1x04 - My Episode Title [HDTV-720p] [Proper]" }, - new object[] { 1, new[] { 2, 4 }, "", QualityTypes.HDTV720p, true, "My Series Name - 1x02-1x04 - [HDTV-720p] [Proper]" }, + new object[] { 1, new[] { 2 }, "My Episode Title", Quality.DVD, false, "My Series Name - 1x02 - My Episode Title [DVD]" }, + new object[] { 1, new[] { 2 }, "My Episode Title", Quality.DVD, true, "My Series Name - 1x02 - My Episode Title [DVD] [Proper]" }, + new object[] { 1, new[] { 2 }, "", Quality.DVD, true, "My Series Name - 1x02 - [DVD] [Proper]" }, + new object[] { 1, new[] { 2, 4 }, "My Episode Title", Quality.HDTV720p, false, "My Series Name - 1x02-1x04 - My Episode Title [HDTV-720p]" }, + new object[] { 1, new[] { 2, 4 }, "My Episode Title", Quality.HDTV720p, true, "My Series Name - 1x02-1x04 - My Episode Title [HDTV-720p] [Proper]" }, + new object[] { 1, new[] { 2, 4 }, "", Quality.HDTV720p, true, "My Series Name - 1x02-1x04 - [HDTV-720p] [Proper]" }, }; [Test, TestCaseSource("SabNamingCases")] - public void create_proper_sab_titles(int seasons, int[] episodes, string title, QualityTypes quality, bool proper, string expected) + public void create_proper_sab_titles(int seasons, int[] episodes, string title, Quality quality, bool proper, string expected) { var series = Builder.CreateNew() .With(c => c.Title = "My Series Name") @@ -187,7 +187,7 @@ public string create_proper_sab_season_title(bool proper) var parsResult = new EpisodeParseResult() { AirDate = DateTime.Now, - Quality = new QualityModel(QualityTypes.Bluray720p, proper), + Quality = new QualityModel(Quality.Bluray720p, proper), SeasonNumber = 1, Series = series, EpisodeTitle = "My Episode Title", @@ -213,7 +213,7 @@ public string create_proper_sab_daily_titles(bool proper) var parsResult = new EpisodeParseResult { AirDate = new DateTime(2011, 12, 1), - Quality = new QualityModel(QualityTypes.Bluray720p, proper), + Quality = new QualityModel(Quality.Bluray720p, proper), Series = series, EpisodeTitle = "My Episode Title", Episodes = new List { episode } @@ -242,7 +242,7 @@ public void should_not_repeat_the_same_episode_title() { AirDate = DateTime.Now, EpisodeNumbers = new List { 10, 11 }, - Quality = new QualityModel(QualityTypes.HDTV720p, false), + Quality = new QualityModel(Quality.HDTV720p, false), SeasonNumber = 35, Series = series, Episodes = fakeEpisodes diff --git a/NzbDrone.Core.Test/Framework/TestDbHelper.cs b/NzbDrone.Core.Test/Framework/TestDbHelper.cs index ce6f9a1f8..8ff54d2fa 100644 --- a/NzbDrone.Core.Test/Framework/TestDbHelper.cs +++ b/NzbDrone.Core.Test/Framework/TestDbHelper.cs @@ -9,7 +9,6 @@ using NzbDrone.Core.Datastore; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using PetaPoco; namespace NzbDrone.Core.Test.Framework diff --git a/NzbDrone.Core.Test/HistoryTests/HistoryServiceTest.cs b/NzbDrone.Core.Test/HistoryTests/HistoryServiceTest.cs index d29898c93..93ca0fb4e 100644 --- a/NzbDrone.Core.Test/HistoryTests/HistoryServiceTest.cs +++ b/NzbDrone.Core.Test/HistoryTests/HistoryServiceTest.cs @@ -5,8 +5,8 @@ using NUnit.Framework; using NzbDrone.Core.Datastore; using NzbDrone.Core.History; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HistoryTests @@ -53,7 +53,7 @@ public void GetBestQualityInHistory_single_result() var history = Builder.CreateNew() .With(c => c.Id = 0) - .With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, true)) + .With(h => h.Quality = new QualityModel(Quality.Bluray720p, true)) .With(h => h.Episode = episode) .Build(); @@ -62,7 +62,7 @@ public void GetBestQualityInHistory_single_result() var result = Subject.GetBestQualityInHistory(episode.SeriesId, episode.SeasonNumber, episode.EpisodeNumber); result.Should().NotBeNull(); - result.Quality.Should().Be(QualityTypes.Bluray720p); + result.Quality.Should().Be(Quality.Bluray720p); result.Proper.Should().BeTrue(); } @@ -83,15 +83,15 @@ public void GetBestQualityInHistory_should_return_highest_result() .With(c => c.Id = 0) .With(h => h.Episode = episode) .TheFirst(1) - .With(h => h.Quality = new QualityModel(QualityTypes.DVD, true)) + .With(h => h.Quality = new QualityModel(Quality.DVD, true)) .TheNext(1) - .With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, true)) + .With(h => h.Quality = new QualityModel(Quality.Bluray720p, true)) .TheNext(1) - .With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, true)) + .With(h => h.Quality = new QualityModel(Quality.Bluray720p, true)) .TheNext(1) - .With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, false)) + .With(h => h.Quality = new QualityModel(Quality.Bluray720p, false)) .TheNext(1) - .With(h => h.Quality = new QualityModel(QualityTypes.SDTV, true)) + .With(h => h.Quality = new QualityModel(Quality.SDTV, true)) .Build(); Db.InsertMany(history); @@ -99,7 +99,7 @@ public void GetBestQualityInHistory_should_return_highest_result() var result = Subject.GetBestQualityInHistory(episode.SeriesId, episode.SeasonNumber, episode.EpisodeNumber); result.Should().NotBeNull(); - result.Quality.Should().Be(QualityTypes.Bluray720p); + result.Quality.Should().Be(Quality.Bluray720p); result.Proper.Should().BeTrue(); } diff --git a/NzbDrone.Core.Test/IndexerTests/IndexerFixture.cs b/NzbDrone.Core.Test/IndexerTests/IndexerFixture.cs index 4d41bcbe4..d7ddab46f 100644 --- a/NzbDrone.Core.Test/IndexerTests/IndexerFixture.cs +++ b/NzbDrone.Core.Test/IndexerTests/IndexerFixture.cs @@ -15,8 +15,8 @@ using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Indexers; using NzbDrone.Core.Test.ProviderTests; @@ -82,7 +82,7 @@ public void custom_parser_partial_success() const string title = "Adventure.Inc.S03E19.DVDRip.XviD-OSiTV"; const int season = 3; const int episode = 19; - var quality = QualityTypes.DVD; + var quality = Quality.DVD; const string summary = "My fake summary"; diff --git a/NzbDrone.Core.Test/IndexerTests/NzbxFixture.cs b/NzbDrone.Core.Test/IndexerTests/NzbxFixture.cs index fc2c5d83c..9f7d74174 100644 --- a/NzbDrone.Core.Test/IndexerTests/NzbxFixture.cs +++ b/NzbDrone.Core.Test/IndexerTests/NzbxFixture.cs @@ -15,7 +15,6 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.ProviderTests; using NzbDrone.Test.Common; diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 3ffcefaf7..d61e5701a 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -164,7 +164,7 @@ - + @@ -220,7 +220,7 @@ - + @@ -243,7 +243,7 @@ - + @@ -253,7 +253,7 @@ - + diff --git a/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index 7cc5f7e41..75c8ff519 100644 --- a/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -4,7 +4,7 @@ using System.Linq; using FluentAssertions; using NUnit.Framework; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.ParserTests @@ -15,86 +15,86 @@ public class QualityParserFixture : CoreTest { public static object[] QualityParserCases = { - new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD, false }, - new object[] { "WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD, false }, - new object[] { "WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD, false }, - new object[] { "Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV720p, false }, - new object[] { "this has no extention or periods HDTV", QualityTypes.SDTV, false }, - new object[] { "Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV, false }, - new object[] { "The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD, false }, - new object[] { "The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", QualityTypes.DVD, false }, - new object[] { "The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV, false }, - new object[] { "Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV, false }, - new object[] { "Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL720p, false }, - new object[] { "Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV720p, false }, - new object[] { "Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV720p, false }, - new object[] { "Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV, false }, - new object[] { "Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV, false }, - new object[] { "Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV, false }, - new object[] { "Sonny.With.a.Chance.S02E15", QualityTypes.Unknown, false }, - new object[] { "Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV720p, false }, - new object[] { "Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV720p, false }, - new object[] { "Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p, false }, - new object[] { "Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080p, false }, - new object[] { "Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL720p, false }, - new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD, false }, - new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD, false }, - new object[] { "Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown, false }, - new object[] { "(NZB)", QualityTypes.Unknown, false }, - new object[] { "S07E23 - [HDTV-720p].mkv ", QualityTypes.HDTV720p, false }, - new object[] { "S07E23 - [WEBDL].mkv ", QualityTypes.WEBDL720p, false }, - new object[] { "S07E23.mkv ", QualityTypes.HDTV720p, false }, - new object[] { "S07E23 .avi ", QualityTypes.SDTV, false }, - new object[] { "WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3.-HELLYWOOD.avi", QualityTypes.DVD, false }, - new object[] { "WEEDS.S03E01-06.DUAL.Bluray.AC3.-HELLYWOOD.avi", QualityTypes.Bluray720p, false }, - new object[] { "The Voice S01E11 The Finals 1080i HDTV DD5.1 MPEG2-TrollHD", QualityTypes.RAWHD, false }, - new object[] { "Nikita S02E01 HDTV XviD 2HD", QualityTypes.SDTV, false }, - new object[] { "Gossip Girl S05E11 PROPER HDTV XviD 2HD", QualityTypes.SDTV, true }, - new object[] { "The Jonathan Ross Show S02E08 HDTV x264 FTP", QualityTypes.SDTV, false }, - new object[] { "White.Van.Man.2011.S02E01.WS.PDTV.x264-TLA", QualityTypes.SDTV, false }, - new object[] { "White.Van.Man.2011.S02E01.WS.PDTV.x264-REPACK-TLA", QualityTypes.SDTV, true }, - new object[] { "WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3-REPACK.-HELLYWOOD.avi", QualityTypes.DVD, true }, - new object[] { "Pawn Stars S04E87 REPACK 720p HDTV x264 aAF", QualityTypes.HDTV720p, true }, - new object[] { "The Real Housewives of Vancouver S01E04 DSR x264 2HD", QualityTypes.SDTV, false }, - new object[] { "Vanguard S01E04 Mexicos Death Train DSR x264 MiNDTHEGAP", QualityTypes.SDTV, false }, - new object[] { "Vanguard S01E04 Mexicos Death Train 720p WEB DL", QualityTypes.WEBDL720p, false }, - new object[] { "Hawaii Five 0 S02E21 720p WEB DL DD5 1 H 264", QualityTypes.WEBDL720p, false }, - new object[] { "Castle S04E22 720p WEB DL DD5 1 H 264 NFHD", QualityTypes.WEBDL720p, false }, - new object[] { "Fringe S04E22 720p WEB-DL DD5.1 H264-EbP.mkv", QualityTypes.WEBDL720p, false }, - new object[] { "CSI NY S09E03 1080p WEB DL DD5 1 H264 NFHD", QualityTypes.WEBDL1080p, false }, - new object[] { "Two and a Half Men S10E03 1080p WEB DL DD5 1 H 264 NFHD", QualityTypes.WEBDL1080p, false }, - new object[] { "Criminal.Minds.S08E01.1080p.WEB-DL.DD5.1.H264-NFHD", QualityTypes.WEBDL1080p, false }, - new object[] { "Its.Always.Sunny.in.Philadelphia.S08E01.1080p.WEB-DL.proper.AAC2.0.H.264", QualityTypes.WEBDL1080p, true }, - new object[] { "Two and a Half Men S10E03 1080p WEB DL DD5 1 H 264 REPACK NFHD", QualityTypes.WEBDL1080p, true }, - new object[] { "Glee.S04E09.Swan.Song.1080p.WEB-DL.DD5.1.H.264-ECI", QualityTypes.WEBDL1080p, false }, - new object[] { "Elementary.S01E10.The.Leviathan.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false }, - new object[] { "Glee.S04E10.Glee.Actually.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false }, - new object[] { "The.Big.Bang.Theory.S06E11.The.Santa.Simulation.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false }, - new object[] { "The.Big.Bang.Theory.S06E11.The.Santa.Simulation.1080p.WEB-DL.DD5.1.H.264", QualityTypes.WEBDL1080p, false }, - new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.X264-QCF", QualityTypes.HDTV1080p, false }, - new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.x264-QCF", QualityTypes.HDTV1080p, false }, - new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.proper.X264-QCF", QualityTypes.HDTV1080p, true }, - new object[] { "Dexter - S01E01 - Title [HDTV]", QualityTypes.HDTV720p, false }, - new object[] { "Dexter - S01E01 - Title [HDTV-720p]", QualityTypes.HDTV720p, false }, - new object[] { "Dexter - S01E01 - Title [HDTV-1080p]", QualityTypes.HDTV1080p, false }, - new object[] { "POI S02E11 1080i HDTV DD5.1 MPEG2-TrollHD", QualityTypes.RAWHD, false }, - new object[] { "How I Met Your Mother S01E18 Nothing Good Happens After 2 A.M. 720p HDTV DD5.1 MPEG2-TrollHD", QualityTypes.RAWHD, false } + new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", Quality.DVD, false }, + new object[] { "WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", Quality.DVD, false }, + new object[] { "WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", Quality.DVD, false }, + new object[] { "Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", Quality.HDTV720p, false }, + new object[] { "this has no extention or periods HDTV", Quality.SDTV, false }, + new object[] { "Chuck.S04E05.HDTV.XviD-LOL", Quality.SDTV, false }, + new object[] { "The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", Quality.DVD, false }, + new object[] { "The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", Quality.DVD, false }, + new object[] { "The.Girls.Next.Door.S03E06.HDTV-WiDE", Quality.SDTV, false }, + new object[] { "Degrassi.S10E27.WS.DSR.XviD-2HD", Quality.SDTV, false }, + new object[] { "Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", Quality.WEBDL720p, false }, + new object[] { "Sonny.With.a.Chance.S02E15.720p", Quality.HDTV720p, false }, + new object[] { "Sonny.With.a.Chance.S02E15.mkv", Quality.HDTV720p, false }, + new object[] { "Sonny.With.a.Chance.S02E15.avi", Quality.SDTV, false }, + new object[] { "Sonny.With.a.Chance.S02E15.xvid", Quality.SDTV, false }, + new object[] { "Sonny.With.a.Chance.S02E15.divx", Quality.SDTV, false }, + new object[] { "Sonny.With.a.Chance.S02E15", Quality.Unknown, false }, + new object[] { "Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", Quality.HDTV720p, false }, + new object[] { "Chuck - S22E03 - MoneyBART - HD TV.mkv", Quality.HDTV720p, false }, + new object[] { "Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", Quality.Bluray720p, false }, + new object[] { "Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", Quality.Bluray1080p, false }, + new object[] { "Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", Quality.WEBDL720p, false }, + new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", Quality.DVD, false }, + new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", Quality.DVD, false }, + new object[] { "Law & Order: Special Victims Unit - 11x11 - Quickie", Quality.Unknown, false }, + new object[] { "(NZB)", Quality.Unknown, false }, + new object[] { "S07E23 - [HDTV-720p].mkv ", Quality.HDTV720p, false }, + new object[] { "S07E23 - [WEBDL].mkv ", Quality.WEBDL720p, false }, + new object[] { "S07E23.mkv ", Quality.HDTV720p, false }, + new object[] { "S07E23 .avi ", Quality.SDTV, false }, + new object[] { "WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3.-HELLYWOOD.avi", Quality.DVD, false }, + new object[] { "WEEDS.S03E01-06.DUAL.Bluray.AC3.-HELLYWOOD.avi", Quality.Bluray720p, false }, + new object[] { "The Voice S01E11 The Finals 1080i HDTV DD5.1 MPEG2-TrollHD", Quality.RAWHD, false }, + new object[] { "Nikita S02E01 HDTV XviD 2HD", Quality.SDTV, false }, + new object[] { "Gossip Girl S05E11 PROPER HDTV XviD 2HD", Quality.SDTV, true }, + new object[] { "The Jonathan Ross Show S02E08 HDTV x264 FTP", Quality.SDTV, false }, + new object[] { "White.Van.Man.2011.S02E01.WS.PDTV.x264-TLA", Quality.SDTV, false }, + new object[] { "White.Van.Man.2011.S02E01.WS.PDTV.x264-REPACK-TLA", Quality.SDTV, true }, + new object[] { "WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3-REPACK.-HELLYWOOD.avi", Quality.DVD, true }, + new object[] { "Pawn Stars S04E87 REPACK 720p HDTV x264 aAF", Quality.HDTV720p, true }, + new object[] { "The Real Housewives of Vancouver S01E04 DSR x264 2HD", Quality.SDTV, false }, + new object[] { "Vanguard S01E04 Mexicos Death Train DSR x264 MiNDTHEGAP", Quality.SDTV, false }, + new object[] { "Vanguard S01E04 Mexicos Death Train 720p WEB DL", Quality.WEBDL720p, false }, + new object[] { "Hawaii Five 0 S02E21 720p WEB DL DD5 1 H 264", Quality.WEBDL720p, false }, + new object[] { "Castle S04E22 720p WEB DL DD5 1 H 264 NFHD", Quality.WEBDL720p, false }, + new object[] { "Fringe S04E22 720p WEB-DL DD5.1 H264-EbP.mkv", Quality.WEBDL720p, false }, + new object[] { "CSI NY S09E03 1080p WEB DL DD5 1 H264 NFHD", Quality.WEBDL1080p, false }, + new object[] { "Two and a Half Men S10E03 1080p WEB DL DD5 1 H 264 NFHD", Quality.WEBDL1080p, false }, + new object[] { "Criminal.Minds.S08E01.1080p.WEB-DL.DD5.1.H264-NFHD", Quality.WEBDL1080p, false }, + new object[] { "Its.Always.Sunny.in.Philadelphia.S08E01.1080p.WEB-DL.proper.AAC2.0.H.264", Quality.WEBDL1080p, true }, + new object[] { "Two and a Half Men S10E03 1080p WEB DL DD5 1 H 264 REPACK NFHD", Quality.WEBDL1080p, true }, + new object[] { "Glee.S04E09.Swan.Song.1080p.WEB-DL.DD5.1.H.264-ECI", Quality.WEBDL1080p, false }, + new object[] { "Elementary.S01E10.The.Leviathan.480p.WEB-DL.x264-mSD", Quality.WEBDL480p, false }, + new object[] { "Glee.S04E10.Glee.Actually.480p.WEB-DL.x264-mSD", Quality.WEBDL480p, false }, + new object[] { "The.Big.Bang.Theory.S06E11.The.Santa.Simulation.480p.WEB-DL.x264-mSD", Quality.WEBDL480p, false }, + new object[] { "The.Big.Bang.Theory.S06E11.The.Santa.Simulation.1080p.WEB-DL.DD5.1.H.264", Quality.WEBDL1080p, false }, + new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.X264-QCF", Quality.HDTV1080p, false }, + new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.x264-QCF", Quality.HDTV1080p, false }, + new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.proper.X264-QCF", Quality.HDTV1080p, true }, + new object[] { "Dexter - S01E01 - Title [HDTV]", Quality.HDTV720p, false }, + new object[] { "Dexter - S01E01 - Title [HDTV-720p]", Quality.HDTV720p, false }, + new object[] { "Dexter - S01E01 - Title [HDTV-1080p]", Quality.HDTV1080p, false }, + new object[] { "POI S02E11 1080i HDTV DD5.1 MPEG2-TrollHD", Quality.RAWHD, false }, + new object[] { "How I Met Your Mother S01E18 Nothing Good Happens After 2 A.M. 720p HDTV DD5.1 MPEG2-TrollHD", Quality.RAWHD, false } }; public static object[] SelfQualityParserCases = { - new object[] { QualityTypes.SDTV }, - new object[] { QualityTypes.DVD }, - new object[] { QualityTypes.WEBDL480p }, - new object[] { QualityTypes.HDTV720p }, - new object[] { QualityTypes.WEBDL720p }, - new object[] { QualityTypes.WEBDL1080p }, - new object[] { QualityTypes.Bluray720p }, - new object[] { QualityTypes.Bluray1080p } + new object[] { Quality.SDTV }, + new object[] { Quality.DVD }, + new object[] { Quality.WEBDL480p }, + new object[] { Quality.HDTV720p }, + new object[] { Quality.WEBDL720p }, + new object[] { Quality.WEBDL1080p }, + new object[] { Quality.Bluray720p }, + new object[] { Quality.Bluray1080p } }; [Test, TestCaseSource("QualityParserCases")] - public void quality_parse(string postTitle, QualityTypes quality, bool proper) + public void quality_parse(string postTitle, Quality quality, bool proper) { var result = Parser.ParseQuality(postTitle); result.Quality.Should().Be(quality); @@ -102,7 +102,7 @@ public void quality_parse(string postTitle, QualityTypes quality, bool proper) } [Test, TestCaseSource("SelfQualityParserCases")] - public void parsing_our_own_quality_enum(QualityTypes quality) + public void parsing_our_own_quality_enum(Quality quality) { var fileName = String.Format("My series S01E01 [{0}]", quality); var result = Parser.ParseQuality(fileName); diff --git a/NzbDrone.Core.Test/ProviderTests/BannerProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/BannerProviderTest.cs index 915eaaecc..5e084c109 100644 --- a/NzbDrone.Core.Test/ProviderTests/BannerProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/BannerProviderTest.cs @@ -11,7 +11,6 @@ using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using NzbDrone.Test.Common; diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs index 1b9091586..3c186415f 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs @@ -8,12 +8,12 @@ using Moq; using NUnit.Framework; using NzbDrone.Common; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; using NzbDrone.Test.Common.AutoMoq; @@ -106,7 +106,7 @@ public void should_move_file_if_a_conflict_is_found() Mocker.GetMock().Setup(s => s.GetEpisodesByFileId(episodeFile.EpisodeFileId)) .Returns(episode); - Mocker.GetMock().Setup(s => s.GetNewFilename(It.IsAny>(), series, QualityTypes.Unknown, false, It.IsAny())) + Mocker.GetMock().Setup(s => s.GetNewFilename(It.IsAny>(), series, Quality.Unknown, false, It.IsAny())) .Returns(newFilename); Mocker.GetMock().Setup(s => s.CalculateFilePath(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpFixture.cs index 5e5465770..c1964e3f0 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpFixture.cs @@ -14,7 +14,6 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; using NzbDrone.Test.Common.AutoMoq; diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs index 13973bfe8..5d965c3a0 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs @@ -12,7 +12,6 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; using NzbDrone.Test.Common.AutoMoq; diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs index 81c0797ee..06937256e 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs @@ -6,12 +6,12 @@ using Moq; using NUnit.Framework; using NzbDrone.Common; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; using NzbDrone.Test.Common.AutoMoq; @@ -23,9 +23,9 @@ public class ImportFileFixture : CoreTest { public static object[] ImportTestCases = { - new object[] { QualityTypes.SDTV, false }, - new object[] { QualityTypes.DVD, true }, - new object[] { QualityTypes.HDTV720p, false } + new object[] { Quality.SDTV, false }, + new object[] { Quality.DVD, true }, + new object[] { Quality.HDTV720p, false } }; private readonly long SIZE = 80.Megabytes(); @@ -79,7 +79,7 @@ public void import_new_file_should_succeed() } [Test, TestCaseSource("ImportTestCases")] - public void import_new_file_with_better_same_quality_should_succeed(QualityTypes currentFileQuality, bool currentFileProper) + public void import_new_file_with_better_same_quality_should_succeed(Quality currentFileQuality, bool currentFileProper) { const string newFile = @"WEEDS.S03E01.DUAL.1080p.HELLYWOOD.mkv"; @@ -87,7 +87,7 @@ public void import_new_file_with_better_same_quality_should_succeed(QualityTypes var fakeSeries = Builder.CreateNew().Build(); var fakeEpisode = Builder.CreateNew() .With(e => e.EpisodeFile = Builder.CreateNew() - .With(g => g.Quality = (QualityTypes)currentFileQuality) + .With(g => g.Quality = (Quality)currentFileQuality) .And(g => g.Proper = currentFileProper).Build() ).Build(); @@ -113,7 +113,7 @@ public void import_new_file_episode_has_same_or_better_quality_should_skip(strin var fakeSeries = Builder.CreateNew().Build(); var fakeEpisode = Builder.CreateNew() .With(c => c.EpisodeFile = Builder.CreateNew() - .With(e => e.Quality = QualityTypes.Bluray720p).Build() + .With(e => e.Quality = Quality.Bluray720p).Build() ) .Build(); @@ -214,7 +214,7 @@ public void import_new_file_episode_has_better_quality_than_existing(string file var fakeSeries = Builder.CreateNew().Build(); var fakeEpisode = Builder.CreateNew() .With(c => c.EpisodeFile = Builder.CreateNew() - .With(e => e.Quality = QualityTypes.SDTV).Build() + .With(e => e.Quality = Quality.SDTV).Build() ) .Build(); @@ -247,7 +247,7 @@ public void import_new_multi_part_file_episode_has_equal_or_better_quality_than_ var fakeEpisodes = Builder.CreateListOfSize(2) .All() .With(e => e.EpisodeFile = Builder.CreateNew() - .With(f => f.Quality = QualityTypes.SDTV) + .With(f => f.Quality = Quality.SDTV) .Build()) .Build(); @@ -278,7 +278,7 @@ public void skip_import_new_multi_part_file_episode_existing_has_better_quality( var fakeEpisodes = Builder.CreateListOfSize(2) .All() .With(e => e.EpisodeFile = Builder.CreateNew() - .With(f => f.Quality = QualityTypes.Bluray720p) + .With(f => f.Quality = Quality.Bluray720p) .Build()) .Build(); @@ -310,7 +310,7 @@ public void import_new_multi_part_file_episode_replace_two_files() var fakeEpisodeFiles = Builder.CreateListOfSize(2) .All() - .With(e => e.Quality = QualityTypes.SDTV) + .With(e => e.Quality = Quality.SDTV) .Build(); var fakeEpisode1 = Builder.CreateNew() diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/MoveEpisodeFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/MoveEpisodeFileFixture.cs index c9095879d..feb775aa7 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/MoveEpisodeFileFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/MoveEpisodeFileFixture.cs @@ -10,12 +10,12 @@ using NzbDrone.Common; using NzbDrone.Core.Download; using NzbDrone.Core.ExternalNotification; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; using NzbDrone.Test.Common.AutoMoq; @@ -57,7 +57,7 @@ public void should_not_move_file_if_source_and_destination_are_the_same_path() .Returns(fakeEpisode); Mocker.GetMock() - .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny())) .Returns(filename); Mocker.GetMock() @@ -94,7 +94,7 @@ public void should_use_EpisodeFiles_quality() var file = Builder.CreateNew() .With(f => f.SeriesId = fakeSeries.Id) .With(f => f.Path = currentFilename) - .With(f => f.Quality = QualityTypes.WEBDL720p) + .With(f => f.Quality = Quality.WEBDL720p) .With(f => f.Proper = false) .Build(); @@ -107,7 +107,7 @@ public void should_use_EpisodeFiles_quality() .Returns(fakeEpisode); Mocker.GetMock() - .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny())) .Returns(filename); Mocker.GetMock() @@ -146,7 +146,7 @@ public void should_log_error_and_return_null_when_source_file_does_not_exists() var file = Builder.CreateNew() .With(f => f.SeriesId = fakeSeries.Id) .With(f => f.Path = currentFilename) - .With(f => f.Quality = QualityTypes.WEBDL720p) + .With(f => f.Quality = Quality.WEBDL720p) .With(f => f.Proper = false) .Build(); @@ -159,7 +159,7 @@ public void should_log_error_and_return_null_when_source_file_does_not_exists() .Returns(fakeEpisode); Mocker.GetMock() - .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny())) .Returns(filename); Mocker.GetMock() diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs index 96ebb1b9f..81e7cfafc 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs @@ -9,13 +9,13 @@ using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Core.Configuration; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Model.Sabnzbd; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.DownloadClients; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; @@ -130,7 +130,7 @@ public void is_in_queue_should_find_if_exact_episode_is_in_queue() EpisodeTitle = "Title", EpisodeNumbers = new List { 5 }, SeasonNumber = 1, - Quality = new QualityModel { Quality = QualityTypes.SDTV, Proper = false }, + Quality = new QualityModel { Quality = Quality.SDTV, Proper = false }, Series = new Series { Title = "30 Rock", CleanTitle = Parser.NormalizeTitle("30 Rock") }, }; @@ -147,7 +147,7 @@ public void is_in_queue_should_find_if_exact_daily_episode_is_in_queue() var parseResult = new EpisodeParseResult { - Quality = new QualityModel { Quality = QualityTypes.Bluray720p, Proper = false }, + Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false }, AirDate = new DateTime(2011, 12, 01), Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesType = SeriesType.Daily }, }; @@ -166,7 +166,7 @@ public void is_in_queue_should_find_if_exact_full_season_release_is_in_queue() var parseResult = new EpisodeParseResult { - Quality = new QualityModel { Quality = QualityTypes.Bluray720p, Proper = false }, + Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false }, FullSeason = true, SeasonNumber = 5, Series = new Series { Title = "My Name is earl", CleanTitle = Parser.NormalizeTitle("My Name is earl") }, @@ -179,17 +179,17 @@ public void is_in_queue_should_find_if_exact_full_season_release_is_in_queue() public static object[] DifferentEpisodeCases = { - new object[] { 2, new[] { 5 }, "30 Rock", QualityTypes.Bluray1080p, true }, //Same Series, Different Season, Episode - new object[] { 1, new[] { 6 }, "30 Rock", QualityTypes.Bluray1080p, true }, //Same series, different episodes - new object[] { 1, new[] { 6, 7, 8 }, "30 Rock", QualityTypes.Bluray1080p, true }, //Same series, different episodes - new object[] { 1, new[] { 6 }, "Some other show", QualityTypes.Bluray1080p, true }, //Different series, same season, episode - new object[] { 1, new[] { 5 }, "Rock", QualityTypes.Bluray1080p, true }, //Similar series, same season, episodes - new object[] { 1, new[] { 5 }, "30 Rock", QualityTypes.Bluray720p, false }, //Same series, higher quality - new object[] { 1, new[] { 5 }, "30 Rock", QualityTypes.HDTV720p, true } //Same series, higher quality + new object[] { 2, new[] { 5 }, "30 Rock", Quality.Bluray1080p, true }, //Same Series, Different Season, Episode + new object[] { 1, new[] { 6 }, "30 Rock", Quality.Bluray1080p, true }, //Same series, different episodes + new object[] { 1, new[] { 6, 7, 8 }, "30 Rock", Quality.Bluray1080p, true }, //Same series, different episodes + new object[] { 1, new[] { 6 }, "Some other show", Quality.Bluray1080p, true }, //Different series, same season, episode + new object[] { 1, new[] { 5 }, "Rock", Quality.Bluray1080p, true }, //Similar series, same season, episodes + new object[] { 1, new[] { 5 }, "30 Rock", Quality.Bluray720p, false }, //Same series, higher quality + new object[] { 1, new[] { 5 }, "30 Rock", Quality.HDTV720p, true } //Same series, higher quality }; [Test, TestCaseSource("DifferentEpisodeCases")] - public void IsInQueue_should_not_find_diffrent_episode_queue(int season, int[] episodes, string title, QualityTypes qualityType, bool proper) + public void IsInQueue_should_not_find_diffrent_episode_queue(int season, int[] episodes, string title, Quality qualityType, bool proper) { WithFullQueue(); @@ -209,16 +209,16 @@ public void IsInQueue_should_not_find_diffrent_episode_queue(int season, int[] e public static object[] LowerQualityCases = { - new object[] { 1, new[] { 5 }, "30 Rock", QualityTypes.SDTV, false }, //Same Series, lower quality - new object[] { 1, new[] { 5 }, "30 rocK", QualityTypes.SDTV, false }, //Same Series, different casing - new object[] { 1, new[] { 5 }, "30 RocK", QualityTypes.HDTV720p, false }, //Same Series, same quality - new object[] { 1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV720p, false }, //Same Series, same quality, one different episode - new object[] { 1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV720p, false }, //Same Series, same quality, one different episode - new object[] { 4, new[] { 8 }, "Parks and Recreation", QualityTypes.WEBDL720p, false }, //Same Series, same quality + new object[] { 1, new[] { 5 }, "30 Rock", Quality.SDTV, false }, //Same Series, lower quality + new object[] { 1, new[] { 5 }, "30 rocK", Quality.SDTV, false }, //Same Series, different casing + new object[] { 1, new[] { 5 }, "30 RocK", Quality.HDTV720p, false }, //Same Series, same quality + new object[] { 1, new[] { 5, 6 }, "30 RocK", Quality.HDTV720p, false }, //Same Series, same quality, one different episode + new object[] { 1, new[] { 5, 6 }, "30 RocK", Quality.HDTV720p, false }, //Same Series, same quality, one different episode + new object[] { 4, new[] { 8 }, "Parks and Recreation", Quality.WEBDL720p, false }, //Same Series, same quality }; [Test, TestCaseSource("LowerQualityCases")] - public void IsInQueue_should_find_same_or_lower_quality_episode_queue(int season, int[] episodes, string title, QualityTypes qualityType, bool proper) + public void IsInQueue_should_find_same_or_lower_quality_episode_queue(int season, int[] episodes, string title, Quality qualityType, bool proper) { WithFullQueue(); @@ -238,14 +238,14 @@ public void IsInQueue_should_find_same_or_lower_quality_episode_queue(int season public static object[] DuplicateItemsCases = { - new object[] { 5, new[] { 13 }, "The Big Bang Theory", QualityTypes.SDTV, false }, //Same Series, lower quality - new object[] { 5, new[] { 13 }, "The Big Bang Theory", QualityTypes.HDTV720p, false }, //Same Series, same quality - new object[] { 5, new[] { 13 }, "The Big Bang Theory", QualityTypes.HDTV720p, true }, //Same Series, same quality - new object[] { 5, new[] { 13, 14 }, "The Big Bang Theory", QualityTypes.HDTV720p, false } //Same Series, same quality, one diffrent episode + new object[] { 5, new[] { 13 }, "The Big Bang Theory", Quality.SDTV, false }, //Same Series, lower quality + new object[] { 5, new[] { 13 }, "The Big Bang Theory", Quality.HDTV720p, false }, //Same Series, same quality + new object[] { 5, new[] { 13 }, "The Big Bang Theory", Quality.HDTV720p, true }, //Same Series, same quality + new object[] { 5, new[] { 13, 14 }, "The Big Bang Theory", Quality.HDTV720p, false } //Same Series, same quality, one diffrent episode }; [Test, TestCaseSource("DuplicateItemsCases")] - public void IsInQueue_should_find_items_marked_as_duplicate(int season, int[] episodes, string title, QualityTypes qualityType, bool proper) + public void IsInQueue_should_find_items_marked_as_duplicate(int season, int[] episodes, string title, Quality qualityType, bool proper) { WithFullQueue(); @@ -265,14 +265,14 @@ public void IsInQueue_should_find_items_marked_as_duplicate(int season, int[] ep public static object[] DoubleEpisodeCases = { - new object[] { 3, new[] { 14, 15 }, "My Name Is Earl", QualityTypes.Bluray720p, false }, - new object[] { 3, new[] { 15 }, "My Name Is Earl", QualityTypes.DVD, false }, - new object[] { 3, new[] { 14 }, "My Name Is Earl", QualityTypes.HDTV720p, false }, - new object[] { 3, new[] { 15, 16 }, "My Name Is Earl", QualityTypes.SDTV, false } + new object[] { 3, new[] { 14, 15 }, "My Name Is Earl", Quality.Bluray720p, false }, + new object[] { 3, new[] { 15 }, "My Name Is Earl", Quality.DVD, false }, + new object[] { 3, new[] { 14 }, "My Name Is Earl", Quality.HDTV720p, false }, + new object[] { 3, new[] { 15, 16 }, "My Name Is Earl", Quality.SDTV, false } }; [Test, TestCaseSource("DoubleEpisodeCases")] - public void IsInQueue_should_find_double_episodes_(int season, int[] episodes, string title, QualityTypes qualityType, bool proper) + public void IsInQueue_should_find_double_episodes_(int season, int[] episodes, string title, Quality qualityType, bool proper) { WithFullQueue(); @@ -300,7 +300,7 @@ public void IsInQueue_should_return_false_if_queue_is_empty() EpisodeTitle = "Title", EpisodeNumbers = new List { 1 }, SeasonNumber = 2, - Quality = new QualityModel { Quality = QualityTypes.Bluray1080p, Proper = true }, + Quality = new QualityModel { Quality = Quality.Bluray1080p, Proper = true }, Series = new Series { Title = "Test", CleanTitle = Parser.NormalizeTitle("Test") }, }; diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs index 66584633d..30922d3bc 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs @@ -16,7 +16,6 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.DownloadClients; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs index c8c20f2d2..9e7c75f4b 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs @@ -7,10 +7,10 @@ using NUnit.Framework; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers.DownloadClients; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; // ReSharper disable InconsistentNaming @@ -41,7 +41,7 @@ private EpisodeParseResult SetupParseResult() .Setup(c => c.GetEpisodesByParseResult(It.IsAny())).Returns(episodes); return Builder.CreateNew() - .With(c => c.Quality = new QualityModel(QualityTypes.DVD, false)) + .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) diff --git a/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs index 6954ab326..d1fe4e3ec 100644 --- a/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs @@ -8,7 +8,6 @@ using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; diff --git a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTest.cs index cea5a0634..72c912d04 100644 --- a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTest.cs @@ -9,12 +9,12 @@ using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Core.Configuration; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; @@ -29,12 +29,12 @@ public void get_series_files() { var firstSeriesFiles = Builder.CreateListOfSize(10) .All() - .With(c => c.Quality = QualityTypes.SDTV) + .With(c => c.Quality = Quality.SDTV) .With(s => s.SeriesId = 12).Build(); var secondSeriesFiles = Builder.CreateListOfSize(10) .All() - .With(c => c.Quality = QualityTypes.SDTV) + .With(c => c.Quality = Quality.SDTV) .With(s => s.SeriesId = 20).Build(); @@ -56,14 +56,14 @@ public void get_season_files() { var firstSeriesFiles = Builder.CreateListOfSize(10) .All() - .With(c => c.Quality = QualityTypes.SDTV) + .With(c => c.Quality = Quality.SDTV) .With(s => s.SeriesId = 12) .With(s => s.SeasonNumber = 1) .Build(); var secondSeriesFiles = Builder.CreateListOfSize(10) .All() - .With(c => c.Quality = QualityTypes.SDTV) + .With(c => c.Quality = Quality.SDTV) .With(s => s.SeriesId = 12) .With(s => s.SeasonNumber = 2) .Build(); @@ -150,7 +150,7 @@ public void DeleteEpisodeFile() var episodeFiles = Builder .CreateListOfSize(10) .All() - .With(c => c.Quality = QualityTypes.SDTV) + .With(c => c.Quality = Quality.SDTV) .Build(); @@ -187,7 +187,7 @@ public void GetFileByPath_should_return_EpisodeFile_if_file_exists_in_database() //Setup WithRealDb(); var episodeFile = Builder.CreateNew() - .With(c => c.Quality = QualityTypes.SDTV) + .With(c => c.Quality = Quality.SDTV) .With(f => f.Path = path.NormalizePath()) .Build(); diff --git a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/CleanUpDatabaseFixture.cs b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/CleanUpDatabaseFixture.cs index f62f2a2f7..01af0804a 100644 --- a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/CleanUpDatabaseFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/CleanUpDatabaseFixture.cs @@ -6,12 +6,12 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Configuration; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests @@ -121,7 +121,7 @@ public void DeleteOrphanedEpisodeFiles() var episodeFiles = Builder .CreateListOfSize(10) .All() - .With(e => e.Quality = QualityTypes.DVD) + .With(e => e.Quality = Quality.DVD) .Build(); var episodes = Builder.CreateListOfSize(5).Build(); diff --git a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/GetNewFilenameFixture.cs b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/GetNewFilenameFixture.cs index bc358d64e..500a610bf 100644 --- a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/GetNewFilenameFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/GetNewFilenameFixture.cs @@ -8,11 +8,11 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Configuration; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; @@ -54,7 +54,7 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Dash() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result); @@ -81,7 +81,7 @@ public void GetNewFilename_Episode_Quality_1x05_Dash() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result); @@ -108,7 +108,7 @@ public void GetNewFilename_Series_Quality_01x05_Space() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("South Park 05x06 [HDTV-720p]", result); @@ -136,7 +136,7 @@ public void GetNewFilename_Series_s01e05_Space() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("South Park s05e06", result); @@ -163,7 +163,7 @@ public void GetNewFilename_Series_Episode_s01e05_Periods() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("South.Park.s05e06.City.Sushi", result); @@ -190,7 +190,7 @@ public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result); @@ -218,7 +218,7 @@ public void GetNewFilename_S01E05_Dash() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("S15E06", result); @@ -252,7 +252,7 @@ public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result); @@ -286,7 +286,7 @@ public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result); @@ -320,7 +320,7 @@ public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result); @@ -354,7 +354,7 @@ public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result); @@ -388,7 +388,7 @@ public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("The.Mentalist.-.S03E23-24", result); @@ -422,7 +422,7 @@ public void GetNewFilename_multi_1x05_Repeat_Dash_Period() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("3x23x24", result); @@ -447,7 +447,7 @@ public void GetNewFilename_should_append_proper_when_proper_and_append_quality_i .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, true, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, true, new EpisodeFile()); //Assert result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]"); @@ -472,7 +472,7 @@ public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_q .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]"); @@ -497,7 +497,7 @@ public void GetNewFilename_should_not_append_proper_when_proper_and_append_quali .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, true, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, true, new EpisodeFile()); //Assert result.Should().Be("South Park - S15E06 - City Sushi"); @@ -529,7 +529,7 @@ public void GetNewFilename_should_order_multiple_episode_files_in_numerical_orde .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!"); @@ -556,7 +556,7 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Period() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result); @@ -583,7 +583,7 @@ public void GetNewFilename_Episode_Quality_1x05_Period() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); //Assert Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result); @@ -614,7 +614,7 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNull() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, episodeFile); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, episodeFile); //Assert result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path)); @@ -645,7 +645,7 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNotNull() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, QualityTypes.HDTV720p, false, episodeFile); + string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, episodeFile); //Assert result.Should().Be(episodeFile.SceneName); @@ -677,7 +677,7 @@ public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!"); @@ -709,7 +709,7 @@ public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert result.Should().Be("30 Rock - S06E06-E07 - Hello + World"); @@ -747,7 +747,7 @@ public void should_have_two_episodeTitles_when_distinct_count_is_two() .Build(); //Act - string result = Mocker.Resolve().GetNewFilename(new List { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile()); + string result = Mocker.Resolve().GetNewFilename(new List { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile()); //Assert result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World"); @@ -778,7 +778,7 @@ public void should_use_airDate_if_series_isDaily() .Build(); var result = Mocker.Resolve() - .GetNewFilename(episodes, series, QualityTypes.HDTV720p, false, new EpisodeFile()); + .GetNewFilename(episodes, series, Quality.HDTV720p, false, new EpisodeFile()); result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV-720p]"); } @@ -807,7 +807,7 @@ public void should_use_airDate_if_series_isDaily_no_episode_title() .Build(); var result = Mocker.Resolve() - .GetNewFilename(episodes, series, QualityTypes.HDTV720p, false, new EpisodeFile()); + .GetNewFilename(episodes, series, Quality.HDTV720p, false, new EpisodeFile()); result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13"); } @@ -836,7 +836,7 @@ public void should_set_airdate_to_unknown_if_not_available() .Build(); var result = Mocker.Resolve() - .GetNewFilename(episodes, series, QualityTypes.HDTV720p, false, new EpisodeFile()); + .GetNewFilename(episodes, series, Quality.HDTV720p, false, new EpisodeFile()); result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart"); } } diff --git a/NzbDrone.Core.Test/ProviderTests/Metadata/Xbmc_ForEpisodeFile_Fixture.cs b/NzbDrone.Core.Test/ProviderTests/Metadata/Xbmc_ForEpisodeFile_Fixture.cs index df2aa4023..d08d3121f 100644 --- a/NzbDrone.Core.Test/ProviderTests/Metadata/Xbmc_ForEpisodeFile_Fixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/Metadata/Xbmc_ForEpisodeFile_Fixture.cs @@ -15,7 +15,6 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Metadata; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using NzbDrone.Test.Common; diff --git a/NzbDrone.Core.Test/ProviderTests/Metadata/Xbmc_ForSeries_Fixture.cs b/NzbDrone.Core.Test/ProviderTests/Metadata/Xbmc_ForSeries_Fixture.cs index 3debce93e..d815cee12 100644 --- a/NzbDrone.Core.Test/ProviderTests/Metadata/Xbmc_ForSeries_Fixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/Metadata/Xbmc_ForSeries_Fixture.cs @@ -14,7 +14,6 @@ using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Metadata; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using NzbDrone.Test.Common; diff --git a/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs index 3f7c2f3e0..6a3751afb 100644 --- a/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs @@ -4,10 +4,10 @@ using FluentAssertions; using Moq; using NUnit.Framework; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; @@ -48,11 +48,11 @@ public void no_misnamed_files() .Setup(c => c.EpisodesWithFiles()).Returns(episodes); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) + .Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) .Returns("Title1"); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) + .Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) .Returns("Title2"); //Act @@ -95,11 +95,11 @@ public void all_misnamed_files() .Setup(c => c.EpisodesWithFiles()).Returns(episodes); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) + .Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) .Returns("New Title 1"); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) + .Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) .Returns("New Title 2"); //Act @@ -142,11 +142,11 @@ public void one_misnamed_file() .Setup(c => c.EpisodesWithFiles()).Returns(episodes); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) + .Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) .Returns("New Title 1"); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) + .Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) .Returns("Title2"); //Act @@ -191,11 +191,11 @@ public void misnamed_multi_episode_file() .Setup(c => c.EpisodesWithFiles()).Returns(episodes); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[0], episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) + .Setup(c => c.GetNewFilename(new List { episodes[0], episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) .Returns("New Title 1"); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[2] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) + .Setup(c => c.GetNewFilename(new List { episodes[2] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) .Returns("Title2"); //Act @@ -240,11 +240,11 @@ public void no_misnamed_multi_episode_file() .Setup(c => c.EpisodesWithFiles()).Returns(episodes); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[0], episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) + .Setup(c => c.GetNewFilename(new List { episodes[0], episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0])) .Returns("Title1"); Mocker.GetMock() - .Setup(c => c.GetNewFilename(new List { episodes[2] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) + .Setup(c => c.GetNewFilename(new List { episodes[2] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1])) .Returns("Title2"); //Act diff --git a/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs index 3a8f4819f..ee2981739 100644 --- a/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs @@ -7,7 +7,6 @@ using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; using NzbDrone.Test.Common.AutoMoq; diff --git a/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs deleted file mode 100644 index fe06b6a54..000000000 --- a/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs +++ /dev/null @@ -1,95 +0,0 @@ -// ReSharper disable RedundantUsingDirective - -using System.Collections.Generic; - -using FizzWare.NBuilder; -using FluentAssertions; -using NUnit.Framework; -using NzbDrone.Core.Providers; -using NzbDrone.Core.Repository.Quality; -using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common.AutoMoq; - -namespace NzbDrone.Core.Test.ProviderTests -{ - [TestFixture] - // ReSharper disable InconsistentNaming - public class QualityTypeProviderTest : SqlCeTest - { - [SetUp] - public void SetuUp() - { - WithRealDb(); - } - - [Test] - public void SetupDefault_should_add_all_profiles() - { - Mocker.Resolve(); - - - var types = Mocker.Resolve().All(); - - types.Should().HaveCount(10); - types.Should().Contain(e => e.Name == "SDTV" && e.QualityTypeId == 1); - types.Should().Contain(e => e.Name == "DVD" && e.QualityTypeId == 2); - types.Should().Contain(e => e.Name == "WEBDL-480p" && e.QualityTypeId == 8); - types.Should().Contain(e => e.Name == "HDTV-720p" && e.QualityTypeId == 4); - types.Should().Contain(e => e.Name == "HDTV-1080p" && e.QualityTypeId == 9); - types.Should().Contain(e => e.Name == "Raw-HD" && e.QualityTypeId == 10); - types.Should().Contain(e => e.Name == "WEBDL-720p" && e.QualityTypeId == 5); - types.Should().Contain(e => e.Name == "WEBDL-1080p" && e.QualityTypeId == 3); - types.Should().Contain(e => e.Name == "Bluray720p" && e.QualityTypeId == 6); - types.Should().Contain(e => e.Name == "Bluray1080p" && e.QualityTypeId == 7); - } - - [Test] - public void SetupDefault_already_exists_should_insert_missing() - { - - Db.Insert(new QualityType { QualityTypeId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 }); - - - Mocker.Resolve(); - - - var types = Mocker.Resolve().All(); - - types.Should().HaveCount(QualityTypes.All().Count - 1); - } - - [Test] - public void GetList_single_quality_type() - { - var fakeQualityTypes = Builder.CreateListOfSize(6) - .Build(); - - var ids = new List { 1 }; - - Db.InsertMany(fakeQualityTypes); - - - var result = Mocker.Resolve().GetList(ids); - - - result.Should().HaveCount(ids.Count); - } - - [Test] - public void GetList_multiple_quality_type() - { - var fakeQualityTypes = Builder.CreateListOfSize(6) - .Build(); - - var ids = new List { 1, 2 }; - - Db.InsertMany(fakeQualityTypes); - - - var result = Mocker.Resolve().GetList(ids); - - - result.Should().HaveCount(ids.Count); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs index 117180fb8..73bae6228 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs @@ -15,7 +15,6 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using PetaPoco; diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs index 1201b755a..35da6fbc8 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs @@ -15,7 +15,6 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using PetaPoco; diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs index ba9e08aa3..5c334642e 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs @@ -15,7 +15,6 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using PetaPoco; diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs index 39684b9f5..4f675d522 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs @@ -15,7 +15,6 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using PetaPoco; diff --git a/NzbDrone.Core.Test/ProviderTests/SearchTests/ProcessResultsFixture.cs b/NzbDrone.Core.Test/ProviderTests/SearchTests/ProcessResultsFixture.cs index 1c4511e8f..cc1f255fa 100644 --- a/NzbDrone.Core.Test/ProviderTests/SearchTests/ProcessResultsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/SearchTests/ProcessResultsFixture.cs @@ -7,6 +7,7 @@ using Moq; using NUnit.Framework; using NzbDrone.Core.Download; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Model.Notification; @@ -14,7 +15,6 @@ using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Providers.Search; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Search; using NzbDrone.Test.Common; @@ -113,17 +113,17 @@ public void should_process_higher_quality_results_first() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) - .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) + .With(c => c.Quality = new QualityModel(Quality.DVD, true)) .With(c => c.Age = 10) .Random(1) - .With(c => c.Quality = new QualityModel(QualityTypes.Bluray1080p, true)) + .With(c => c.Quality = new QualityModel(Quality.Bluray1080p, true)) .With(c => c.Age = 100) .Build() .ToList(); Mocker.GetMock() - .Setup(s => s.IsSatisfiedBy(It.Is(d => d.Quality.Quality == QualityTypes.Bluray1080p))) + .Setup(s => s.IsSatisfiedBy(It.Is(d => d.Quality.Quality == Quality.Bluray1080p))) .Returns(ReportRejectionType.None); var result = Mocker.Resolve().ProcessReports(_matchingSeries, new { }, parseResults, _searchHistory, _notification); @@ -147,7 +147,7 @@ public void should_process_newer_reports_first() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) - .With(c => c.Quality = new QualityModel(QualityTypes.Bluray1080p, true)) + .With(c => c.Quality = new QualityModel(Quality.Bluray1080p, true)) .With(c => c.Age = 300) .Build() .ToList(); @@ -177,7 +177,7 @@ public void should_check_other_reports_when_quality_is_not_wanted() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) - .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) + .With(c => c.Quality = new QualityModel(Quality.DVD, true)) .Build() .ToList(); @@ -199,7 +199,7 @@ public void should_should_skip_if_series_is_not_watched() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) - .With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false)) + .With(e => e.Quality = new QualityModel(Quality.HDTV720p, false)) .Build() .ToList(); @@ -223,7 +223,7 @@ public void should_skip_if_series_does_not_match_searched_series() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) - .With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false)) + .With(e => e.Quality = new QualityModel(Quality.HDTV720p, false)) .Build() .ToList(); @@ -247,7 +247,7 @@ public void should_skip_if_episode_was_already_downloaded() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 5 }) - .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) + .With(c => c.Quality = new QualityModel(Quality.DVD, true)) .TheLast(1) .With(e => e.EpisodeNumbers = new List { 1, 2, 3, 4, 5 }) .Build() @@ -275,9 +275,9 @@ public void should_try_next_report_if_download_fails() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) - .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) + .With(c => c.Quality = new QualityModel(Quality.DVD, true)) .TheLast(1) - .With(c => c.Quality = new QualityModel(QualityTypes.SDTV, true)) + .With(c => c.Quality = new QualityModel(Quality.SDTV, true)) .Build() .ToList(); @@ -285,11 +285,11 @@ public void should_try_next_report_if_download_fails() WithQualityNeeded(); Mocker.GetMock() - .Setup(s => s.DownloadReport(It.Is(d => d.Quality.Quality == QualityTypes.DVD))) + .Setup(s => s.DownloadReport(It.Is(d => d.Quality.Quality == Quality.DVD))) .Returns(false); Mocker.GetMock() - .Setup(s => s.DownloadReport(It.Is(d => d.Quality.Quality == QualityTypes.SDTV))) + .Setup(s => s.DownloadReport(It.Is(d => d.Quality.Quality == Quality.SDTV))) .Returns(true); //Act @@ -310,10 +310,10 @@ public void should_return_valid_successes_when_one_or_more_downloaded() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) - .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) + .With(c => c.Quality = new QualityModel(Quality.DVD, true)) .With(c => c.Age = 10) .Random(1) - .With(c => c.Quality = new QualityModel(QualityTypes.Bluray1080p, true)) + .With(c => c.Quality = new QualityModel(Quality.Bluray1080p, true)) .With(c => c.Age = 100) .Build() .ToList(); @@ -322,7 +322,7 @@ public void should_return_valid_successes_when_one_or_more_downloaded() WithSuccessfulDownload(); Mocker.GetMock() - .Setup(s => s.IsSatisfiedBy(It.Is(d => d.Quality.Quality == QualityTypes.Bluray1080p))) + .Setup(s => s.IsSatisfiedBy(It.Is(d => d.Quality.Quality == Quality.Bluray1080p))) .Returns(ReportRejectionType.None); //Act diff --git a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs index f5ffc95ae..5d544f2ff 100644 --- a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs @@ -10,7 +10,6 @@ using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using NzbDrone.Test.Common; diff --git a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs index 55c6885de..141a044de 100644 --- a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs @@ -10,7 +10,6 @@ using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; using NzbDrone.Test.Common; diff --git a/NzbDrone.Core.Test/QualityTypesTest.cs b/NzbDrone.Core.Test/Qualities/QualityFixture.cs similarity index 50% rename from NzbDrone.Core.Test/QualityTypesTest.cs rename to NzbDrone.Core.Test/Qualities/QualityFixture.cs index ce598cc02..141c6fd37 100644 --- a/NzbDrone.Core.Test/QualityTypesTest.cs +++ b/NzbDrone.Core.Test/Qualities/QualityFixture.cs @@ -1,47 +1,44 @@ -using System; -using System.Collections.Generic; -using System.IO; +using System.Linq; using FluentAssertions; using NUnit.Framework; -using NzbDrone.Core.Model; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; -namespace NzbDrone.Core.Test +namespace NzbDrone.Core.Test.Qualities { [TestFixture] // ReSharper disable InconsistentNaming - public class QualityTypesTest : CoreTest + public class QualityFixture : CoreTest { public static object[] FromIntCases = { - new object[] {1, QualityTypes.SDTV}, - new object[] {2, QualityTypes.DVD}, - new object[] {4, QualityTypes.HDTV720p}, - new object[] {5, QualityTypes.WEBDL720p}, - new object[] {6, QualityTypes.Bluray720p}, - new object[] {7, QualityTypes.Bluray1080p} + new object[] {1, Quality.SDTV}, + new object[] {2, Quality.DVD}, + new object[] {4, Quality.HDTV720p}, + new object[] {5, Quality.WEBDL720p}, + new object[] {6, Quality.Bluray720p}, + new object[] {7, Quality.Bluray1080p} }; public static object[] ToIntCases = { - new object[] {QualityTypes.SDTV, 1}, - new object[] {QualityTypes.DVD, 2}, - new object[] {QualityTypes.HDTV720p, 4}, - new object[] {QualityTypes.WEBDL720p, 5}, - new object[] {QualityTypes.Bluray720p, 6}, - new object[] {QualityTypes.Bluray1080p, 7} + new object[] {Quality.SDTV, 1}, + new object[] {Quality.DVD, 2}, + new object[] {Quality.HDTV720p, 4}, + new object[] {Quality.WEBDL720p, 5}, + new object[] {Quality.Bluray720p, 6}, + new object[] {Quality.Bluray1080p, 7} }; [Test, TestCaseSource("FromIntCases")] - public void should_be_able_to_convert_int_to_qualityTypes(int source, QualityTypes expected) + public void should_be_able_to_convert_int_to_qualityTypes(int source, Quality expected) { - var quality = (QualityTypes)source; + var quality = (Quality)source; quality.Should().Be(expected); } [Test, TestCaseSource("ToIntCases")] - public void should_be_able_to_convert_qualityTypes_to_int(QualityTypes source, int expected) + public void should_be_able_to_convert_qualityTypes_to_int(Quality source, int expected) { var i = (int)source; i.Should().Be(expected); @@ -51,8 +48,8 @@ public void should_be_able_to_convert_qualityTypes_to_int(QualityTypes source, i [Test] public void Icomparer_greater_test() { - var first = QualityTypes.DVD; - var second = QualityTypes.Bluray1080p; + var first = Quality.DVD; + var second = Quality.Bluray1080p; second.Should().BeGreaterThan(first); } @@ -60,8 +57,8 @@ public void Icomparer_greater_test() [Test] public void Icomparer_lesser() { - var first = QualityTypes.DVD; - var second = QualityTypes.Bluray1080p; + var first = Quality.DVD; + var second = Quality.Bluray1080p; first.Should().BeLessThan(second); } @@ -69,8 +66,8 @@ public void Icomparer_lesser() [Test] public void equal_operand() { - var first = QualityTypes.Bluray1080p; - var second = QualityTypes.Bluray1080p; + var first = Quality.Bluray1080p; + var second = Quality.Bluray1080p; (first == second).Should().BeTrue(); (first >= second).Should().BeTrue(); @@ -80,8 +77,8 @@ public void equal_operand() [Test] public void equal_operand_false() { - var first = QualityTypes.Bluray1080p; - var second = QualityTypes.Unknown; + var first = Quality.Bluray1080p; + var second = Quality.Unknown; (first == second).Should().BeFalse(); } @@ -89,8 +86,8 @@ public void equal_operand_false() [Test] public void not_equal_operand() { - var first = QualityTypes.Bluray1080p; - var second = QualityTypes.Bluray1080p; + var first = Quality.Bluray1080p; + var second = Quality.Bluray1080p; (first != second).Should().BeFalse(); } @@ -98,8 +95,8 @@ public void not_equal_operand() [Test] public void not_equal_operand_false() { - var first = QualityTypes.Bluray1080p; - var second = QualityTypes.Unknown; + var first = Quality.Bluray1080p; + var second = Quality.Unknown; (first != second).Should().BeTrue(); } @@ -107,8 +104,8 @@ public void not_equal_operand_false() [Test] public void greater_operand() { - var first = QualityTypes.DVD; - var second = QualityTypes.Bluray1080p; + var first = Quality.DVD; + var second = Quality.Bluray1080p; (first < second).Should().BeTrue(); (first <= second).Should().BeTrue(); @@ -117,8 +114,8 @@ public void greater_operand() [Test] public void lesser_operand() { - var first = QualityTypes.DVD; - var second = QualityTypes.Bluray1080p; + var first = Quality.DVD; + var second = Quality.Bluray1080p; (second > first).Should().BeTrue(); (second >= first).Should().BeTrue(); diff --git a/NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs b/NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs new file mode 100644 index 000000000..34c001304 --- /dev/null +++ b/NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs @@ -0,0 +1,44 @@ +// ReSharper disable RedundantUsingDirective + +using System.Linq; +using System; +using System.Collections.Generic; +using FizzWare.NBuilder; +using FluentAssertions; +using Moq; +using NUnit.Framework; +using NzbDrone.Core.Qualities; +using NzbDrone.Core.Tv; +using NzbDrone.Core.Test.Framework; + +namespace NzbDrone.Core.Test.Qualities +{ + [TestFixture] + // ReSharper disable InconsistentNaming + public class QualityProfileFixture : CoreTest + { + [Test] + public void Init_should_add_two_profiles() + { + Subject.Init(); + + Mocker.GetMock() + .Verify(v => v.Insert(It.IsAny()), Times.Exactly(2)); + } + + [Test] + //This confirms that new profiles are added only if no other profiles exists. + //We don't want to keep adding them back if a user deleted them on purpose. + public void Init_should_skip_if_any_profiles_already_exist() + { + Mocker.GetMock() + .Setup(s => s.All()) + .Returns(Builder.CreateListOfSize(2).Build().ToList()); + + Subject.Init(); + + Mocker.GetMock() + .Verify(v => v.Insert(It.IsAny()), Times.Never()); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs b/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs new file mode 100644 index 000000000..945b18363 --- /dev/null +++ b/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs @@ -0,0 +1,59 @@ +// ReSharper disable RedundantUsingDirective + +using System.Linq; +using System.Collections.Generic; +using FizzWare.NBuilder; +using FluentAssertions; +using Moq; +using NUnit.Framework; +using NzbDrone.Core.Qualities; +using NzbDrone.Core.Test.Framework; + +namespace NzbDrone.Core.Test.Qualities +{ + [TestFixture] + // ReSharper disable InconsistentNaming + public class QualitySizeServiceFixture : CoreTest + { + [Test] + public void Init_should_add_all_sizes() + { + Subject.Init(); + + Mocker.GetMock() + .Verify(v => v.Insert(It.IsAny()), Times.Exactly(Quality.All().Count - 1)); + + //Todo: Should we validate each was inserted exactly as configured? + + //var types = Mocker.Resolve().All(); + + //types.Should().HaveCount(10); + //types.Should().Contain(e => e.Name == "SDTV" && e.QualityId == 1); + //types.Should().Contain(e => e.Name == "DVD" && e.QualityId == 2); + //types.Should().Contain(e => e.Name == "WEBDL-480p" && e.QualityId == 8); + //types.Should().Contain(e => e.Name == "HDTV-720p" && e.QualityId == 4); + //types.Should().Contain(e => e.Name == "HDTV-1080p" && e.QualityId == 9); + //types.Should().Contain(e => e.Name == "Raw-HD" && e.QualityId == 10); + //types.Should().Contain(e => e.Name == "WEBDL-720p" && e.QualityId == 5); + //types.Should().Contain(e => e.Name == "WEBDL-1080p" && e.QualityId == 3); + //types.Should().Contain(e => e.Name == "Bluray720p" && e.QualityId == 6); + //types.Should().Contain(e => e.Name == "Bluray1080p" && e.QualityId == 7); + } + + [Test] + public void Init_should_insert_any_missing_sizes() + { + Mocker.GetMock() + .Setup(s => s.All()) + .Returns(new List + { + new QualitySize { QualityId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 } + }); + + Subject.Init(); + + Mocker.GetMock() + .Verify(v => v.Insert(It.IsAny()), Times.Exactly(Quality.All().Count - 2)); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/QualityProfileTest.cs b/NzbDrone.Core.Test/QualityProfileTest.cs deleted file mode 100644 index d0c97cac3..000000000 --- a/NzbDrone.Core.Test/QualityProfileTest.cs +++ /dev/null @@ -1,158 +0,0 @@ -// ReSharper disable RedundantUsingDirective -using System; -using System.Collections.Generic; - -using FizzWare.NBuilder; -using FluentAssertions; -using NUnit.Framework; -using NzbDrone.Core.Tv; -using NzbDrone.Core.Providers; -using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; -using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common.AutoMoq; - -namespace NzbDrone.Core.Test -{ - [TestFixture] - // ReSharper disable InconsistentNaming - public class QualityProfileTest : SqlCeTest - { - [SetUp] - public void SetUp() - { - WithRealDb(); - } - - [Test] - public void Test_Storage() - { - //Arrange - var testProfile = new QualityProfile - { - Name = Guid.NewGuid().ToString(), - Cutoff = QualityTypes.SDTV, - Allowed = new List { QualityTypes.HDTV720p, QualityTypes.DVD }, - }; - - - var id = Convert.ToInt32(Db.Insert(testProfile)); - var fetch = Db.SingleOrDefault(id); - - - Assert.AreEqual(id, fetch.QualityProfileId); - Assert.AreEqual(testProfile.Name, fetch.Name); - Assert.AreEqual(testProfile.Cutoff, fetch.Cutoff); - Assert.AreEqual(testProfile.Allowed, fetch.Allowed); - } - - - [Test] - public void Test_Storage_no_allowed() - { - //Arrange - var testProfile = new QualityProfile - { - Name = Guid.NewGuid().ToString(), - Cutoff = QualityTypes.SDTV - }; - - - var id = Convert.ToInt32(Db.Insert(testProfile)); - var fetch = Db.SingleOrDefault(id); - - - Assert.AreEqual(id, fetch.QualityProfileId); - Assert.AreEqual(testProfile.Name, fetch.Name); - Assert.AreEqual(testProfile.Cutoff, fetch.Cutoff); - fetch.Allowed.Should().HaveCount(0); - } - - - [Test] - public void Update_Success() - { - var testProfile = new QualityProfile - { - Name = Guid.NewGuid().ToString(), - Cutoff = QualityTypes.SDTV - }; - - - var id = Convert.ToInt32(Db.Insert(testProfile)); - var currentProfile = Db.SingleOrDefault(id); - - - //Update - currentProfile.Cutoff = QualityTypes.Bluray720p; - Mocker.Resolve().Update(currentProfile); - - var updated = Mocker.Resolve().Get(currentProfile.QualityProfileId); - - - updated.Name.Should().Be(currentProfile.Name); - updated.Cutoff.Should().Be(QualityTypes.Bluray720p); - updated.AllowedString.Should().Be(currentProfile.AllowedString); - - } - - [Test] - public void Test_Series_Quality() - { - var testProfile = new QualityProfile - { - Name = Guid.NewGuid().ToString(), - Cutoff = QualityTypes.SDTV, - Allowed = new List { QualityTypes.HDTV720p, QualityTypes.DVD }, - }; - - - var profileId = Convert.ToInt32(Db.Insert(testProfile)); - - var series = Builder.CreateNew().Build(); - series.QualityProfileId = profileId; - - Db.Insert(testProfile); - Db.Insert(series); - - var result = Db.Fetch(); - - result.Should().HaveCount(1); - var profile = Db.SingleOrDefault(result[0].QualityProfileId); - Assert.AreEqual(profileId, result[0].QualityProfileId); - Assert.AreEqual(testProfile.Name, profile.Name); - } - - - [Test] - public void SetupInitial_should_add_two_profiles() - { - - Mocker.Resolve(); - - - var profiles = Mocker.Resolve().All(); - - - profiles.Should().HaveCount(2); - profiles.Should().Contain(e => e.Name == "HD"); - profiles.Should().Contain(e => e.Name == "SD"); - - } - - [Test] - //This confirms that new profiles are added only if no other profiles exists. - //We don't want to keep adding them back if a user deleted them on purpose. - public void SetupInitial_should_skip_if_any_profile_exists() - { - InitiateSubject(); - - var profiles = Subject.All(); - Subject.Delete(profiles[0].QualityProfileId); - - InitiateSubject(); - - Subject.All().Should().HaveCount(profiles.Count - 1); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs index 84a2df796..366741d51 100644 --- a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs +++ b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs @@ -9,11 +9,11 @@ using NUnit.Framework; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; using PetaPoco; using TvdbLib.Data; @@ -86,7 +86,7 @@ public void GetEpisode_with_EpisodeFile() WithRealDb(); var fakeSeries = Builder.CreateNew().Build(); - var fakeFile = Builder.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = QualityTypes.SDTV).Build(); + var fakeFile = Builder.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = Quality.SDTV).Build(); var fakeEpisodes = Builder.CreateListOfSize(5) .All().With(e => e.SeriesId = 1).TheFirst(1).With(e => e.EpisodeFile = new EpisodeFile { EpisodeFileId = 1 }).With(e => e.EpisodeFile = fakeFile).Build(); @@ -857,7 +857,7 @@ public void GetEpisode_by_Season_Episode_with_EpisodeFile() WithRealDb(); var fakeSeries = Builder.CreateNew().Build(); - var fakeFile = Builder.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = QualityTypes.SDTV).Build(); + var fakeFile = Builder.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = Quality.SDTV).Build(); var fakeEpisodes = Builder.CreateListOfSize(5) .All().With(e => e.SeriesId = 1).TheFirst(1).With(c => c.EpisodeFile = new EpisodeFile { EpisodeFileId = 1 }).With(e => e.EpisodeFile = fakeFile).Build(); @@ -901,7 +901,7 @@ public void GetEpisode_by_AirDate_with_EpisodeFile() WithRealDb(); var fakeSeries = Builder.CreateNew().Build(); - var fakeFile = Builder.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = QualityTypes.SDTV).Build(); + var fakeFile = Builder.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = Quality.SDTV).Build(); var fakeEpisodes = Builder.CreateListOfSize(5) .All().With(e => e.SeriesId = 1).TheFirst(1).With(e => e.EpisodeFile = new EpisodeFile { EpisodeFileId = 1 }).With(e => e.EpisodeFile = fakeFile).Build(); @@ -1213,7 +1213,7 @@ public void EpisodesWithFiles_success() var episodeFile = Builder.CreateNew() .With(c => c.EpisodeFileId = 1) - .With(c => c.Quality = QualityTypes.SDTV) + .With(c => c.Quality = Quality.SDTV) .Build(); var episodes = Builder.CreateListOfSize(2) diff --git a/NzbDrone.Core.Test/QualityTest.cs b/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs similarity index 50% rename from NzbDrone.Core.Test/QualityTest.cs rename to NzbDrone.Core.Test/TvTests/QualityModelFixture.cs index 59a7f5eec..dff878d98 100644 --- a/NzbDrone.Core.Test/QualityTest.cs +++ b/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs @@ -1,21 +1,21 @@ -using FluentAssertions; +using System.Linq; +using FluentAssertions; using NUnit.Framework; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; -using NzbDrone.Core.Model; -using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Test.Framework; -namespace NzbDrone.Core.Test +namespace NzbDrone.Core.Test.TvTests { [TestFixture] // ReSharper disable InconsistentNaming - public class QualityTest : CoreTest + public class QualityModelFixture : CoreTest { [Test] public void Icomparer_greater_test() { - var first = new QualityModel(QualityTypes.DVD, true); - var second = new QualityModel(QualityTypes.Bluray1080p, true); + var first = new QualityModel(Quality.DVD, true); + var second = new QualityModel(Quality.Bluray1080p, true); second.Should().BeGreaterThan(first); } @@ -23,8 +23,8 @@ public void Icomparer_greater_test() [Test] public void Icomparer_greater_proper() { - var first = new QualityModel(QualityTypes.Bluray1080p, false); - var second = new QualityModel(QualityTypes.Bluray1080p, true); + var first = new QualityModel(Quality.Bluray1080p, false); + var second = new QualityModel(Quality.Bluray1080p, true); second.Should().BeGreaterThan(first); } @@ -32,8 +32,8 @@ public void Icomparer_greater_proper() [Test] public void Icomparer_lesser() { - var first = new QualityModel(QualityTypes.DVD, true); - var second = new QualityModel(QualityTypes.Bluray1080p, true); + var first = new QualityModel(Quality.DVD, true); + var second = new QualityModel(Quality.Bluray1080p, true); first.Should().BeLessThan(second); } @@ -41,8 +41,8 @@ public void Icomparer_lesser() [Test] public void Icomparer_lesser_proper() { - var first = new QualityModel(QualityTypes.DVD, false); - var second = new QualityModel(QualityTypes.DVD, true); + var first = new QualityModel(Quality.DVD, false); + var second = new QualityModel(Quality.DVD, true); first.Should().BeLessThan(second); } @@ -50,8 +50,8 @@ public void Icomparer_lesser_proper() [Test] public void equal_operand() { - var first = new QualityModel(QualityTypes.Bluray1080p, true); - var second = new QualityModel(QualityTypes.Bluray1080p, true); + var first = new QualityModel(Quality.Bluray1080p, true); + var second = new QualityModel(Quality.Bluray1080p, true); (first == second).Should().BeTrue(); (first >= second).Should().BeTrue(); @@ -61,8 +61,8 @@ public void equal_operand() [Test] public void equal_operand_false() { - var first = new QualityModel(QualityTypes.Bluray1080p, true); - var second = new QualityModel(QualityTypes.Unknown, true); + var first = new QualityModel(Quality.Bluray1080p, true); + var second = new QualityModel(Quality.Unknown, true); (first == second).Should().BeFalse(); } @@ -70,8 +70,8 @@ public void equal_operand_false() [Test] public void equal_operand_false_proper() { - var first = new QualityModel(QualityTypes.Bluray1080p, true); - var second = new QualityModel(QualityTypes.Bluray1080p, false); + var first = new QualityModel(Quality.Bluray1080p, true); + var second = new QualityModel(Quality.Bluray1080p, false); (first == second).Should().BeFalse(); } @@ -79,8 +79,8 @@ public void equal_operand_false_proper() [Test] public void not_equal_operand() { - var first = new QualityModel(QualityTypes.Bluray1080p, true); - var second = new QualityModel(QualityTypes.Bluray1080p, true); + var first = new QualityModel(Quality.Bluray1080p, true); + var second = new QualityModel(Quality.Bluray1080p, true); (first != second).Should().BeFalse(); } @@ -88,8 +88,8 @@ public void not_equal_operand() [Test] public void not_equal_operand_false() { - var first = new QualityModel(QualityTypes.Bluray1080p, true); - var second = new QualityModel(QualityTypes.Unknown, true); + var first = new QualityModel(Quality.Bluray1080p, true); + var second = new QualityModel(Quality.Unknown, true); (first != second).Should().BeTrue(); } @@ -97,8 +97,8 @@ public void not_equal_operand_false() [Test] public void not_equal_operand_false_proper() { - var first = new QualityModel(QualityTypes.Bluray1080p, true); - var second = new QualityModel(QualityTypes.Bluray1080p, false); + var first = new QualityModel(Quality.Bluray1080p, true); + var second = new QualityModel(Quality.Bluray1080p, false); (first != second).Should().BeTrue(); } @@ -106,8 +106,8 @@ public void not_equal_operand_false_proper() [Test] public void greater_operand() { - var first = new QualityModel(QualityTypes.DVD, true); - var second = new QualityModel(QualityTypes.Bluray1080p, true); + var first = new QualityModel(Quality.DVD, true); + var second = new QualityModel(Quality.Bluray1080p, true); (first < second).Should().BeTrue(); (first <= second).Should().BeTrue(); @@ -116,12 +116,11 @@ public void greater_operand() [Test] public void lesser_operand() { - var first = new QualityModel(QualityTypes.DVD, true); - var second = new QualityModel(QualityTypes.Bluray1080p, true); + var first = new QualityModel(Quality.DVD, true); + var second = new QualityModel(Quality.Bluray1080p, true); (second > first).Should().BeTrue(); (second >= first).Should().BeTrue(); } - } } diff --git a/NzbDrone.Core.Test/XbmcVersionTests.cs b/NzbDrone.Core.Test/XbmcVersionTests.cs index 65b986400..6623156c0 100644 --- a/NzbDrone.Core.Test/XbmcVersionTests.cs +++ b/NzbDrone.Core.Test/XbmcVersionTests.cs @@ -5,7 +5,6 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Model.Xbmc; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Core.Test { diff --git a/NzbDrone.Core/Datastore/CustomeMapper.cs b/NzbDrone.Core/Datastore/CustomeMapper.cs index bc32a72ba..87219400f 100644 --- a/NzbDrone.Core/Datastore/CustomeMapper.cs +++ b/NzbDrone.Core/Datastore/CustomeMapper.cs @@ -1,6 +1,6 @@ using System; using System.Reflection; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; using PetaPoco; namespace NzbDrone.Core.Datastore @@ -9,11 +9,11 @@ public class CustomeMapper : DefaultMapper { public override Func GetToDbConverter(Type sourceType) { - if (sourceType == typeof(QualityTypes)) + if (sourceType == typeof(Quality)) { return delegate(object s) { - var source = (QualityTypes)s; + var source = (Quality)s; return source.Id; }; } @@ -45,13 +45,13 @@ public override Func GetFromDbConverter(Type destinationType, Ty }; } - if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationType == typeof(QualityTypes)) + if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationType == typeof(Quality)) { return delegate(object s) { int value; Int32.TryParse(s.ToString(), out value); - var quality = (QualityTypes)value; + var quality = (Quality)value; return quality; }; } diff --git a/NzbDrone.Core/DecisionEngine/AcceptableSizeSpecification.cs b/NzbDrone.Core/DecisionEngine/AcceptableSizeSpecification.cs index 8589d1285..99765dc69 100644 --- a/NzbDrone.Core/DecisionEngine/AcceptableSizeSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/AcceptableSizeSpecification.cs @@ -1,20 +1,20 @@ using System.Linq; using NLog; using NzbDrone.Core.Datastore; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Providers; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Core.DecisionEngine { public class AcceptableSizeSpecification { - private readonly QualityTypeProvider _qualityTypeProvider; + private readonly QualitySizeService _qualityTypeProvider; private readonly IEpisodeService _episodeService; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - public AcceptableSizeSpecification(QualityTypeProvider qualityTypeProvider, IEpisodeService episodeService) + public AcceptableSizeSpecification(QualitySizeService qualityTypeProvider, IEpisodeService episodeService) { _qualityTypeProvider = qualityTypeProvider; _episodeService = episodeService; @@ -29,7 +29,7 @@ public virtual bool IsSatisfiedBy(EpisodeParseResult subject) { logger.Trace("Beginning size check for: {0}", subject); - if(subject.Quality.Quality == QualityTypes.RAWHD) + if(subject.Quality.Quality == Quality.RAWHD) { logger.Trace("Raw-HD release found, skipping size check."); return true; diff --git a/NzbDrone.Core/DecisionEngine/QualityUpgradeSpecification.cs b/NzbDrone.Core/DecisionEngine/QualityUpgradeSpecification.cs index 5f3cc12cd..ca714f7d0 100644 --- a/NzbDrone.Core/DecisionEngine/QualityUpgradeSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/QualityUpgradeSpecification.cs @@ -1,8 +1,8 @@ using System.Linq; using NLog; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Core.DecisionEngine { @@ -10,7 +10,7 @@ public class QualityUpgradeSpecification { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - public virtual bool IsSatisfiedBy(QualityModel currentQuality, QualityModel newQuality, QualityTypes cutOff) + public virtual bool IsSatisfiedBy(QualityModel currentQuality, QualityModel newQuality, Quality cutOff) { if (currentQuality >= newQuality) { diff --git a/NzbDrone.Core/DecisionEngine/UpgradePossibleSpecification.cs b/NzbDrone.Core/DecisionEngine/UpgradePossibleSpecification.cs index 8deb621e3..a66ce46f1 100644 --- a/NzbDrone.Core/DecisionEngine/UpgradePossibleSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/UpgradePossibleSpecification.cs @@ -1,5 +1,6 @@ using System.Linq; using NLog; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; @@ -8,10 +9,10 @@ namespace NzbDrone.Core.DecisionEngine { public class UpgradePossibleSpecification { - private readonly QualityProvider _qualityProvider; + private readonly IQualityProfileService _qualityProvider; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - public UpgradePossibleSpecification(QualityProvider qualityProvider) + public UpgradePossibleSpecification(IQualityProfileService qualityProvider) { _qualityProvider = qualityProvider; } diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 2a37c9e53..62c3e4f91 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -307,6 +307,8 @@ + + @@ -390,7 +392,7 @@ - + @@ -525,10 +527,10 @@ Code - + Code - + Code @@ -590,8 +592,8 @@ - - + + diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index ab9a29c04..02364eb5a 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -6,9 +6,9 @@ using System.Text.RegularExpressions; using NLog; using NzbDrone.Common; + using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Model; -using NzbDrone.Core.Repository.Quality; namespace NzbDrone.Core { @@ -257,12 +257,12 @@ internal static QualityModel ParseQuality(string name) name = name.Trim(); var normalizedName = NormalizeTitle(name); - var result = new QualityModel { Quality = QualityTypes.Unknown }; + var result = new QualityModel { Quality = Quality.Unknown }; result.Proper = (normalizedName.Contains("proper") || normalizedName.Contains("repack")); if (normalizedName.Contains("dvd") || normalizedName.Contains("bdrip") || normalizedName.Contains("brrip")) { - result.Quality = QualityTypes.DVD; + result.Quality = Quality.DVD; return result; } @@ -270,11 +270,11 @@ internal static QualityModel ParseQuality(string name) { if (normalizedName.Contains("bluray")) { - result.Quality = QualityTypes.DVD; + result.Quality = Quality.DVD; return result; } - result.Quality = QualityTypes.SDTV; + result.Quality = Quality.SDTV; return result; } @@ -282,46 +282,46 @@ internal static QualityModel ParseQuality(string name) { if (normalizedName.Contains("720p")) { - result.Quality = QualityTypes.Bluray720p; + result.Quality = Quality.Bluray720p; return result; } if (normalizedName.Contains("1080p")) { - result.Quality = QualityTypes.Bluray1080p; + result.Quality = Quality.Bluray1080p; return result; } - result.Quality = QualityTypes.Bluray720p; + result.Quality = Quality.Bluray720p; return result; } if (normalizedName.Contains("webdl")) { if (normalizedName.Contains("1080p")) { - result.Quality = QualityTypes.WEBDL1080p; + result.Quality = Quality.WEBDL1080p; return result; } if (normalizedName.Contains("720p")) { - result.Quality = QualityTypes.WEBDL720p; + result.Quality = Quality.WEBDL720p; return result; } if(name.Contains("[WEBDL]")) { - result.Quality = QualityTypes.WEBDL720p; + result.Quality = Quality.WEBDL720p; return result; } - result.Quality = QualityTypes.WEBDL480p; + result.Quality = Quality.WEBDL480p; return result; } if (normalizedName.Contains("trollhd") || normalizedName.Contains("rawhd")) { - result.Quality = QualityTypes.RAWHD; + result.Quality = Quality.RAWHD; return result; } @@ -329,16 +329,16 @@ internal static QualityModel ParseQuality(string name) { if(normalizedName.Contains("1080p")) { - result.Quality = QualityTypes.HDTV1080p; + result.Quality = Quality.HDTV1080p; return result; } - result.Quality = QualityTypes.HDTV720p; + result.Quality = Quality.HDTV720p; return result; } //Based on extension - if (result.Quality == QualityTypes.Unknown) + if (result.Quality == Quality.Unknown) { try { @@ -359,13 +359,13 @@ internal static QualityModel ParseQuality(string name) case ".ogm": case ".strm": { - result.Quality = QualityTypes.SDTV; + result.Quality = Quality.SDTV; break; } case ".mkv": case ".ts": { - result.Quality = QualityTypes.HDTV720p; + result.Quality = Quality.HDTV720p; break; } } @@ -379,21 +379,21 @@ internal static QualityModel ParseQuality(string name) if (name.Contains("[HDTV]")) { - result.Quality = QualityTypes.HDTV720p; + result.Quality = Quality.HDTV720p; return result; } if (normalizedName.Contains("hdtv") && normalizedName.Contains("1080p")) { - result.Quality = QualityTypes.HDTV1080p; + result.Quality = Quality.HDTV1080p; return result; } if ((normalizedName.Contains("sdtv") || normalizedName.Contains("pdtv") || - (result.Quality == QualityTypes.Unknown && normalizedName.Contains("hdtv"))) && + (result.Quality == Quality.Unknown && normalizedName.Contains("hdtv"))) && !normalizedName.Contains("mpeg")) { - result.Quality = QualityTypes.SDTV; + result.Quality = Quality.SDTV; return result; } diff --git a/NzbDrone.Core/Providers/MediaFileProvider.cs b/NzbDrone.Core/Providers/MediaFileProvider.cs index 5600b3d83..11503d0dd 100644 --- a/NzbDrone.Core/Providers/MediaFileProvider.cs +++ b/NzbDrone.Core/Providers/MediaFileProvider.cs @@ -4,11 +4,11 @@ using System.Linq; using NLog; using NzbDrone.Core.Configuration; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Tv; using NzbDrone.Core.Helpers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using PetaPoco; using NzbDrone.Common; @@ -142,7 +142,7 @@ LEFT OUTER JOIN Episodes } } - public virtual string GetNewFilename(IList episodes, Series series, QualityTypes quality, bool proper, EpisodeFile episodeFile) + public virtual string GetNewFilename(IList episodes, Series series, Quality quality, bool proper, EpisodeFile episodeFile) { if (_configService.SortingUseSceneName) { @@ -240,12 +240,12 @@ public virtual string GetNewFilename(IList episodes, Series series, Qua return CleanFilename(result.Trim()); } - public virtual void ChangeQuality(int episodeFileId, QualityTypes quality) + public virtual void ChangeQuality(int episodeFileId, Quality quality) { _database.Execute("UPDATE EpisodeFiles SET Quality = @quality WHERE EpisodeFileId = @episodeFileId", new { episodeFileId, quality }); } - public virtual void ChangeQuality(int seriesId, int seasonNumber, QualityTypes quality) + public virtual void ChangeQuality(int seriesId, int seasonNumber, Quality quality) { _database.Execute("UPDATE EpisodeFiles SET Quality = @quality WHERE SeriesId = @seriesId AND SeasonNumber = @seasonNumber", new { seriesId, seasonNumber, quality }); } diff --git a/NzbDrone.Core/Providers/QualityProvider.cs b/NzbDrone.Core/Providers/QualityProvider.cs deleted file mode 100644 index 82410935a..000000000 --- a/NzbDrone.Core/Providers/QualityProvider.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using NLog; -using NzbDrone.Core.Repository.Quality; -using PetaPoco; - -namespace NzbDrone.Core.Providers -{ - public class QualityProvider - { - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - private readonly IDatabase _database; - - public QualityProvider() - { - } - - public QualityProvider(IDatabase database) - { - _database = database; - SetupDefaultProfiles(); - } - - public virtual int Add(QualityProfile profile) - { - return Convert.ToInt32(_database.Insert(profile)); - } - - public virtual void Update(QualityProfile profile) - { - if (!_database.Exists("WHERE QualityProfileid = @0", profile.QualityProfileId)) - { - Logger.Error("Unable to update non-existing profile"); - throw new InvalidOperationException("Unable to update non-existing profile"); - } - - _database.Update(profile); - } - - public virtual void Delete(int profileId) - { - _database.Delete(profileId); - } - - public virtual List All() - { - var profiles = _database.Fetch().ToList(); - - return profiles; - } - - public virtual QualityProfile Get(int profileId) - { - return _database.Single(profileId); - } - - private void SetupDefaultProfiles() - { - if (All().Count != 0) - return; - - Logger.Info("Setting up default quality profiles"); - - var sd = new QualityProfile { Name = "SD", Allowed = new List { QualityTypes.SDTV, QualityTypes.DVD }, Cutoff = QualityTypes.SDTV }; - - var hd = new QualityProfile - { - Name = "HD", - Allowed = new List { QualityTypes.HDTV720p, QualityTypes.WEBDL720p, QualityTypes.Bluray720p }, - Cutoff = QualityTypes.HDTV720p - }; - - Add(sd); - Add(hd); - - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/QualityTypeProvider.cs b/NzbDrone.Core/Providers/QualityTypeProvider.cs deleted file mode 100644 index 3b4086feb..000000000 --- a/NzbDrone.Core/Providers/QualityTypeProvider.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NLog; -using NzbDrone.Core.Repository.Quality; -using PetaPoco; - -namespace NzbDrone.Core.Providers -{ - public class QualityTypeProvider - { - private readonly IDatabase _database; - - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - - public QualityTypeProvider(IDatabase database) - { - _database = database; - SetupDefault(); - } - - public QualityTypeProvider() - { - - } - - public virtual void Update(QualityType qualityType) - { - _database.Update(qualityType); - } - - public virtual void UpdateAll(List qualityTypes) - { - _database.UpdateMany(qualityTypes); - } - - public virtual List All() - { - return _database.Fetch(); - } - - public virtual QualityType Get(int qualityTypeId) - { - return _database.Single(qualityTypeId); - } - - public virtual List GetList(List qualityTypeIds) - { - var queryParams = String.Join(", ", qualityTypeIds); - var query = String.Format("WHERE QualityTypeId IN ({0})", queryParams); - - return _database.Fetch(query); - } - - private void SetupDefault() - { - var inDb = All(); - - Logger.Debug("Setting up default quality types"); - - foreach (var qualityType in QualityTypes.All()) - { - //Skip UNKNOWN - if (qualityType.Id == 0) continue; - - var db = inDb.SingleOrDefault(s => s.QualityTypeId == qualityType.Id); - - if (db == null) - _database.Insert(new QualityType { QualityTypeId = qualityType.Id, Name = qualityType.Name, MinSize = 0, MaxSize = 100 }); - } - } - } -} diff --git a/NzbDrone.Core/Repository/Quality/QualityTypes.cs b/NzbDrone.Core/Qualities/Quality.cs similarity index 54% rename from NzbDrone.Core/Repository/Quality/QualityTypes.cs rename to NzbDrone.Core/Qualities/Quality.cs index 1028743f9..e6e99cb8a 100644 --- a/NzbDrone.Core/Repository/Quality/QualityTypes.cs +++ b/NzbDrone.Core/Qualities/Quality.cs @@ -2,15 +2,15 @@ using System.Collections.Generic; using System.Linq; -namespace NzbDrone.Core.Repository.Quality +namespace NzbDrone.Core.Qualities { - public class QualityTypes : IComparable + public class Quality : IComparable { public int Id { get; set; } public string Name { get; set; } public int Weight { get; set; } - public int CompareTo(QualityTypes other) + public int CompareTo(Quality other) { if (other.Weight > Weight) return -1; @@ -24,12 +24,12 @@ public int CompareTo(QualityTypes other) return 0; } - public static bool operator !=(QualityTypes x, QualityTypes y) + public static bool operator !=(Quality x, Quality y) { return !(x == y); } - public static bool operator ==(QualityTypes x, QualityTypes y) + public static bool operator ==(Quality x, Quality y) { var xObj = (Object)x; var yObj = (object)y; @@ -42,22 +42,22 @@ public int CompareTo(QualityTypes other) return x.CompareTo(y) == 0; } - public static bool operator >(QualityTypes x, QualityTypes y) + public static bool operator >(Quality x, Quality y) { return x.CompareTo(y) > 0; } - public static bool operator <(QualityTypes x, QualityTypes y) + public static bool operator <(Quality x, Quality y) { return x.CompareTo(y) < 0; } - public static bool operator <=(QualityTypes x, QualityTypes y) + public static bool operator <=(Quality x, Quality y) { return x.CompareTo(y) <= 0; } - public static bool operator >=(QualityTypes x, QualityTypes y) + public static bool operator >=(Quality x, Quality y) { return x.CompareTo(y) >= 0; } @@ -77,7 +77,7 @@ public override int GetHashCode() } } - public bool Equals(QualityTypes other) + public bool Equals(Quality other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; @@ -88,26 +88,26 @@ public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (QualityTypes)) return false; - return Equals((QualityTypes) obj); + if (obj.GetType() != typeof (Quality)) return false; + return Equals((Quality) obj); } - public static QualityTypes Unknown = new QualityTypes { Id = 0, Name = "Unknown", Weight = 0 }; - public static QualityTypes SDTV = new QualityTypes {Id = 1, Name = "SDTV", Weight = 1}; - public static QualityTypes WEBDL480p = new QualityTypes { Id = 8, Name = "WEBDL-480p", Weight = 2 }; - public static QualityTypes DVD = new QualityTypes { Id = 2, Name = "DVD", Weight = 3 }; - public static QualityTypes HDTV720p = new QualityTypes { Id = 4, Name = "HDTV-720p", Weight = 4 }; - public static QualityTypes HDTV1080p = new QualityTypes { Id = 9, Name = "HDTV-1080p", Weight = 5 }; - public static QualityTypes RAWHD = new QualityTypes { Id = 10, Name = "Raw-HD", Weight = 6 }; - public static QualityTypes WEBDL720p = new QualityTypes { Id = 5, Name = "WEBDL-720p", Weight = 7 }; - public static QualityTypes Bluray720p = new QualityTypes { Id = 6, Name = "Bluray720p", Weight = 8 }; - public static QualityTypes WEBDL1080p = new QualityTypes { Id = 3, Name = "WEBDL-1080p", Weight = 9 }; - public static QualityTypes Bluray1080p = new QualityTypes { Id = 7, Name = "Bluray1080p", Weight = 10 }; + public static Quality Unknown = new Quality { Id = 0, Name = "Unknown", Weight = 0 }; + public static Quality SDTV = new Quality {Id = 1, Name = "SDTV", Weight = 1}; + public static Quality WEBDL480p = new Quality { Id = 8, Name = "WEBDL-480p", Weight = 2 }; + public static Quality DVD = new Quality { Id = 2, Name = "DVD", Weight = 3 }; + public static Quality HDTV720p = new Quality { Id = 4, Name = "HDTV-720p", Weight = 4 }; + public static Quality HDTV1080p = new Quality { Id = 9, Name = "HDTV-1080p", Weight = 5 }; + public static Quality RAWHD = new Quality { Id = 10, Name = "Raw-HD", Weight = 6 }; + public static Quality WEBDL720p = new Quality { Id = 5, Name = "WEBDL-720p", Weight = 7 }; + public static Quality Bluray720p = new Quality { Id = 6, Name = "Bluray720p", Weight = 8 }; + public static Quality WEBDL1080p = new Quality { Id = 3, Name = "WEBDL-1080p", Weight = 9 }; + public static Quality Bluray1080p = new Quality { Id = 7, Name = "Bluray1080p", Weight = 10 }; - public static List All() + public static List All() { - return new List + return new List { Unknown, SDTV, @@ -123,7 +123,7 @@ public static List All() }; } - public static QualityTypes FindById(int id) + public static Quality FindById(int id) { var quality = All().SingleOrDefault(q => q.Id == id); @@ -133,12 +133,12 @@ public static QualityTypes FindById(int id) return quality; } - public static explicit operator QualityTypes(int id) + public static explicit operator Quality(int id) { return FindById(id); } - public static explicit operator int(QualityTypes quality) + public static explicit operator int(Quality quality) { return quality.Id; } diff --git a/NzbDrone.Core/Qualities/QualityProfile.cs b/NzbDrone.Core/Qualities/QualityProfile.cs new file mode 100644 index 000000000..5ec6f799f --- /dev/null +++ b/NzbDrone.Core/Qualities/QualityProfile.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Linq; +using NzbDrone.Core.Datastore; + +namespace NzbDrone.Core.Qualities +{ + public class QualityProfile : ModelBase + { + public string Name { get; set; } + public List Allowed { get; set; } + public Quality Cutoff { get; set; } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Qualities/QualityProfileRepository.cs b/NzbDrone.Core/Qualities/QualityProfileRepository.cs new file mode 100644 index 000000000..1de918e24 --- /dev/null +++ b/NzbDrone.Core/Qualities/QualityProfileRepository.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NzbDrone.Core.Datastore; + +namespace NzbDrone.Core.Qualities +{ + public interface IQualityProfileRepository : IBasicRepository + { + + } + + public class QualityProfileRepository : BasicRepository, IQualityProfileRepository + { + public QualityProfileRepository(IObjectDatabase database) + : base(database) + { + } + } +} diff --git a/NzbDrone.Core/Qualities/QualityProfileService.cs b/NzbDrone.Core/Qualities/QualityProfileService.cs new file mode 100644 index 000000000..70a252a11 --- /dev/null +++ b/NzbDrone.Core/Qualities/QualityProfileService.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NLog; +using NzbDrone.Core.Lifecycle; +using NzbDrone.Core.Qualities; +using PetaPoco; + +namespace NzbDrone.Core.Qualities +{ + public interface IQualityProfileService + { + QualityProfile Add(QualityProfile profile); + void Update(QualityProfile profile); + void Delete(int id); + List All(); + QualityProfile Get(int id); + } + + public class QualityProfileService : IQualityProfileService, IInitializable + { + private readonly IQualityProfileRepository _qualityProfileRepository; + private readonly Logger _logger; + + public QualityProfileService(IQualityProfileRepository qualityProfileRepository, Logger logger) + { + _qualityProfileRepository = qualityProfileRepository; + _logger = logger; + } + + public QualityProfile Add(QualityProfile profile) + { + return _qualityProfileRepository.Insert(profile); + } + + public void Update(QualityProfile profile) + { + _qualityProfileRepository.Update(profile); + } + + public void Delete(int id) + { + _qualityProfileRepository.Delete(id); + } + + public List All() + { + return _qualityProfileRepository.All().ToList(); + } + + public QualityProfile Get(int id) + { + return _qualityProfileRepository.Get(id); + } + + public void Init() + { + if (All().Count != 0) + return; + + _logger.Info("Setting up default quality profiles"); + + var sd = new QualityProfile { Name = "SD", Allowed = new List { Quality.SDTV, Quality.DVD }, Cutoff = Quality.SDTV }; + + var hd = new QualityProfile + { + Name = "HD", + Allowed = new List { Quality.HDTV720p, Quality.WEBDL720p, Quality.Bluray720p }, + Cutoff = Quality.HDTV720p + }; + + Add(sd); + Add(hd); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/Quality/QualityType.cs b/NzbDrone.Core/Qualities/QualitySize.cs similarity index 56% rename from NzbDrone.Core/Repository/Quality/QualityType.cs rename to NzbDrone.Core/Qualities/QualitySize.cs index 22c431ff4..0cc0ee2f9 100644 --- a/NzbDrone.Core/Repository/Quality/QualityType.cs +++ b/NzbDrone.Core/Qualities/QualitySize.cs @@ -1,13 +1,12 @@ using System.Linq; +using NzbDrone.Core.Datastore; using PetaPoco; -namespace NzbDrone.Core.Repository.Quality +namespace NzbDrone.Core.Qualities { - [TableName("QualityTypes")] - [PrimaryKey("QualityTypeId", autoIncrement = false)] - public class QualityType + public class QualitySize : ModelBase { - public int QualityTypeId { get; set; } + public int QualityId { get; set; } public string Name { get; set; } public int MinSize { get; set; } public int MaxSize { get; set; } diff --git a/NzbDrone.Core/Qualities/QualitySizeRepository.cs b/NzbDrone.Core/Qualities/QualitySizeRepository.cs new file mode 100644 index 000000000..b2ee4bbef --- /dev/null +++ b/NzbDrone.Core/Qualities/QualitySizeRepository.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NzbDrone.Core.Datastore; + +namespace NzbDrone.Core.Qualities +{ + public interface IQualitySizeRepository : IBasicRepository + { + QualitySize GetByQualityId(int qualityId); + } + + public class QualitySizeRepository : BasicRepository, IQualitySizeRepository + { + public QualitySizeRepository(IObjectDatabase database) + : base(database) + { + } + + public QualitySize GetByQualityId(int qualityId) + { + return Queryable.Single(q => q.QualityId == qualityId); + } + } +} diff --git a/NzbDrone.Core/Qualities/QualitySizeService.cs b/NzbDrone.Core/Qualities/QualitySizeService.cs new file mode 100644 index 000000000..8d34574a3 --- /dev/null +++ b/NzbDrone.Core/Qualities/QualitySizeService.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NLog; +using NzbDrone.Core.Lifecycle; + +namespace NzbDrone.Core.Qualities +{ + public interface IQualitySizeService + { + void Update(QualitySize qualitySize); + void UpdateAll(List qualitySizes); + List All(); + QualitySize Get(int qualityId); + } + + public class QualitySizeService : IQualitySizeService, IInitializable + { + private readonly IQualitySizeRepository _qualitySizeRepository; + private readonly Logger _logger; + + public QualitySizeService(IQualitySizeRepository qualitySizeRepository, Logger logger) + { + _qualitySizeRepository = qualitySizeRepository; + _logger = logger; + } + + public virtual void Update(QualitySize qualitySize) + { + _qualitySizeRepository.Update(qualitySize); + } + + public virtual void UpdateAll(List qualitySizes) + { + _qualitySizeRepository.UpdateMany(qualitySizes); + } + + public virtual List All() + { + return _qualitySizeRepository.All().ToList(); + } + + public virtual QualitySize Get(int qualityId) + { + return _qualitySizeRepository.GetByQualityId(qualityId); + } + + public void Init() + { + var inDb = All(); + + _logger.Debug("Setting up default quality sizes"); + + foreach (var quality in Quality.All()) + { + //Skip UNKNOWN + if (quality.Id == 0) continue; + + var db = inDb.SingleOrDefault(s => s.QualityId == quality.Id); + + if(db == null) + _qualitySizeRepository.Insert(new QualitySize + { + QualityId = quality.Id, + Name = quality.Name, + MinSize = 0, + MaxSize = 100 + }); + } + } + } +} diff --git a/NzbDrone.Core/Repository/Quality/QualityProfile.cs b/NzbDrone.Core/Repository/Quality/QualityProfile.cs deleted file mode 100644 index e21a93292..000000000 --- a/NzbDrone.Core/Repository/Quality/QualityProfile.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using PetaPoco; - -namespace NzbDrone.Core.Repository.Quality -{ - [TableName("QualityProfiles")] - [PrimaryKey("QualityProfileId", autoIncrement = true)] - public class QualityProfile - { - public virtual int QualityProfileId { get; set; } - public string Name { get; set; } - - [Ignore] - public List Allowed { get; set; } - - [Ignore] - public string AllowedString { get; set; } - public QualityTypes Cutoff { get; set; } - - [EditorBrowsable(EditorBrowsableState.Never)] - public string SonicAllowed - { - get - { - string result = String.Empty; - if (Allowed == null) return result; - - foreach (var q in Allowed) - { - result += q.Id + "|"; - } - return result.Trim('|'); - } - private set - { - var qualities = value.Split('|'); - Allowed = new List(qualities.Length); - foreach (var quality in qualities.Where(q => !String.IsNullOrWhiteSpace(q))) - { - Allowed.Add(QualityTypes.FindById(Convert.ToInt32(quality))); - } - } - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Repository/Search/SearchHistory.cs b/NzbDrone.Core/Repository/Search/SearchHistory.cs index ce4c831aa..b5289856a 100644 --- a/NzbDrone.Core/Repository/Search/SearchHistory.cs +++ b/NzbDrone.Core/Repository/Search/SearchHistory.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.ComponentModel; using NzbDrone.Core.Model; -using NzbDrone.Core.Repository.Quality; using PetaPoco; namespace NzbDrone.Core.Repository.Search diff --git a/NzbDrone.Core/Repository/Search/SearchHistoryItem.cs b/NzbDrone.Core/Repository/Search/SearchHistoryItem.cs index 0a5b0cfb9..ae29d3430 100644 --- a/NzbDrone.Core/Repository/Search/SearchHistoryItem.cs +++ b/NzbDrone.Core/Repository/Search/SearchHistoryItem.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using NzbDrone.Core.Model; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; using PetaPoco; namespace NzbDrone.Core.Repository.Search @@ -19,7 +19,7 @@ public class SearchHistoryItem public string NzbInfoUrl { get; set; } public bool Success { get; set; } public ReportRejectionType SearchError { get; set; } - public Quality.QualityTypes Quality { get; set; } + public Quality Quality { get; set; } public bool Proper { get; set; } public int Age { get; set; } public LanguageType Language { get; set; } diff --git a/NzbDrone.Core/Tv/EpisodeFile.cs b/NzbDrone.Core/Tv/EpisodeFile.cs index 3bbfa3ba1..0438b9fab 100644 --- a/NzbDrone.Core/Tv/EpisodeFile.cs +++ b/NzbDrone.Core/Tv/EpisodeFile.cs @@ -1,6 +1,6 @@ using System.Linq; using System; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; using PetaPoco; namespace NzbDrone.Core.Tv @@ -28,7 +28,7 @@ public EpisodeFile(EpisodeFile source) public int SeriesId { get; set; } public int SeasonNumber { get; set; } public string Path { get; set; } - public QualityTypes Quality { get; set; } + public Quality Quality { get; set; } public bool Proper { get; set; } public long Size { get; set; } public DateTime DateAdded { get; set; } diff --git a/NzbDrone.Core/Tv/QualityModel.cs b/NzbDrone.Core/Tv/QualityModel.cs index 740a27308..a778d0041 100644 --- a/NzbDrone.Core/Tv/QualityModel.cs +++ b/NzbDrone.Core/Tv/QualityModel.cs @@ -1,21 +1,21 @@ using System.Linq; using System; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; namespace NzbDrone.Core.Tv { public class QualityModel : IComparable { - public QualityTypes Quality { get; set; } + public Quality Quality { get; set; } public Boolean Proper { get; set; } - public QualityModel():this(QualityTypes.Unknown, false) + public QualityModel():this(Quality.Unknown, false) { } - public QualityModel(QualityTypes quality, Boolean proper) + public QualityModel(Quality quality, Boolean proper) { Quality = quality; Proper = proper; diff --git a/NzbDrone.Core/Tv/Series.cs b/NzbDrone.Core/Tv/Series.cs index 9acf8cabb..dc015284d 100644 --- a/NzbDrone.Core/Tv/Series.cs +++ b/NzbDrone.Core/Tv/Series.cs @@ -2,7 +2,7 @@ using System; using NzbDrone.Core.Datastore; using NzbDrone.Core.Model; -using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Qualities; using PetaPoco; namespace NzbDrone.Core.Tv diff --git a/SqlCe/NzbDrone.SqlCe.dll b/SqlCe/NzbDrone.SqlCe.dll index 6147724b4bf8bae186e89502c4e70b0e05a9ff76..763ab500556a9590786cedc656a00778c9b1182d 100644 GIT binary patch delta 117 zcmZorXi%8Y!QAmcXJfY^o4}hrnf&|T`8zee<6xQV8yGkF4BH7;pkyEe5HJC;3?l=> z8dV@>XJ7~lb_p(irT&)VFr)WOl~&`ucQ3pLN;4!|#e^2878S?%CKhGKxD@3VB;{93 QzQ_J*q5Lb7Qw5o4}ketM)oBneVq(NnT+3!B_p0&#;~F0!jul009#a%P=x9 ztWgDGb_Rx^V3**MWo*lKKd5l*(u}qEA?uX}lx9e_iU}=FEh>)jO)SceanH|B&q-Bq SDatHMoqUu1)#ei%7VH3~`6)60