You've already forked Sonarr
							
							
				mirror of
				https://github.com/Sonarr/Sonarr.git
				synced 2025-10-31 00:07:55 +02:00 
			
		
		
		
	Quality moved to ObjectDb.
This commit is contained in:
		| @@ -7,7 +7,7 @@ using NzbDrone.Api.Resolvers; | |||||||
| using NzbDrone.Api.Series; | using NzbDrone.Api.Series; | ||||||
| using NzbDrone.Api.Upcoming; | using NzbDrone.Api.Upcoming; | ||||||
| using NzbDrone.Core.Datastore; | using NzbDrone.Core.Datastore; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
|  |  | ||||||
| namespace NzbDrone.Api | namespace NzbDrone.Api | ||||||
| @@ -19,24 +19,22 @@ namespace NzbDrone.Api | |||||||
|         { |         { | ||||||
|             //QualityProfiles |             //QualityProfiles | ||||||
|             Mapper.CreateMap<QualityProfile, QualityProfileModel>() |             Mapper.CreateMap<QualityProfile, QualityProfileModel>() | ||||||
|                   .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityProfileId)) |  | ||||||
|                   .ForMember(dest => dest.Qualities, |                   .ForMember(dest => dest.Qualities, | ||||||
|                              opt => opt.ResolveUsing<AllowedToQualitiesResolver>().FromMember(src => src.Allowed)); |                              opt => opt.ResolveUsing<AllowedToQualitiesResolver>().FromMember(src => src.Allowed)); | ||||||
|  |  | ||||||
|             Mapper.CreateMap<QualityProfileModel, QualityProfile>() |             Mapper.CreateMap<QualityProfileModel, QualityProfile>() | ||||||
|                   .ForMember(dest => dest.QualityProfileId, opt => opt.MapFrom(src => src.Id)) |  | ||||||
|                   .ForMember(dest => dest.Allowed, |                   .ForMember(dest => dest.Allowed, | ||||||
|                              opt => opt.ResolveUsing<QualitiesToAllowedResolver>().FromMember(src => src.Qualities)); |                              opt => opt.ResolveUsing<QualitiesToAllowedResolver>().FromMember(src => src.Qualities)); | ||||||
|  |  | ||||||
|             Mapper.CreateMap<QualityTypes, QualityProfileType>() |             Mapper.CreateMap<Quality, QualityProfileType>() | ||||||
|                   .ForMember(dest => dest.Allowed, opt => opt.Ignore()); |                   .ForMember(dest => dest.Allowed, opt => opt.Ignore()); | ||||||
|  |  | ||||||
|             //QualityTypes |             //QualitySize | ||||||
|             Mapper.CreateMap<Core.Repository.Quality.QualityType, QualityTypeModel>() |             Mapper.CreateMap<QualitySize, QualityTypeModel>() | ||||||
|                   .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityTypeId)); |                   .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityId)); | ||||||
|  |  | ||||||
|             Mapper.CreateMap<QualityTypeModel, Core.Repository.Quality.QualityType>() |             Mapper.CreateMap<QualityTypeModel, QualitySize>() | ||||||
|                   .ForMember(dest => dest.QualityTypeId, opt => opt.MapFrom(src => src.Id)); |                   .ForMember(dest => dest.QualityId, opt => opt.MapFrom(src => src.Id)); | ||||||
|  |  | ||||||
|             //Series |             //Series | ||||||
|             Mapper.CreateMap<Core.Tv.Series, SeriesResource>() |             Mapper.CreateMap<Core.Tv.Series, SeriesResource>() | ||||||
|   | |||||||
| @@ -4,16 +4,16 @@ using AutoMapper; | |||||||
| using Nancy; | using Nancy; | ||||||
| using NzbDrone.Api.Extensions; | using NzbDrone.Api.Extensions; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Api.QualityType; | using NzbDrone.Api.QualityType; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
|  |  | ||||||
| namespace NzbDrone.Api.QualityProfiles | namespace NzbDrone.Api.QualityProfiles | ||||||
| { | { | ||||||
|     public class QualityProfilesModule : NzbDroneApiModule |     public class QualityProfilesModule : NzbDroneApiModule | ||||||
|     { |     { | ||||||
|         private readonly QualityProvider _qualityProvider; |         private readonly QualityProfileService _qualityProvider; | ||||||
|  |  | ||||||
|         public QualityProfilesModule(QualityProvider qualityProvider) |         public QualityProfilesModule(QualityProfileService qualityProvider) | ||||||
|             : base("/QualityProfiles") |             : base("/QualityProfiles") | ||||||
|         { |         { | ||||||
|             _qualityProvider = qualityProvider; |             _qualityProvider = qualityProvider; | ||||||
| @@ -39,7 +39,7 @@ namespace NzbDrone.Api.QualityProfiles | |||||||
|         { |         { | ||||||
|             var request = Request.Body.FromJson<QualityProfileModel>(); |             var request = Request.Body.FromJson<QualityProfileModel>(); | ||||||
|             var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request); |             var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request); | ||||||
|             request.Id = _qualityProvider.Add(profile); |             request.Id = _qualityProvider.Add(profile).Id; | ||||||
|  |  | ||||||
|             return request.AsResponse(); |             return request.AsResponse(); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -5,14 +5,15 @@ using Nancy; | |||||||
| using NzbDrone.Api.Extensions; | using NzbDrone.Api.Extensions; | ||||||
| using NzbDrone.Api.QualityProfiles; | using NzbDrone.Api.QualityProfiles; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
|  |  | ||||||
| namespace NzbDrone.Api.QualityType | namespace NzbDrone.Api.QualityType | ||||||
| { | { | ||||||
|     public class QualityTypeModule : NzbDroneApiModule |     public class QualityTypeModule : NzbDroneApiModule | ||||||
|     { |     { | ||||||
|         private readonly QualityTypeProvider _qualityTypeProvider; |         private readonly QualitySizeService _qualityTypeProvider; | ||||||
|  |  | ||||||
|         public QualityTypeModule(QualityTypeProvider qualityTypeProvider) |         public QualityTypeModule(QualitySizeService qualityTypeProvider) | ||||||
|             : base("/QualityTypes") |             : base("/QualityTypes") | ||||||
|         { |         { | ||||||
|             _qualityTypeProvider = qualityTypeProvider; |             _qualityTypeProvider = qualityTypeProvider; | ||||||
| @@ -26,7 +27,7 @@ namespace NzbDrone.Api.QualityType | |||||||
|         { |         { | ||||||
|             var model = Request.Body.FromJson<QualityTypeModel>(); |             var model = Request.Body.FromJson<QualityTypeModel>(); | ||||||
|  |  | ||||||
|             var type = Mapper.Map<QualityTypeModel, Core.Repository.Quality.QualityType>(model); |             var type = Mapper.Map<QualityTypeModel, QualitySize>(model); | ||||||
|             _qualityTypeProvider.Update(type); |             _qualityTypeProvider.Update(type); | ||||||
|  |  | ||||||
|             return model.AsResponse(); |             return model.AsResponse(); | ||||||
| @@ -36,13 +37,13 @@ namespace NzbDrone.Api.QualityType | |||||||
|         private Response GetQualityType(int id) |         private Response GetQualityType(int id) | ||||||
|         { |         { | ||||||
|             var type = _qualityTypeProvider.Get(id); |             var type = _qualityTypeProvider.Get(id); | ||||||
|             return Mapper.Map<Core.Repository.Quality.QualityType, QualityTypeModel>(type).AsResponse(); |             return Mapper.Map<QualitySize, QualityTypeModel>(type).AsResponse(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private Response GetQualityType() |         private Response GetQualityType() | ||||||
|         { |         { | ||||||
|             var types = _qualityTypeProvider.All().Where(qualityType => qualityType.QualityTypeId != 0 && qualityType.QualityTypeId != 10).ToList(); |             var types = _qualityTypeProvider.All().Where(qualityType => qualityType.QualityId != 0 && qualityType.QualityId != 10).ToList(); | ||||||
|             var responseModel = Mapper.Map<List<Core.Repository.Quality.QualityType>, List<QualityTypeModel>>(types); |             var responseModel = Mapper.Map<List<QualitySize>, List<QualityTypeModel>>(types); | ||||||
|  |  | ||||||
|             return responseModel.AsResponse(); |             return responseModel.AsResponse(); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -3,15 +3,15 @@ using System.Collections.Generic; | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using AutoMapper; | using AutoMapper; | ||||||
| using NzbDrone.Api.QualityProfiles; | using NzbDrone.Api.QualityProfiles; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
|  |  | ||||||
| namespace NzbDrone.Api.Resolvers | namespace NzbDrone.Api.Resolvers | ||||||
| { | { | ||||||
|     public class AllowedToQualitiesResolver : ValueResolver<List<QualityTypes>, List<QualityProfileType>> |     public class AllowedToQualitiesResolver : ValueResolver<List<Quality>, List<QualityProfileType>> | ||||||
|     { |     { | ||||||
|         protected override List<QualityProfileType> ResolveCore(List<QualityTypes> source) |         protected override List<QualityProfileType> ResolveCore(List<Quality> source) | ||||||
|         { |         { | ||||||
|             var qualities = Mapper.Map<List<QualityTypes>, List<QualityProfileType>>(QualityTypes.All().Where(q => q.Id > 0).ToList()); |             var qualities = Mapper.Map<List<Quality>, List<QualityProfileType>>(Quality.All().Where(q => q.Id > 0).ToList()); | ||||||
|  |  | ||||||
|             qualities.ForEach(quality => |             qualities.ForEach(quality => | ||||||
|             { |             { | ||||||
|   | |||||||
| @@ -3,7 +3,6 @@ using System.Collections.Generic; | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using AutoMapper; | using AutoMapper; | ||||||
| using NzbDrone.Api.QualityProfiles; | using NzbDrone.Api.QualityProfiles; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
|  |  | ||||||
| namespace NzbDrone.Api.Resolvers | namespace NzbDrone.Api.Resolvers | ||||||
|   | |||||||
| @@ -3,7 +3,6 @@ using System.Collections.Generic; | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using AutoMapper; | using AutoMapper; | ||||||
| using NzbDrone.Api.QualityProfiles; | using NzbDrone.Api.QualityProfiles; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
|  |  | ||||||
| namespace NzbDrone.Api.Resolvers | namespace NzbDrone.Api.Resolvers | ||||||
| { | { | ||||||
|   | |||||||
| @@ -4,21 +4,21 @@ using System.Linq; | |||||||
| using System.Text; | using System.Text; | ||||||
| using AutoMapper; | using AutoMapper; | ||||||
| using NzbDrone.Api.QualityProfiles; | using NzbDrone.Api.QualityProfiles; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
|  |  | ||||||
| namespace NzbDrone.Api.Resolvers | namespace NzbDrone.Api.Resolvers | ||||||
| { | { | ||||||
|     public class QualitiesToAllowedResolver : ValueResolver<List<QualityProfileType>, List<QualityTypes>> |     public class QualitiesToAllowedResolver : ValueResolver<List<QualityProfileType>, List<Quality>> | ||||||
|     { |     { | ||||||
|         protected override List<QualityTypes> ResolveCore(List<QualityProfileType> source) |         protected override List<Quality> ResolveCore(List<QualityProfileType> source) | ||||||
|         { |         { | ||||||
|             var ids = source.Where(s => s.Allowed).Select(s => s.Id).ToList(); |             var ids = source.Where(s => s.Allowed).Select(s => s.Id).ToList(); | ||||||
|  |  | ||||||
|             var qualityTypes = new List<QualityTypes>(); |             var qualityTypes = new List<Quality>(); | ||||||
|  |  | ||||||
|             ids.ForEach(id => |             ids.ForEach(id => | ||||||
|                             { |                             { | ||||||
|                                 qualityTypes.Add(QualityTypes.FindById(id)); |                                 qualityTypes.Add(Quality.FindById(id)); | ||||||
|                             }); |                             }); | ||||||
|  |  | ||||||
|             return qualityTypes; |             return qualityTypes; | ||||||
|   | |||||||
| @@ -3,13 +3,13 @@ using System.Collections.Generic; | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using System.Text; | using System.Text; | ||||||
| using AutoMapper; | using AutoMapper; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
|  |  | ||||||
| namespace NzbDrone.Api.Resolvers | namespace NzbDrone.Api.Resolvers | ||||||
| { | { | ||||||
|     public class QualityTypesToIntResolver : ValueResolver<QualityTypes, Int32> |     public class QualityTypesToIntResolver : ValueResolver<Quality, Int32> | ||||||
|     { |     { | ||||||
|         protected override int ResolveCore(QualityTypes source) |         protected override int ResolveCore(Quality source) | ||||||
|         { |         { | ||||||
|             return source.Id; |             return source.Id; | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ using NzbDrone.Core.Indexers; | |||||||
| using NzbDrone.Core.Jobs; | using NzbDrone.Core.Jobs; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Metadata; | using NzbDrone.Core.Providers.Metadata; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test | namespace NzbDrone.Core.Test | ||||||
| @@ -124,7 +125,7 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void quality_profile_initialized() |         public void quality_profile_initialized() | ||||||
|         { |         { | ||||||
|             kernel.Resolve<QualityProvider>().All().Should().HaveCount(2); |             kernel.Resolve<QualityProfileService>().All().Should().HaveCount(2); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         [Test] |         [Test] | ||||||
|   | |||||||
| @@ -7,12 +7,12 @@ using FizzWare.NBuilder; | |||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using Moq; | using Moq; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.DecisionEngineTests | namespace NzbDrone.Core.Test.DecisionEngineTests | ||||||
| @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|         private EpisodeParseResult parseResultSingle; |         private EpisodeParseResult parseResultSingle; | ||||||
|         private Series series30minutes; |         private Series series30minutes; | ||||||
|         private Series series60minutes; |         private Series series60minutes; | ||||||
|         private QualityType qualityType; |         private QualitySize qualityType; | ||||||
|  |  | ||||||
|         [SetUp] |         [SetUp] | ||||||
|         public void Setup() |         public void Setup() | ||||||
| @@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|                                    { |                                    { | ||||||
|                                        SeriesTitle = "Title", |                                        SeriesTitle = "Title", | ||||||
|                                        Language = LanguageType.English, |                                        Language = LanguageType.English, | ||||||
|                                        Quality = new QualityModel(QualityTypes.SDTV, true), |                                        Quality = new QualityModel(Quality.SDTV, true), | ||||||
|                                        EpisodeNumbers = new List<int> { 3, 4 }, |                                        EpisodeNumbers = new List<int> { 3, 4 }, | ||||||
|                                        SeasonNumber = 12, |                                        SeasonNumber = 12, | ||||||
|                                        AirDate = DateTime.Now.AddDays(-12).Date |                                        AirDate = DateTime.Now.AddDays(-12).Date | ||||||
| @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|                                     { |                                     { | ||||||
|                                         SeriesTitle = "Title", |                                         SeriesTitle = "Title", | ||||||
|                                         Language = LanguageType.English, |                                         Language = LanguageType.English, | ||||||
|                                         Quality = new QualityModel(QualityTypes.SDTV, true), |                                         Quality = new QualityModel(Quality.SDTV, true), | ||||||
|                                         EpisodeNumbers = new List<int> { 3 }, |                                         EpisodeNumbers = new List<int> { 3 }, | ||||||
|                                         SeasonNumber = 12, |                                         SeasonNumber = 12, | ||||||
|                                         AirDate = DateTime.Now.AddDays(-12).Date |                                         AirDate = DateTime.Now.AddDays(-12).Date | ||||||
| @@ -62,10 +62,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|                 .With(c => c.Runtime = 60) |                 .With(c => c.Runtime = 60) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
|             qualityType = Builder<QualityType>.CreateNew() |             qualityType = Builder<QualitySize>.CreateNew() | ||||||
|                 .With(q => q.MinSize = 0) |                 .With(q => q.MinSize = 0) | ||||||
|                 .With(q => q.MaxSize = 10) |                 .With(q => q.MaxSize = 10) | ||||||
|                 .With(q => q.QualityTypeId = 1) |                 .With(q => q.QualityId = 1) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
|         } |         } | ||||||
| @@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Series = series30minutes; |             parseResultSingle.Series = series30minutes; | ||||||
|             parseResultSingle.Size = 184572800; |             parseResultSingle.Size = 184572800; | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Series = series60minutes; |             parseResultSingle.Series = series60minutes; | ||||||
|             parseResultSingle.Size = 368572800; |             parseResultSingle.Size = 368572800; | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Series = series30minutes; |             parseResultSingle.Series = series30minutes; | ||||||
|             parseResultSingle.Size = 1.Gigabytes(); |             parseResultSingle.Size = 1.Gigabytes(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -141,7 +141,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Series = series60minutes; |             parseResultSingle.Series = series60minutes; | ||||||
|             parseResultSingle.Size = 1.Gigabytes(); |             parseResultSingle.Size = 1.Gigabytes(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -162,7 +162,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultMulti.Series = series30minutes; |             parseResultMulti.Series = series30minutes; | ||||||
|             parseResultMulti.Size = 184572800; |             parseResultMulti.Size = 184572800; | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -183,7 +183,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultMulti.Series = series60minutes; |             parseResultMulti.Series = series60minutes; | ||||||
|             parseResultMulti.Size = 368572800; |             parseResultMulti.Size = 368572800; | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -204,7 +204,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultMulti.Series = series30minutes; |             parseResultMulti.Series = series30minutes; | ||||||
|             parseResultMulti.Size = 1.Gigabytes(); |             parseResultMulti.Size = 1.Gigabytes(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -225,7 +225,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultMulti.Series = series60minutes; |             parseResultMulti.Series = series60minutes; | ||||||
|             parseResultMulti.Size = 10.Gigabytes(); |             parseResultMulti.Size = 10.Gigabytes(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -246,7 +246,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Series = series30minutes; |             parseResultSingle.Series = series30minutes; | ||||||
|             parseResultSingle.Size = 184572800; |             parseResultSingle.Size = 184572800; | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -267,7 +267,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Series = series60minutes; |             parseResultSingle.Series = series60minutes; | ||||||
|             parseResultSingle.Size = 368572800; |             parseResultSingle.Size = 368572800; | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -288,7 +288,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Series = series30minutes; |             parseResultSingle.Series = series30minutes; | ||||||
|             parseResultSingle.Size = 1.Gigabytes(); |             parseResultSingle.Size = 1.Gigabytes(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -309,7 +309,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Series = series60minutes; |             parseResultSingle.Series = series60minutes; | ||||||
|             parseResultSingle.Size = 10.Gigabytes(); |             parseResultSingle.Size = 10.Gigabytes(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -331,7 +331,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Size = 18457280000; |             parseResultSingle.Size = 18457280000; | ||||||
|             qualityType.MaxSize = 0; |             qualityType.MaxSize = 0; | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -353,7 +353,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle.Size = 36857280000; |             parseResultSingle.Size = 36857280000; | ||||||
|             qualityType.MaxSize = 0; |             qualityType.MaxSize = 0; | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -376,7 +376,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|  |  | ||||||
|             qualityType.MaxSize = (int)600.Megabytes(); |             qualityType.MaxSize = (int)600.Megabytes(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType); |             Mocker.GetMock<QualitySizeService>().Setup(s => s.Get(1)).Returns(qualityType); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IEpisodeService>().Setup( |             Mocker.GetMock<IEpisodeService>().Setup( | ||||||
|                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) |                 s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())) | ||||||
| @@ -394,7 +394,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|         { |         { | ||||||
|             var parseResult = new EpisodeParseResult |             var parseResult = new EpisodeParseResult | ||||||
|                 { |                 { | ||||||
|                         Quality = new QualityModel(QualityTypes.RAWHD, false) |                         Quality = new QualityModel(Quality.RAWHD, false) | ||||||
|                 }; |                 }; | ||||||
|  |  | ||||||
|             Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue(); |             Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResult).Should().BeTrue(); | ||||||
|   | |||||||
| @@ -11,7 +11,6 @@ using NzbDrone.Core.Model; | |||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.DecisionEngineTests | namespace NzbDrone.Core.Test.DecisionEngineTests | ||||||
|   | |||||||
| @@ -8,13 +8,13 @@ using FluentAssertions; | |||||||
| using Moq; | using Moq; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Configuration; | using NzbDrone.Core.Configuration; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.DecisionEngineTests | namespace NzbDrone.Core.Test.DecisionEngineTests | ||||||
| @@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|                                     { |                                     { | ||||||
|                                         SeriesTitle = "Title", |                                         SeriesTitle = "Title", | ||||||
|                                         Language = LanguageType.English, |                                         Language = LanguageType.English, | ||||||
|                                         Quality = new QualityModel(QualityTypes.SDTV, true), |                                         Quality = new QualityModel(Quality.SDTV, true), | ||||||
|                                         EpisodeNumbers = new List<int> { 3 }, |                                         EpisodeNumbers = new List<int> { 3 }, | ||||||
|                                         SeasonNumber = 12, |                                         SeasonNumber = 12, | ||||||
|                                         AirDate = DateTime.Now.AddDays(-12).Date, |                                         AirDate = DateTime.Now.AddDays(-12).Date, | ||||||
|   | |||||||
| @@ -5,11 +5,11 @@ using System.Linq; | |||||||
| using FizzWare.NBuilder; | using FizzWare.NBuilder; | ||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.DecisionEngineTests | namespace NzbDrone.Core.Test.DecisionEngineTests | ||||||
| @@ -23,16 +23,16 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|  |  | ||||||
|         public static object[] AllowedTestCases = |         public static object[] AllowedTestCases = | ||||||
|         { |         { | ||||||
|             new object[] { QualityTypes.DVD }, |             new object[] { Quality.DVD }, | ||||||
|             new object[] { QualityTypes.HDTV720p }, |             new object[] { Quality.HDTV720p }, | ||||||
|             new object[] { QualityTypes.Bluray1080p } |             new object[] { Quality.Bluray1080p } | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         public static object[] DeniedTestCases = |         public static object[] DeniedTestCases = | ||||||
|         { |         { | ||||||
|             new object[] { QualityTypes.SDTV }, |             new object[] { Quality.SDTV }, | ||||||
|             new object[] { QualityTypes.WEBDL720p }, |             new object[] { Quality.WEBDL720p }, | ||||||
|             new object[] { QualityTypes.Bluray720p } |             new object[] { Quality.Bluray720p } | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         [SetUp] |         [SetUp] | ||||||
| @@ -41,32 +41,32 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             _qualityAllowedByProfile = Mocker.Resolve<QualityAllowedByProfileSpecification>(); |             _qualityAllowedByProfile = Mocker.Resolve<QualityAllowedByProfileSpecification>(); | ||||||
|  |  | ||||||
|             var fakeSeries = Builder<Series>.CreateNew() |             var fakeSeries = Builder<Series>.CreateNew() | ||||||
|                          .With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p }) |                          .With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p }) | ||||||
|                          .Build(); |                          .Build(); | ||||||
|  |  | ||||||
|             parseResult = new EpisodeParseResult |             parseResult = new EpisodeParseResult | ||||||
|             { |             { | ||||||
|                 Series = fakeSeries, |                 Series = fakeSeries, | ||||||
|                 Quality = new QualityModel(QualityTypes.DVD, true), |                 Quality = new QualityModel(Quality.DVD, true), | ||||||
|                 EpisodeNumbers = new List<int> { 3 }, |                 EpisodeNumbers = new List<int> { 3 }, | ||||||
|                 SeasonNumber = 12, |                 SeasonNumber = 12, | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("AllowedTestCases")] |         [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.Quality.Quality = qualityType; | ||||||
|             parseResult.Series.QualityProfile.Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.HDTV720p, QualityTypes.Bluray1080p }; |             parseResult.Series.QualityProfile.Allowed = new List<Quality> { Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p }; | ||||||
|  |  | ||||||
|             _qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeTrue(); |             _qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeTrue(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("DeniedTestCases")] |         [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.Quality.Quality = qualityType; | ||||||
|             parseResult.Series.QualityProfile.Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.HDTV720p, QualityTypes.Bluray1080p }; |             parseResult.Series.QualityProfile.Allowed = new List<Quality> { Quality.DVD, Quality.HDTV720p, Quality.Bluray1080p }; | ||||||
|  |  | ||||||
|             _qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeFalse(); |             _qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeFalse(); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -3,10 +3,10 @@ | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.DecisionEngineTests | namespace NzbDrone.Core.Test.DecisionEngineTests | ||||||
| @@ -17,19 +17,19 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|     { |     { | ||||||
|         public static object[] IsUpgradeTestCases = |         public static object[] IsUpgradeTestCases = | ||||||
|         { |         { | ||||||
|             new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true }, |             new object[] { Quality.SDTV, false, Quality.SDTV, true, Quality.SDTV, true }, | ||||||
|             new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, true, QualityTypes.WEBDL720p, true }, |             new object[] { Quality.WEBDL720p, false, Quality.WEBDL720p, true, Quality.WEBDL720p, true }, | ||||||
|             new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, false, QualityTypes.SDTV, false }, |             new object[] { Quality.SDTV, false, Quality.SDTV, false, Quality.SDTV, false }, | ||||||
|             new object[] { QualityTypes.SDTV, false, QualityTypes.DVD, true, QualityTypes.SDTV, false }, |             new object[] { Quality.SDTV, false, Quality.DVD, true, Quality.SDTV, false }, | ||||||
|             new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.Bluray720p, false }, |             new object[] { Quality.WEBDL720p, false, Quality.HDTV720p, true, Quality.Bluray720p, false }, | ||||||
|             new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.WEBDL720p, false }, |             new object[] { Quality.WEBDL720p, false, Quality.HDTV720p, true, Quality.WEBDL720p, false }, | ||||||
|             new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false }, |             new object[] { Quality.WEBDL720p, false, Quality.WEBDL720p, false, Quality.WEBDL720p, false }, | ||||||
|             new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true }, |             new object[] { Quality.SDTV, false, Quality.SDTV, true, Quality.SDTV, true }, | ||||||
|             new object[] { QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false } |             new object[] { Quality.WEBDL1080p, false, Quality.WEBDL1080p, false, Quality.WEBDL1080p, false } | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("IsUpgradeTestCases")] |         [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) |             new QualityUpgradeSpecification().IsSatisfiedBy(new QualityModel(current, currentProper), new QualityModel(newQuality, newProper), cutoff) | ||||||
|                     .Should().Be(expected); |                     .Should().Be(expected); | ||||||
|   | |||||||
| @@ -6,12 +6,12 @@ using System.Linq; | |||||||
| using FizzWare.NBuilder; | using FizzWare.NBuilder; | ||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.DecisionEngineTests | namespace NzbDrone.Core.Test.DecisionEngineTests | ||||||
| @@ -33,20 +33,20 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             Mocker.Resolve<QualityUpgradeSpecification>(); |             Mocker.Resolve<QualityUpgradeSpecification>(); | ||||||
|             _upgradeDisk = Mocker.Resolve<UpgradeDiskSpecification>(); |             _upgradeDisk = Mocker.Resolve<UpgradeDiskSpecification>(); | ||||||
|  |  | ||||||
|             firstFile = 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 = QualityTypes.Bluray1080p, Proper = true, DateAdded = DateTime.Now }; |             secondFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = true, DateAdded = DateTime.Now }; | ||||||
|  |  | ||||||
|             var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = null } }; |             var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = null } }; | ||||||
|             var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = secondFile }, new Episode { EpisodeFile = null } }; |             var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = secondFile }, new Episode { EpisodeFile = null } }; | ||||||
|  |  | ||||||
|             var fakeSeries = Builder<Series>.CreateNew() |             var fakeSeries = Builder<Series>.CreateNew() | ||||||
|                          .With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p }) |                          .With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p }) | ||||||
|                          .Build(); |                          .Build(); | ||||||
|  |  | ||||||
|             parseResultMulti = new EpisodeParseResult |             parseResultMulti = new EpisodeParseResult | ||||||
|             { |             { | ||||||
|                 Series = fakeSeries, |                 Series = fakeSeries, | ||||||
|                 Quality = new QualityModel(QualityTypes.DVD, true), |                 Quality = new QualityModel(Quality.DVD, true), | ||||||
|                 EpisodeNumbers = new List<int> { 3, 4 }, |                 EpisodeNumbers = new List<int> { 3, 4 }, | ||||||
|                 SeasonNumber = 12, |                 SeasonNumber = 12, | ||||||
|                 Episodes = doubleEpisodeList |                 Episodes = doubleEpisodeList | ||||||
| @@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle = new EpisodeParseResult |             parseResultSingle = new EpisodeParseResult | ||||||
|             { |             { | ||||||
|                 Series = fakeSeries, |                 Series = fakeSeries, | ||||||
|                 Quality = new QualityModel(QualityTypes.DVD, true), |                 Quality = new QualityModel(Quality.DVD, true), | ||||||
|                 EpisodeNumbers = new List<int> { 3 }, |                 EpisodeNumbers = new List<int> { 3 }, | ||||||
|                 SeasonNumber = 12, |                 SeasonNumber = 12, | ||||||
|                 Episodes = singleEpisodeList |                 Episodes = singleEpisodeList | ||||||
| @@ -64,12 +64,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|  |  | ||||||
|         private void WithFirstFileUpgradable() |         private void WithFirstFileUpgradable() | ||||||
|         { |         { | ||||||
|             firstFile.Quality = QualityTypes.SDTV; |             firstFile.Quality = Quality.SDTV; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private void WithSecondFileUpgradable() |         private void WithSecondFileUpgradable() | ||||||
|         { |         { | ||||||
|             secondFile.Quality = QualityTypes.SDTV; |             secondFile.Quality = Quality.SDTV; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         [Test] |         [Test] | ||||||
| @@ -118,9 +118,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|         [Test] |         [Test] | ||||||
|         public void should_not_be_upgradable_if_qualities_are_the_same() |         public void should_not_be_upgradable_if_qualities_are_the_same() | ||||||
|         { |         { | ||||||
|             firstFile.Quality = QualityTypes.WEBDL1080p; |             firstFile.Quality = Quality.WEBDL1080p; | ||||||
|             firstFile.Proper = false; |             firstFile.Proper = false; | ||||||
|             parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false); |             parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false); | ||||||
|             _upgradeDisk.IsSatisfiedBy(parseResultSingle).Should().BeFalse(); |             _upgradeDisk.IsSatisfiedBy(parseResultSingle).Should().BeFalse(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,12 +6,12 @@ using FizzWare.NBuilder; | |||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.History; | using NzbDrone.Core.History; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.DecisionEngineTests | namespace NzbDrone.Core.Test.DecisionEngineTests | ||||||
| @@ -42,13 +42,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|                                                        }; |                                                        }; | ||||||
|  |  | ||||||
|             fakeSeries = Builder<Series>.CreateNew() |             fakeSeries = Builder<Series>.CreateNew() | ||||||
|                          .With(c => c.QualityProfile = new QualityProfile { Cutoff = QualityTypes.Bluray1080p }) |                          .With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p }) | ||||||
|                          .Build(); |                          .Build(); | ||||||
|  |  | ||||||
|             parseResultMulti = new EpisodeParseResult |             parseResultMulti = new EpisodeParseResult | ||||||
|             { |             { | ||||||
|                 Series = fakeSeries, |                 Series = fakeSeries, | ||||||
|                 Quality = new QualityModel(QualityTypes.DVD, true), |                 Quality = new QualityModel(Quality.DVD, true), | ||||||
|                 EpisodeNumbers = new List<int> { 3, 4 }, |                 EpisodeNumbers = new List<int> { 3, 4 }, | ||||||
|                 SeasonNumber = 12, |                 SeasonNumber = 12, | ||||||
|                 Episodes = doubleEpisodeList |                 Episodes = doubleEpisodeList | ||||||
| @@ -57,14 +57,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|             parseResultSingle = new EpisodeParseResult |             parseResultSingle = new EpisodeParseResult | ||||||
|             { |             { | ||||||
|                 Series = fakeSeries, |                 Series = fakeSeries, | ||||||
|                 Quality = new QualityModel(QualityTypes.DVD, true), |                 Quality = new QualityModel(Quality.DVD, true), | ||||||
|                 EpisodeNumbers = new List<int> { 3 }, |                 EpisodeNumbers = new List<int> { 3 }, | ||||||
|                 SeasonNumber = 12, |                 SeasonNumber = 12, | ||||||
|                 Episodes = singleEpisodeList |                 Episodes = singleEpisodeList | ||||||
|             }; |             }; | ||||||
|  |  | ||||||
|             firstQuality = new QualityModel(QualityTypes.Bluray1080p, true); |             firstQuality = new QualityModel(Quality.Bluray1080p, true); | ||||||
|             secondQuality = new QualityModel(QualityTypes.Bluray1080p, true); |             secondQuality = new QualityModel(Quality.Bluray1080p, true); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality); |             Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality); | ||||||
|             Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 4)).Returns(secondQuality); |             Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 4)).Returns(secondQuality); | ||||||
| @@ -73,12 +73,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|  |  | ||||||
|         private void WithFirstReportUpgradable() |         private void WithFirstReportUpgradable() | ||||||
|         { |         { | ||||||
|             firstQuality.Quality = QualityTypes.SDTV; |             firstQuality.Quality = Quality.SDTV; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private void WithSecondReportUpgradable() |         private void WithSecondReportUpgradable() | ||||||
|         { |         { | ||||||
|             secondQuality.Quality = QualityTypes.SDTV; |             secondQuality.Quality = Quality.SDTV; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -120,9 +120,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|         [Test] |         [Test] | ||||||
|         public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing() |         public void should_not_be_upgradable_if_episode_is_of_same_quality_as_existing() | ||||||
|         { |         { | ||||||
|             fakeSeries.QualityProfile = new QualityProfile { Cutoff = QualityTypes.WEBDL1080p }; |             fakeSeries.QualityProfile = new QualityProfile { Cutoff = Quality.WEBDL1080p }; | ||||||
|             parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false); |             parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false); | ||||||
|             firstQuality = new QualityModel(QualityTypes.WEBDL1080p, false); |             firstQuality = new QualityModel(Quality.WEBDL1080p, false); | ||||||
|  |  | ||||||
|             Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality); |             Mocker.GetMock<IHistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.Id, 12, 3)).Returns(firstQuality); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,11 +5,11 @@ using FizzWare.NBuilder; | |||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using Moq; | using Moq; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.DecisionEngineTests | namespace NzbDrone.Core.Test.DecisionEngineTests | ||||||
| @@ -20,8 +20,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|     { |     { | ||||||
|         private void WithWebdlCutoff() |         private void WithWebdlCutoff() | ||||||
|         { |         { | ||||||
|             var profile = new QualityProfile { Cutoff = QualityTypes.WEBDL720p }; |             var profile = new QualityProfile { Cutoff = Quality.WEBDL720p }; | ||||||
|             Mocker.GetMock<QualityProvider>().Setup(s => s.Get(It.IsAny<int>())).Returns(profile); |             Mocker.GetMock<QualityProfileService>().Setup(s => s.Get(It.IsAny<int>())).Returns(profile); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private Series _series; |         private Series _series; | ||||||
| @@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|             _episodeFile = Builder<EpisodeFile>.CreateNew() |             _episodeFile = Builder<EpisodeFile>.CreateNew() | ||||||
|                     .With(f => f.Quality = QualityTypes.SDTV) |                     .With(f => f.Quality = Quality.SDTV) | ||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|             _episode = Builder<Episode>.CreateNew() |             _episode = Builder<Episode>.CreateNew() | ||||||
| @@ -76,7 +76,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|         { |         { | ||||||
|             WithWebdlCutoff(); |             WithWebdlCutoff(); | ||||||
|  |  | ||||||
|             _episodeFile.Quality = QualityTypes.WEBDL720p; |             _episodeFile.Quality = Quality.WEBDL720p; | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             bool result = Mocker.Resolve<UpgradePossibleSpecification>().IsSatisfiedBy(_episode); |             bool result = Mocker.Resolve<UpgradePossibleSpecification>().IsSatisfiedBy(_episode); | ||||||
| @@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests | |||||||
|         { |         { | ||||||
|             WithWebdlCutoff(); |             WithWebdlCutoff(); | ||||||
|  |  | ||||||
|             _episodeFile.Quality = QualityTypes.Bluray720p; |             _episodeFile.Quality = Quality.Bluray720p; | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             bool result = Mocker.Resolve<UpgradePossibleSpecification>().IsSatisfiedBy(_episode); |             bool result = Mocker.Resolve<UpgradePossibleSpecification>().IsSatisfiedBy(_episode); | ||||||
|   | |||||||
| @@ -4,9 +4,9 @@ using System.Linq; | |||||||
| using FizzWare.NBuilder; | using FizzWare.NBuilder; | ||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test | namespace NzbDrone.Core.Test | ||||||
| @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test | |||||||
|             parseResult.EpisodeNumbers = new List<int> { 3 }; |             parseResult.EpisodeNumbers = new List<int> { 3 }; | ||||||
|             parseResult.FullSeason = false; |             parseResult.FullSeason = false; | ||||||
|             parseResult.AirDate = null; |             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"); |             parseResult.ToString().Should().Be("My Series - S12E03 HDTV-720p"); | ||||||
| @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test | |||||||
|             parseResult.EpisodeNumbers = new List<int> { 3 }; |             parseResult.EpisodeNumbers = new List<int> { 3 }; | ||||||
|             parseResult.FullSeason = false; |             parseResult.FullSeason = false; | ||||||
|             parseResult.AirDate = null; |             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]"); |             parseResult.ToString().Should().Be("My Series - S12E03 HDTV-720p [proper]"); | ||||||
| @@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test | |||||||
|             parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 }; |             parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 }; | ||||||
|             parseResult.FullSeason = false; |             parseResult.FullSeason = false; | ||||||
|             parseResult.AirDate = null; |             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"); |             parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV-720p"); | ||||||
| @@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test | |||||||
|             parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 }; |             parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 }; | ||||||
|             parseResult.FullSeason = false; |             parseResult.FullSeason = false; | ||||||
|             parseResult.AirDate = null; |             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]"); |             parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV-720p [proper]"); | ||||||
| @@ -84,7 +84,7 @@ namespace NzbDrone.Core.Test | |||||||
|             parseResult.SeasonNumber = 12; |             parseResult.SeasonNumber = 12; | ||||||
|             parseResult.FullSeason = true; |             parseResult.FullSeason = true; | ||||||
|             parseResult.AirDate = null; |             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"); |             parseResult.ToString().Should().Be("My Series - Season 12 HDTV-720p"); | ||||||
| @@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test | |||||||
|             parseResult.SeasonNumber = 12; |             parseResult.SeasonNumber = 12; | ||||||
|             parseResult.FullSeason = true; |             parseResult.FullSeason = true; | ||||||
|             parseResult.AirDate = null; |             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]"); |             parseResult.ToString().Should().Be("My Series - Season 12 HDTV-720p [proper]"); | ||||||
| @@ -113,7 +113,7 @@ namespace NzbDrone.Core.Test | |||||||
|             parseResult.SeasonNumber = 12; |             parseResult.SeasonNumber = 12; | ||||||
|             parseResult.FullSeason = true; |             parseResult.FullSeason = true; | ||||||
|             parseResult.AirDate = new DateTime(2010, 12, 30); |             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"); |             parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV-720p"); | ||||||
| @@ -127,7 +127,7 @@ namespace NzbDrone.Core.Test | |||||||
|             parseResult.SeasonNumber = 12; |             parseResult.SeasonNumber = 12; | ||||||
|             parseResult.FullSeason = true; |             parseResult.FullSeason = true; | ||||||
|             parseResult.AirDate = new DateTime(2010, 12, 30); |             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]"); |             parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV-720p [proper]"); | ||||||
| @@ -137,17 +137,17 @@ namespace NzbDrone.Core.Test | |||||||
|  |  | ||||||
|         public static readonly object[] SabNamingCases = |         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", Quality.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 }, "My Episode Title", Quality.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 }, "", Quality.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", Quality.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 }, "My Episode Title", Quality.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, 4 }, "", Quality.HDTV720p, true, "My Series Name - 1x02-1x04 -  [HDTV-720p] [Proper]" }, | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("SabNamingCases")] |         [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<Series>.CreateNew() |             var series = Builder<Series>.CreateNew() | ||||||
|                     .With(c => c.Title = "My Series Name") |                     .With(c => c.Title = "My Series Name") | ||||||
| @@ -187,7 +187,7 @@ namespace NzbDrone.Core.Test | |||||||
|             var parsResult = new EpisodeParseResult() |             var parsResult = new EpisodeParseResult() | ||||||
|             { |             { | ||||||
|                 AirDate = DateTime.Now, |                 AirDate = DateTime.Now, | ||||||
|                 Quality = new QualityModel(QualityTypes.Bluray720p, proper), |                 Quality = new QualityModel(Quality.Bluray720p, proper), | ||||||
|                 SeasonNumber = 1, |                 SeasonNumber = 1, | ||||||
|                 Series = series, |                 Series = series, | ||||||
|                 EpisodeTitle = "My Episode Title", |                 EpisodeTitle = "My Episode Title", | ||||||
| @@ -213,7 +213,7 @@ namespace NzbDrone.Core.Test | |||||||
|             var parsResult = new EpisodeParseResult |             var parsResult = new EpisodeParseResult | ||||||
|             { |             { | ||||||
|                 AirDate = new DateTime(2011, 12, 1), |                 AirDate = new DateTime(2011, 12, 1), | ||||||
|                 Quality = new QualityModel(QualityTypes.Bluray720p, proper), |                 Quality = new QualityModel(Quality.Bluray720p, proper), | ||||||
|                 Series = series, |                 Series = series, | ||||||
|                 EpisodeTitle = "My Episode Title", |                 EpisodeTitle = "My Episode Title", | ||||||
|                 Episodes = new List<Episode> { episode } |                 Episodes = new List<Episode> { episode } | ||||||
| @@ -242,7 +242,7 @@ namespace NzbDrone.Core.Test | |||||||
|             { |             { | ||||||
|                 AirDate = DateTime.Now, |                 AirDate = DateTime.Now, | ||||||
|                 EpisodeNumbers = new List<int> { 10, 11 }, |                 EpisodeNumbers = new List<int> { 10, 11 }, | ||||||
|                 Quality = new QualityModel(QualityTypes.HDTV720p, false), |                 Quality = new QualityModel(Quality.HDTV720p, false), | ||||||
|                 SeasonNumber = 35, |                 SeasonNumber = 35, | ||||||
|                 Series = series, |                 Series = series, | ||||||
|                 Episodes = fakeEpisodes |                 Episodes = fakeEpisodes | ||||||
|   | |||||||
| @@ -9,7 +9,6 @@ using NzbDrone.Common; | |||||||
| using NzbDrone.Core.Datastore; | using NzbDrone.Core.Datastore; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.Framework | namespace NzbDrone.Core.Test.Framework | ||||||
|   | |||||||
| @@ -5,8 +5,8 @@ using FluentAssertions; | |||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Datastore; | using NzbDrone.Core.Datastore; | ||||||
| using NzbDrone.Core.History; | using NzbDrone.Core.History; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.HistoryTests | namespace NzbDrone.Core.Test.HistoryTests | ||||||
| @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.HistoryTests | |||||||
|  |  | ||||||
|             var history = Builder<History.History>.CreateNew() |             var history = Builder<History.History>.CreateNew() | ||||||
|                 .With(c => c.Id = 0) |                 .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) |                 .With(h => h.Episode = episode) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
| @@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.HistoryTests | |||||||
|             var result = Subject.GetBestQualityInHistory(episode.SeriesId, episode.SeasonNumber, episode.EpisodeNumber); |             var result = Subject.GetBestQualityInHistory(episode.SeriesId, episode.SeasonNumber, episode.EpisodeNumber); | ||||||
|  |  | ||||||
|             result.Should().NotBeNull(); |             result.Should().NotBeNull(); | ||||||
|             result.Quality.Should().Be(QualityTypes.Bluray720p); |             result.Quality.Should().Be(Quality.Bluray720p); | ||||||
|             result.Proper.Should().BeTrue(); |             result.Proper.Should().BeTrue(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -83,15 +83,15 @@ namespace NzbDrone.Core.Test.HistoryTests | |||||||
|                     .With(c => c.Id = 0) |                     .With(c => c.Id = 0) | ||||||
|                     .With(h => h.Episode = episode) |                     .With(h => h.Episode = episode) | ||||||
|                     .TheFirst(1) |                     .TheFirst(1) | ||||||
|                     .With(h => h.Quality = new QualityModel(QualityTypes.DVD, true)) |                     .With(h => h.Quality = new QualityModel(Quality.DVD, true)) | ||||||
|                     .TheNext(1) |                     .TheNext(1) | ||||||
|                     .With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, true)) |                     .With(h => h.Quality = new QualityModel(Quality.Bluray720p, true)) | ||||||
|                     .TheNext(1) |                     .TheNext(1) | ||||||
|                     .With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, true)) |                     .With(h => h.Quality = new QualityModel(Quality.Bluray720p, true)) | ||||||
|                     .TheNext(1) |                     .TheNext(1) | ||||||
|                     .With(h => h.Quality = new QualityModel(QualityTypes.Bluray720p, false)) |                     .With(h => h.Quality = new QualityModel(Quality.Bluray720p, false)) | ||||||
|                     .TheNext(1) |                     .TheNext(1) | ||||||
|                     .With(h => h.Quality = new QualityModel(QualityTypes.SDTV, true)) |                     .With(h => h.Quality = new QualityModel(Quality.SDTV, true)) | ||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|             Db.InsertMany(history); |             Db.InsertMany(history); | ||||||
| @@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.HistoryTests | |||||||
|             var result = Subject.GetBestQualityInHistory(episode.SeriesId, episode.SeasonNumber, episode.EpisodeNumber); |             var result = Subject.GetBestQualityInHistory(episode.SeriesId, episode.SeasonNumber, episode.EpisodeNumber); | ||||||
|  |  | ||||||
|             result.Should().NotBeNull(); |             result.Should().NotBeNull(); | ||||||
|             result.Quality.Should().Be(QualityTypes.Bluray720p); |             result.Quality.Should().Be(Quality.Bluray720p); | ||||||
|             result.Proper.Should().BeTrue(); |             result.Proper.Should().BeTrue(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,8 +15,8 @@ using NzbDrone.Core.Indexers; | |||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Core.Test.Indexers; | using NzbDrone.Core.Test.Indexers; | ||||||
| using NzbDrone.Core.Test.ProviderTests; | using NzbDrone.Core.Test.ProviderTests; | ||||||
| @@ -82,7 +82,7 @@ namespace NzbDrone.Core.Test.IndexerTests | |||||||
|             const string title = "Adventure.Inc.S03E19.DVDRip.XviD-OSiTV"; |             const string title = "Adventure.Inc.S03E19.DVDRip.XviD-OSiTV"; | ||||||
|             const int season = 3; |             const int season = 3; | ||||||
|             const int episode = 19; |             const int episode = 19; | ||||||
|             var quality = QualityTypes.DVD; |             var quality = Quality.DVD; | ||||||
|  |  | ||||||
|             const string summary = "My fake summary"; |             const string summary = "My fake summary"; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,7 +15,6 @@ using NzbDrone.Core.Model; | |||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Core.Test.ProviderTests; | using NzbDrone.Core.Test.ProviderTests; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|   | |||||||
| @@ -164,7 +164,7 @@ | |||||||
|     <Compile Include="HelperTests\XElementHelperTests\ConvertToDayOfWeekFixture.cs" /> |     <Compile Include="HelperTests\XElementHelperTests\ConvertToDayOfWeekFixture.cs" /> | ||||||
|     <Compile Include="ProviderTests\TvRageProviderTests\GetUtcOffsetFixture.cs" /> |     <Compile Include="ProviderTests\TvRageProviderTests\GetUtcOffsetFixture.cs" /> | ||||||
|     <Compile Include="ProviderTests\TvRageProviderTests\SearchSeriesFixture.cs" /> |     <Compile Include="ProviderTests\TvRageProviderTests\SearchSeriesFixture.cs" /> | ||||||
|     <Compile Include="QualityTypesTest.cs" /> |     <Compile Include="Qualities\QualityFixture.cs" /> | ||||||
|     <Compile Include="EpisodeParseResultTest.cs" /> |     <Compile Include="EpisodeParseResultTest.cs" /> | ||||||
|     <Compile Include="JobTests\BacklogSearchJobTest.cs" /> |     <Compile Include="JobTests\BacklogSearchJobTest.cs" /> | ||||||
|     <Compile Include="JobTests\BannerDownloadJobTest.cs" /> |     <Compile Include="JobTests\BannerDownloadJobTest.cs" /> | ||||||
| @@ -220,7 +220,7 @@ | |||||||
|     <Compile Include="Services\ParseErrorServiceFixture.cs" /> |     <Compile Include="Services\ParseErrorServiceFixture.cs" /> | ||||||
|     <Compile Include="HelperTests\SortHelperFixture.cs" /> |     <Compile Include="HelperTests\SortHelperFixture.cs" /> | ||||||
|     <Compile Include="DecisionEngineTests\AcceptableSizeSpecificationFixture.cs" /> |     <Compile Include="DecisionEngineTests\AcceptableSizeSpecificationFixture.cs" /> | ||||||
|     <Compile Include="ProviderTests\QualityTypeProviderTest.cs" /> |     <Compile Include="Qualities\QualitySizeServiceFixture.cs" /> | ||||||
|     <Compile Include="ProviderTests\MisnamedProviderTest.cs" /> |     <Compile Include="ProviderTests\MisnamedProviderTest.cs" /> | ||||||
|     <Compile Include="JobTests\SeasonSearchJobTest.cs" /> |     <Compile Include="JobTests\SeasonSearchJobTest.cs" /> | ||||||
|     <Compile Include="JobTests\SeriesSearchJobTest.cs" /> |     <Compile Include="JobTests\SeriesSearchJobTest.cs" /> | ||||||
| @@ -243,7 +243,7 @@ | |||||||
|     <Compile Include="IndexerTests\IndexerFixture.cs" /> |     <Compile Include="IndexerTests\IndexerFixture.cs" /> | ||||||
|     <Compile Include="DecisionEngineTests\AllowedDownloadSpecificationFixture.cs" /> |     <Compile Include="DecisionEngineTests\AllowedDownloadSpecificationFixture.cs" /> | ||||||
|     <Compile Include="JobTests\JobControllerFixture.cs" /> |     <Compile Include="JobTests\JobControllerFixture.cs" /> | ||||||
|     <Compile Include="QualityTest.cs" /> |     <Compile Include="TvTests\QualityModelFixture.cs" /> | ||||||
|     <Compile Include="RootFolderTests\RootFolderServiceFixture.cs" /> |     <Compile Include="RootFolderTests\RootFolderServiceFixture.cs" /> | ||||||
|     <Compile Include="Indexers\IndexerServiceTest.cs" /> |     <Compile Include="Indexers\IndexerServiceTest.cs" /> | ||||||
|     <Compile Include="HistoryTests\HistoryServiceTest.cs" /> |     <Compile Include="HistoryTests\HistoryServiceTest.cs" /> | ||||||
| @@ -253,7 +253,7 @@ | |||||||
|     <Compile Include="Framework\TestDbHelper.cs" /> |     <Compile Include="Framework\TestDbHelper.cs" /> | ||||||
|     <Compile Include="ParserTests\ParserFixture.cs" /> |     <Compile Include="ParserTests\ParserFixture.cs" /> | ||||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> |     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||||
|     <Compile Include="QualityProfileTest.cs" /> |     <Compile Include="Qualities\QualityProfileFixture.cs" /> | ||||||
|     <Compile Include="ProviderTests\DownloadClientTests\SabProviderTests\SabProviderFixture.cs" /> |     <Compile Include="ProviderTests\DownloadClientTests\SabProviderTests\SabProviderFixture.cs" /> | ||||||
|     <Compile Include="ProviderTests\SceneMappingProviderTest.cs" /> |     <Compile Include="ProviderTests\SceneMappingProviderTest.cs" /> | ||||||
|     <Compile Include="TvTests\SeriesProviderTest.cs" /> |     <Compile Include="TvTests\SeriesProviderTest.cs" /> | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ using System; | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.ParserTests | namespace NzbDrone.Core.Test.ParserTests | ||||||
| @@ -15,86 +15,86 @@ namespace NzbDrone.Core.Test.ParserTests | |||||||
|     { |     { | ||||||
|         public static object[] QualityParserCases = |         public static object[] QualityParserCases = | ||||||
|         { |         { | ||||||
|             new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD, 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", QualityTypes.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", QualityTypes.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", QualityTypes.HDTV720p, 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", QualityTypes.SDTV, false }, |             new object[] { "this has no extention or periods HDTV", Quality.SDTV, false }, | ||||||
|             new object[] { "Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV, false }, |             new object[] { "Chuck.S04E05.HDTV.XviD-LOL", Quality.SDTV, false }, | ||||||
|             new object[] { "The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD, 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", QualityTypes.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", QualityTypes.SDTV, false }, |             new object[] { "The.Girls.Next.Door.S03E06.HDTV-WiDE", Quality.SDTV, false }, | ||||||
|             new object[] { "Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.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", QualityTypes.WEBDL720p, 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", QualityTypes.HDTV720p, false }, |             new object[] { "Sonny.With.a.Chance.S02E15.720p", Quality.HDTV720p, false }, | ||||||
|             new object[] { "Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV720p, false }, |             new object[] { "Sonny.With.a.Chance.S02E15.mkv", Quality.HDTV720p, false }, | ||||||
|             new object[] { "Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV, false }, |             new object[] { "Sonny.With.a.Chance.S02E15.avi", Quality.SDTV, false }, | ||||||
|             new object[] { "Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV, false }, |             new object[] { "Sonny.With.a.Chance.S02E15.xvid", Quality.SDTV, false }, | ||||||
|             new object[] { "Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV, false }, |             new object[] { "Sonny.With.a.Chance.S02E15.divx", Quality.SDTV, false }, | ||||||
|             new object[] { "Sonny.With.a.Chance.S02E15", QualityTypes.Unknown, false }, |             new object[] { "Sonny.With.a.Chance.S02E15", Quality.Unknown, false }, | ||||||
|             new object[] { "Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV720p, false }, |             new object[] { "Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", Quality.HDTV720p, false }, | ||||||
|             new object[] { "Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV720p, false }, |             new object[] { "Chuck - S22E03 - MoneyBART - HD TV.mkv", Quality.HDTV720p, false }, | ||||||
|             new object[] { "Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p, 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", QualityTypes.Bluray1080p, 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", QualityTypes.WEBDL720p, 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", QualityTypes.DVD, 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", QualityTypes.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", QualityTypes.Unknown, false }, |             new object[] { "Law & Order: Special Victims Unit - 11x11 - Quickie", Quality.Unknown, false }, | ||||||
|             new object[] { "(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown, false }, |             new object[] { "(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", Quality.Unknown, false }, | ||||||
|             new object[] { "S07E23 - [HDTV-720p].mkv ", QualityTypes.HDTV720p, false }, |             new object[] { "S07E23 - [HDTV-720p].mkv ", Quality.HDTV720p, false }, | ||||||
|             new object[] { "S07E23 - [WEBDL].mkv ", QualityTypes.WEBDL720p, false }, |             new object[] { "S07E23 - [WEBDL].mkv ", Quality.WEBDL720p, false }, | ||||||
|             new object[] { "S07E23.mkv ", QualityTypes.HDTV720p, false }, |             new object[] { "S07E23.mkv ", Quality.HDTV720p, false }, | ||||||
|             new object[] { "S07E23 .avi ", QualityTypes.SDTV, false }, |             new object[] { "S07E23 .avi ", Quality.SDTV, false }, | ||||||
|             new object[] { "WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3.-HELLYWOOD.avi", QualityTypes.DVD, 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", QualityTypes.Bluray720p, 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", QualityTypes.RAWHD, false }, |             new object[] { "The Voice S01E11 The Finals 1080i HDTV DD5.1 MPEG2-TrollHD", Quality.RAWHD, false }, | ||||||
|             new object[] { "Nikita S02E01 HDTV XviD 2HD", QualityTypes.SDTV, false }, |             new object[] { "Nikita S02E01 HDTV XviD 2HD", Quality.SDTV, false }, | ||||||
|             new object[] { "Gossip Girl S05E11 PROPER HDTV XviD 2HD", QualityTypes.SDTV, true }, |             new object[] { "Gossip Girl S05E11 PROPER HDTV XviD 2HD", Quality.SDTV, true }, | ||||||
|             new object[] { "The Jonathan Ross Show S02E08 HDTV x264 FTP", QualityTypes.SDTV, false }, |             new object[] { "The Jonathan Ross Show S02E08 HDTV x264 FTP", Quality.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-TLA", Quality.SDTV, false }, | ||||||
|             new object[] { "White.Van.Man.2011.S02E01.WS.PDTV.x264-REPACK-TLA", QualityTypes.SDTV, true }, |             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", QualityTypes.DVD, 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", QualityTypes.HDTV720p, 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", QualityTypes.SDTV, false }, |             new object[] { "The Real Housewives of Vancouver S01E04 DSR x264 2HD", Quality.SDTV, false }, | ||||||
|             new object[] { "Vanguard S01E04 Mexicos Death Train DSR x264 MiNDTHEGAP", QualityTypes.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", QualityTypes.WEBDL720p, 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", QualityTypes.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", QualityTypes.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", QualityTypes.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", QualityTypes.WEBDL1080p, 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", QualityTypes.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", QualityTypes.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", QualityTypes.WEBDL1080p, true }, |             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", QualityTypes.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", QualityTypes.WEBDL1080p, false }, |             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", QualityTypes.WEBDL480p, 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", QualityTypes.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", QualityTypes.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", QualityTypes.WEBDL1080p, 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", QualityTypes.HDTV1080p, false }, |             new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.X264-QCF", Quality.HDTV1080p, false }, | ||||||
|             new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.x264-QCF", QualityTypes.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", QualityTypes.HDTV1080p, true }, |             new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.proper.X264-QCF", Quality.HDTV1080p, true }, | ||||||
|             new object[] { "Dexter - S01E01 - Title [HDTV]", QualityTypes.HDTV720p, false }, |             new object[] { "Dexter - S01E01 - Title [HDTV]", Quality.HDTV720p, false }, | ||||||
|             new object[] { "Dexter - S01E01 - Title [HDTV-720p]", QualityTypes.HDTV720p, false }, |             new object[] { "Dexter - S01E01 - Title [HDTV-720p]", Quality.HDTV720p, false }, | ||||||
|             new object[] { "Dexter - S01E01 - Title [HDTV-1080p]", QualityTypes.HDTV1080p, false }, |             new object[] { "Dexter - S01E01 - Title [HDTV-1080p]", Quality.HDTV1080p, false }, | ||||||
|             new object[] { "POI S02E11 1080i HDTV DD5.1 MPEG2-TrollHD", QualityTypes.RAWHD, 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", QualityTypes.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 = |         public static object[] SelfQualityParserCases = | ||||||
|         { |         { | ||||||
|             new object[] { QualityTypes.SDTV }, |             new object[] { Quality.SDTV }, | ||||||
|             new object[] { QualityTypes.DVD }, |             new object[] { Quality.DVD }, | ||||||
|             new object[] { QualityTypes.WEBDL480p }, |             new object[] { Quality.WEBDL480p }, | ||||||
|             new object[] { QualityTypes.HDTV720p }, |             new object[] { Quality.HDTV720p }, | ||||||
|             new object[] { QualityTypes.WEBDL720p }, |             new object[] { Quality.WEBDL720p }, | ||||||
|             new object[] { QualityTypes.WEBDL1080p }, |             new object[] { Quality.WEBDL1080p }, | ||||||
|             new object[] { QualityTypes.Bluray720p }, |             new object[] { Quality.Bluray720p }, | ||||||
|             new object[] { QualityTypes.Bluray1080p } |             new object[] { Quality.Bluray1080p } | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("QualityParserCases")] |         [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); |             var result = Parser.ParseQuality(postTitle); | ||||||
|             result.Quality.Should().Be(quality); |             result.Quality.Should().Be(quality); | ||||||
| @@ -102,7 +102,7 @@ namespace NzbDrone.Core.Test.ParserTests | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("SelfQualityParserCases")] |         [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 fileName = String.Format("My series S01E01 [{0}]", quality); | ||||||
|             var result = Parser.ParseQuality(fileName); |             var result = Parser.ParseQuality(fileName); | ||||||
|   | |||||||
| @@ -11,7 +11,6 @@ using NzbDrone.Core.Tv; | |||||||
| using NzbDrone.Core.Model.Notification; | using NzbDrone.Core.Model.Notification; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|   | |||||||
| @@ -8,12 +8,12 @@ using FluentAssertions; | |||||||
| using Moq; | using Moq; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Common; | using NzbDrone.Common; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| @@ -106,7 +106,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|             Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByFileId(episodeFile.EpisodeFileId)) |             Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByFileId(episodeFile.EpisodeFileId)) | ||||||
|                     .Returns(episode); |                     .Returns(episode); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>().Setup(s => s.GetNewFilename(It.IsAny<IList<Episode>>(), series, QualityTypes.Unknown, false, It.IsAny<EpisodeFile>())) |             Mocker.GetMock<MediaFileProvider>().Setup(s => s.GetNewFilename(It.IsAny<IList<Episode>>(), series, Quality.Unknown, false, It.IsAny<EpisodeFile>())) | ||||||
|                 .Returns(newFilename); |                 .Returns(newFilename); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>().Setup(s => s.CalculateFilePath(It.IsAny<Series>(), It.IsAny<int>(), It.IsAny<string>(), It.IsAny<string>())) |             Mocker.GetMock<MediaFileProvider>().Setup(s => s.CalculateFilePath(It.IsAny<Series>(), It.IsAny<int>(), It.IsAny<string>(), It.IsAny<string>())) | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ using NzbDrone.Core.Model; | |||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
|   | |||||||
| @@ -12,7 +12,6 @@ using NzbDrone.Core.Model; | |||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
|   | |||||||
| @@ -6,12 +6,12 @@ using FluentAssertions; | |||||||
| using Moq; | using Moq; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Common; | using NzbDrone.Common; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| @@ -23,9 +23,9 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|     { |     { | ||||||
|         public static object[] ImportTestCases = |         public static object[] ImportTestCases = | ||||||
|         { |         { | ||||||
|             new object[] { QualityTypes.SDTV, false }, |             new object[] { Quality.SDTV, false }, | ||||||
|             new object[] { QualityTypes.DVD, true }, |             new object[] { Quality.DVD, true }, | ||||||
|             new object[] { QualityTypes.HDTV720p, false } |             new object[] { Quality.HDTV720p, false } | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         private readonly long SIZE = 80.Megabytes(); |         private readonly long SIZE = 80.Megabytes(); | ||||||
| @@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("ImportTestCases")] |         [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"; |             const string newFile = @"WEEDS.S03E01.DUAL.1080p.HELLYWOOD.mkv"; | ||||||
|  |  | ||||||
| @@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|             var fakeSeries = Builder<Series>.CreateNew().Build(); |             var fakeSeries = Builder<Series>.CreateNew().Build(); | ||||||
|             var fakeEpisode = Builder<Episode>.CreateNew() |             var fakeEpisode = Builder<Episode>.CreateNew() | ||||||
|                 .With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew() |                 .With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew() | ||||||
|                                                .With(g => g.Quality = (QualityTypes)currentFileQuality) |                                                .With(g => g.Quality = (Quality)currentFileQuality) | ||||||
|                                                .And(g => g.Proper = currentFileProper).Build() |                                                .And(g => g.Proper = currentFileProper).Build() | ||||||
|                 ).Build(); |                 ).Build(); | ||||||
|              |              | ||||||
| @@ -113,7 +113,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|             var fakeSeries = Builder<Series>.CreateNew().Build(); |             var fakeSeries = Builder<Series>.CreateNew().Build(); | ||||||
|             var fakeEpisode = Builder<Episode>.CreateNew() |             var fakeEpisode = Builder<Episode>.CreateNew() | ||||||
|                 .With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew() |                 .With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew() | ||||||
|                         .With(e => e.Quality = QualityTypes.Bluray720p).Build() |                         .With(e => e.Quality = Quality.Bluray720p).Build() | ||||||
|                      ) |                      ) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
| @@ -214,7 +214,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|             var fakeSeries = Builder<Series>.CreateNew().Build(); |             var fakeSeries = Builder<Series>.CreateNew().Build(); | ||||||
|             var fakeEpisode = Builder<Episode>.CreateNew() |             var fakeEpisode = Builder<Episode>.CreateNew() | ||||||
|                 .With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew() |                 .With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew() | ||||||
|                         .With(e => e.Quality = QualityTypes.SDTV).Build() |                         .With(e => e.Quality = Quality.SDTV).Build() | ||||||
|                      ) |                      ) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
| @@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|             var fakeEpisodes = Builder<Episode>.CreateListOfSize(2) |             var fakeEpisodes = Builder<Episode>.CreateListOfSize(2) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew() |                 .With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew() | ||||||
|                                                .With(f => f.Quality = QualityTypes.SDTV) |                                                .With(f => f.Quality = Quality.SDTV) | ||||||
|                                                .Build()) |                                                .Build()) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
| @@ -278,7 +278,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|             var fakeEpisodes = Builder<Episode>.CreateListOfSize(2) |             var fakeEpisodes = Builder<Episode>.CreateListOfSize(2) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew() |                 .With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew() | ||||||
|                                                .With(f => f.Quality = QualityTypes.Bluray720p) |                                                .With(f => f.Quality = Quality.Bluray720p) | ||||||
|                                                .Build()) |                                                .Build()) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
| @@ -310,7 +310,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|  |  | ||||||
|             var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2) |             var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.Quality = QualityTypes.SDTV) |                 .With(e => e.Quality = Quality.SDTV) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
|             var fakeEpisode1 = Builder<Episode>.CreateNew() |             var fakeEpisode1 = Builder<Episode>.CreateNew() | ||||||
|   | |||||||
| @@ -10,12 +10,12 @@ using NUnit.Framework; | |||||||
| using NzbDrone.Common; | using NzbDrone.Common; | ||||||
| using NzbDrone.Core.Download; | using NzbDrone.Core.Download; | ||||||
| using NzbDrone.Core.ExternalNotification; | using NzbDrone.Core.ExternalNotification; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| @@ -57,7 +57,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|                 .Returns(fakeEpisode); |                 .Returns(fakeEpisode); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny<QualityTypes>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>())) |                 .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny<Quality>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>())) | ||||||
|                 .Returns(filename); |                 .Returns(filename); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
| @@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|             var file = Builder<EpisodeFile>.CreateNew() |             var file = Builder<EpisodeFile>.CreateNew() | ||||||
|                     .With(f => f.SeriesId = fakeSeries.Id) |                     .With(f => f.SeriesId = fakeSeries.Id) | ||||||
|                     .With(f => f.Path = currentFilename) |                     .With(f => f.Path = currentFilename) | ||||||
|                     .With(f => f.Quality = QualityTypes.WEBDL720p) |                     .With(f => f.Quality = Quality.WEBDL720p) | ||||||
|                     .With(f => f.Proper = false) |                     .With(f => f.Proper = false) | ||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
| @@ -107,7 +107,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|                   .Returns(fakeEpisode); |                   .Returns(fakeEpisode); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                   .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny<QualityTypes>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>())) |                   .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny<Quality>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>())) | ||||||
|                   .Returns(filename); |                   .Returns(filename); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
| @@ -146,7 +146,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|             var file = Builder<EpisodeFile>.CreateNew() |             var file = Builder<EpisodeFile>.CreateNew() | ||||||
|                     .With(f => f.SeriesId = fakeSeries.Id) |                     .With(f => f.SeriesId = fakeSeries.Id) | ||||||
|                     .With(f => f.Path = currentFilename) |                     .With(f => f.Path = currentFilename) | ||||||
|                     .With(f => f.Quality = QualityTypes.WEBDL720p) |                     .With(f => f.Quality = Quality.WEBDL720p) | ||||||
|                     .With(f => f.Proper = false) |                     .With(f => f.Proper = false) | ||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
| @@ -159,7 +159,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests | |||||||
|                 .Returns(fakeEpisode); |                 .Returns(fakeEpisode); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny<QualityTypes>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>())) |                 .Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny<Quality>(), It.IsAny<bool>(), It.IsAny<EpisodeFile>())) | ||||||
|                 .Returns(filename); |                 .Returns(filename); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|   | |||||||
| @@ -9,13 +9,13 @@ using Moq; | |||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Common; | using NzbDrone.Common; | ||||||
| using NzbDrone.Core.Configuration; | using NzbDrone.Core.Configuration; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Model.Sabnzbd; | using NzbDrone.Core.Model.Sabnzbd; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Providers.DownloadClients; | using NzbDrone.Core.Providers.DownloadClients; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|  |  | ||||||
| @@ -130,7 +130,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests | |||||||
|                                       EpisodeTitle = "Title", |                                       EpisodeTitle = "Title", | ||||||
|                                       EpisodeNumbers = new List<int> { 5 }, |                                       EpisodeNumbers = new List<int> { 5 }, | ||||||
|                                       SeasonNumber = 1, |                                       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") }, |                                       Series = new Series { Title = "30 Rock", CleanTitle = Parser.NormalizeTitle("30 Rock") }, | ||||||
|                                   }; |                                   }; | ||||||
|  |  | ||||||
| @@ -147,7 +147,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests | |||||||
|  |  | ||||||
|             var parseResult = new EpisodeParseResult |             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), |                 AirDate = new DateTime(2011, 12, 01), | ||||||
|                 Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesType = SeriesType.Daily }, |                 Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesType = SeriesType.Daily }, | ||||||
|             }; |             }; | ||||||
| @@ -166,7 +166,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests | |||||||
|  |  | ||||||
|             var parseResult = new EpisodeParseResult |             var parseResult = new EpisodeParseResult | ||||||
|             { |             { | ||||||
|                 Quality = new QualityModel { Quality = QualityTypes.Bluray720p, Proper = false }, |                 Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false }, | ||||||
|                 FullSeason = true, |                 FullSeason = true, | ||||||
|                 SeasonNumber = 5, |                 SeasonNumber = 5, | ||||||
|                 Series = new Series { Title = "My Name is earl", CleanTitle = Parser.NormalizeTitle("My Name is earl") }, |                 Series = new Series { Title = "My Name is earl", CleanTitle = Parser.NormalizeTitle("My Name is earl") }, | ||||||
| @@ -179,17 +179,17 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests | |||||||
|  |  | ||||||
|         public static object[] DifferentEpisodeCases = |         public static object[] DifferentEpisodeCases = | ||||||
|         { |         { | ||||||
|             new object[] { 2, new[] { 5 }, "30 Rock", QualityTypes.Bluray1080p, true }, //Same Series, Different Season, Episode |             new object[] { 2, new[] { 5 }, "30 Rock", Quality.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 }, "30 Rock", Quality.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, 7, 8 }, "30 Rock", Quality.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[] { 6 }, "Some other show", Quality.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 }, "Rock", Quality.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", Quality.Bluray720p, false }, //Same series, higher quality | ||||||
|             new object[] { 1, new[] { 5 }, "30 Rock", QualityTypes.HDTV720p, true } //Same series, higher quality |             new object[] { 1, new[] { 5 }, "30 Rock", Quality.HDTV720p, true } //Same series, higher quality | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("DifferentEpisodeCases")] |         [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(); |             WithFullQueue(); | ||||||
|  |  | ||||||
| @@ -209,16 +209,16 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests | |||||||
|  |  | ||||||
|         public static object[] LowerQualityCases = |         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", Quality.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", Quality.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 }, "30 RocK", Quality.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", Quality.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[] { 1, new[] { 5, 6 }, "30 RocK", Quality.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[] { 4, new[] { 8 }, "Parks and Recreation", Quality.WEBDL720p, false }, //Same Series, same quality | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("LowerQualityCases")] |         [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(); |             WithFullQueue(); | ||||||
|  |  | ||||||
| @@ -238,14 +238,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests | |||||||
|  |  | ||||||
|         public static object[] DuplicateItemsCases = |         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", Quality.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", Quality.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 }, "The Big Bang Theory", Quality.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, 14 }, "The Big Bang Theory", Quality.HDTV720p, false } //Same Series, same quality, one diffrent episode | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("DuplicateItemsCases")] |         [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(); |             WithFullQueue(); | ||||||
|  |  | ||||||
| @@ -265,14 +265,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests | |||||||
|  |  | ||||||
|         public static object[] DoubleEpisodeCases = |         public static object[] DoubleEpisodeCases = | ||||||
|         { |         { | ||||||
|             new object[] { 3, new[] { 14, 15 }, "My Name Is Earl", QualityTypes.Bluray720p, false }, |             new object[] { 3, new[] { 14, 15 }, "My Name Is Earl", Quality.Bluray720p, false }, | ||||||
|             new object[] { 3, new[] { 15 }, "My Name Is Earl", QualityTypes.DVD, false }, |             new object[] { 3, new[] { 15 }, "My Name Is Earl", Quality.DVD, false }, | ||||||
|             new object[] { 3, new[] { 14 }, "My Name Is Earl", QualityTypes.HDTV720p, false }, |             new object[] { 3, new[] { 14 }, "My Name Is Earl", Quality.HDTV720p, false }, | ||||||
|             new object[] { 3, new[] { 15, 16 }, "My Name Is Earl", QualityTypes.SDTV, false } |             new object[] { 3, new[] { 15, 16 }, "My Name Is Earl", Quality.SDTV, false } | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         [Test, TestCaseSource("DoubleEpisodeCases")] |         [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(); |             WithFullQueue(); | ||||||
|  |  | ||||||
| @@ -300,7 +300,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests | |||||||
|                 EpisodeTitle = "Title", |                 EpisodeTitle = "Title", | ||||||
|                 EpisodeNumbers = new List<int> { 1 }, |                 EpisodeNumbers = new List<int> { 1 }, | ||||||
|                 SeasonNumber = 2, |                 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") }, |                 Series = new Series { Title = "Test", CleanTitle = Parser.NormalizeTitle("Test") }, | ||||||
|             }; |             }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,7 +16,6 @@ using NzbDrone.Core.Model.Sabnzbd; | |||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Providers.DownloadClients; | using NzbDrone.Core.Providers.DownloadClients; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,10 +7,10 @@ using Moq; | |||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Configuration; | using NzbDrone.Core.Configuration; | ||||||
| using NzbDrone.Core.Download; | using NzbDrone.Core.Download; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers.DownloadClients; | using NzbDrone.Core.Providers.DownloadClients; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| // ReSharper disable InconsistentNaming | // ReSharper disable InconsistentNaming | ||||||
| @@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests | |||||||
|                     .Setup(c => c.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(episodes); |                     .Setup(c => c.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(episodes); | ||||||
|  |  | ||||||
|             return Builder<EpisodeParseResult>.CreateNew() |             return Builder<EpisodeParseResult>.CreateNew() | ||||||
|                 .With(c => c.Quality = new QualityModel(QualityTypes.DVD, false)) |                 .With(c => c.Quality = new QualityModel(Quality.DVD, false)) | ||||||
|                 .With(c => c.Series = Builder<Series>.CreateNew().Build()) |                 .With(c => c.Series = Builder<Series>.CreateNew().Build()) | ||||||
|                 .With(c => c.EpisodeNumbers = new List<int> { 2 }) |                 .With(c => c.EpisodeNumbers = new List<int> { 2 }) | ||||||
|                 .With(c => c.Episodes = episodes) |                 .With(c => c.Episodes = episodes) | ||||||
|   | |||||||
| @@ -8,7 +8,6 @@ using NzbDrone.Core.ExternalNotification; | |||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,12 +9,12 @@ using Moq; | |||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Common; | using NzbDrone.Common; | ||||||
| using NzbDrone.Core.Configuration; | using NzbDrone.Core.Configuration; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
|  |  | ||||||
| @@ -29,12 +29,12 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|         { |         { | ||||||
|             var firstSeriesFiles = Builder<EpisodeFile>.CreateListOfSize(10) |             var firstSeriesFiles = Builder<EpisodeFile>.CreateListOfSize(10) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(c => c.Quality = QualityTypes.SDTV) |                 .With(c => c.Quality = Quality.SDTV) | ||||||
|                 .With(s => s.SeriesId = 12).Build(); |                 .With(s => s.SeriesId = 12).Build(); | ||||||
|  |  | ||||||
|             var secondSeriesFiles = Builder<EpisodeFile>.CreateListOfSize(10) |             var secondSeriesFiles = Builder<EpisodeFile>.CreateListOfSize(10) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(c => c.Quality = QualityTypes.SDTV) |                 .With(c => c.Quality = Quality.SDTV) | ||||||
|                 .With(s => s.SeriesId = 20).Build(); |                 .With(s => s.SeriesId = 20).Build(); | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -56,14 +56,14 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|         { |         { | ||||||
|             var firstSeriesFiles = Builder<EpisodeFile>.CreateListOfSize(10) |             var firstSeriesFiles = Builder<EpisodeFile>.CreateListOfSize(10) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(c => c.Quality = QualityTypes.SDTV) |                 .With(c => c.Quality = Quality.SDTV) | ||||||
|                 .With(s => s.SeriesId = 12) |                 .With(s => s.SeriesId = 12) | ||||||
|                 .With(s => s.SeasonNumber = 1) |                 .With(s => s.SeasonNumber = 1) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
|             var secondSeriesFiles = Builder<EpisodeFile>.CreateListOfSize(10) |             var secondSeriesFiles = Builder<EpisodeFile>.CreateListOfSize(10) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(c => c.Quality = QualityTypes.SDTV) |                 .With(c => c.Quality = Quality.SDTV) | ||||||
|                 .With(s => s.SeriesId = 12) |                 .With(s => s.SeriesId = 12) | ||||||
|                 .With(s => s.SeasonNumber = 2) |                 .With(s => s.SeasonNumber = 2) | ||||||
|                 .Build(); |                 .Build(); | ||||||
| @@ -150,7 +150,7 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|             var episodeFiles = Builder<EpisodeFile> |             var episodeFiles = Builder<EpisodeFile> | ||||||
|                 .CreateListOfSize(10) |                 .CreateListOfSize(10) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(c => c.Quality = QualityTypes.SDTV) |                 .With(c => c.Quality = Quality.SDTV) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -187,7 +187,7 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|             //Setup |             //Setup | ||||||
|             WithRealDb(); |             WithRealDb(); | ||||||
|             var episodeFile = Builder<EpisodeFile>.CreateNew() |             var episodeFile = Builder<EpisodeFile>.CreateNew() | ||||||
|                     .With(c => c.Quality = QualityTypes.SDTV) |                     .With(c => c.Quality = Quality.SDTV) | ||||||
|                     .With(f => f.Path = path.NormalizePath()) |                     .With(f => f.Path = path.NormalizePath()) | ||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,12 +6,12 @@ using FizzWare.NBuilder; | |||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Configuration; | using NzbDrone.Core.Configuration; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | ||||||
| @@ -121,7 +121,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|             var episodeFiles = Builder<EpisodeFile> |             var episodeFiles = Builder<EpisodeFile> | ||||||
|                 .CreateListOfSize(10) |                 .CreateListOfSize(10) | ||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.Quality = QualityTypes.DVD) |                 .With(e => e.Quality = Quality.DVD) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|             var episodes = Builder<Episode>.CreateListOfSize(5).Build(); |             var episodes = Builder<Episode>.CreateListOfSize(5).Build(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,11 +8,11 @@ using FizzWare.NBuilder; | |||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Configuration; | using NzbDrone.Core.Configuration; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
|  |  | ||||||
| @@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result); |             Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result); | ||||||
| @@ -81,7 +81,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result); |             Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result); | ||||||
| @@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("South Park 05x06 [HDTV-720p]", result); |             Assert.AreEqual("South Park 05x06 [HDTV-720p]", result); | ||||||
| @@ -136,7 +136,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("South Park s05e06", result); |             Assert.AreEqual("South Park s05e06", result); | ||||||
| @@ -163,7 +163,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("South.Park.s05e06.City.Sushi", result); |             Assert.AreEqual("South.Park.s05e06.City.Sushi", result); | ||||||
| @@ -190,7 +190,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result); |             Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result); | ||||||
| @@ -218,7 +218,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("S15E06", result); |             Assert.AreEqual("S15E06", result); | ||||||
| @@ -252,7 +252,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result); |             Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result); | ||||||
| @@ -286,7 +286,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result); |             Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result); | ||||||
| @@ -320,7 +320,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result); |             Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result); | ||||||
| @@ -354,7 +354,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result); |             Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result); | ||||||
| @@ -388,7 +388,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("The.Mentalist.-.S03E23-24", result); |             Assert.AreEqual("The.Mentalist.-.S03E23-24", result); | ||||||
| @@ -422,7 +422,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("3x23x24", result); |             Assert.AreEqual("3x23x24", result); | ||||||
| @@ -447,7 +447,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, true, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, true, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]"); |             result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]"); | ||||||
| @@ -472,7 +472,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]"); |             result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]"); | ||||||
| @@ -497,7 +497,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, true, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, true, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be("South Park - S15E06 - City Sushi"); |             result.Should().Be("South Park - S15E06 - City Sushi"); | ||||||
| @@ -529,7 +529,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!"); |             result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!"); | ||||||
| @@ -556,7 +556,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result); |             Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result); | ||||||
| @@ -583,7 +583,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result); |             Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result); | ||||||
| @@ -614,7 +614,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, episodeFile); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, episodeFile); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path)); |             result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path)); | ||||||
| @@ -645,7 +645,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, episodeFile); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, episodeFile); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be(episodeFile.SceneName); |             result.Should().Be(episodeFile.SceneName); | ||||||
| @@ -677,7 +677,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!"); |             result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!"); | ||||||
| @@ -709,7 +709,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be("30 Rock - S06E06-E07 - Hello + World"); |             result.Should().Be("30 Rock - S06E06-E07 - Hello + World"); | ||||||
| @@ -747,7 +747,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                             .Build(); |                             .Build(); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile()); |             string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile()); | ||||||
|  |  | ||||||
|             //Assert |             //Assert | ||||||
|             result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World"); |             result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World"); | ||||||
| @@ -778,7 +778,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|             var result = Mocker.Resolve<MediaFileProvider>() |             var result = Mocker.Resolve<MediaFileProvider>() | ||||||
|                                .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]"); |             result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV-720p]"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -807,7 +807,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|             var result = Mocker.Resolve<MediaFileProvider>() |             var result = Mocker.Resolve<MediaFileProvider>() | ||||||
|                                .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"); |             result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -836,7 +836,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests | |||||||
|                     .Build(); |                     .Build(); | ||||||
|  |  | ||||||
|             var result = Mocker.Resolve<MediaFileProvider>() |             var result = Mocker.Resolve<MediaFileProvider>() | ||||||
|                                .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"); |             result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -15,7 +15,6 @@ using NzbDrone.Core.Providers; | |||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Providers.Metadata; | using NzbDrone.Core.Providers.Metadata; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ using NzbDrone.Core.Providers; | |||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Providers.Metadata; | using NzbDrone.Core.Providers.Metadata; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|   | |||||||
| @@ -4,10 +4,10 @@ using FizzWare.NBuilder; | |||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using Moq; | using Moq; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
|  |  | ||||||
| @@ -48,11 +48,11 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); |                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[0])) | ||||||
|                 .Returns("Title1"); |                 .Returns("Title1"); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[1])) | ||||||
|                 .Returns("Title2"); |                 .Returns("Title2"); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
| @@ -95,11 +95,11 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); |                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[0])) | ||||||
|                 .Returns("New Title 1"); |                 .Returns("New Title 1"); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[1])) | ||||||
|                 .Returns("New Title 2"); |                 .Returns("New Title 2"); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
| @@ -142,11 +142,11 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); |                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[0])) | ||||||
|                 .Returns("New Title 1"); |                 .Returns("New Title 1"); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[1])) | ||||||
|                 .Returns("Title2"); |                 .Returns("Title2"); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
| @@ -191,11 +191,11 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); |                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0], episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0], episodes[1] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[0])) | ||||||
|                 .Returns("New Title 1"); |                 .Returns("New Title 1"); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[1])) | ||||||
|                 .Returns("Title2"); |                 .Returns("Title2"); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
| @@ -240,11 +240,11 @@ namespace NzbDrone.Core.Test.ProviderTests | |||||||
|                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); |                 .Setup(c => c.EpisodesWithFiles()).Returns(episodes); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0], episodes[1] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[0])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[0], episodes[1] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[0])) | ||||||
|                 .Returns("Title1"); |                 .Returns("Title1"); | ||||||
|  |  | ||||||
|             Mocker.GetMock<MediaFileProvider>() |             Mocker.GetMock<MediaFileProvider>() | ||||||
|                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), It.IsAny<QualityTypes>(), It.IsAny<bool>(), episodeFiles[1])) |                 .Setup(c => c.GetNewFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), It.IsAny<Quality>(), It.IsAny<bool>(), episodeFiles[1])) | ||||||
|                 .Returns("Title2"); |                 .Returns("Title2"); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ using NUnit.Framework; | |||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
|   | |||||||
| @@ -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<QualityTypeProvider>(); |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             var types = Mocker.Resolve<QualityTypeProvider>().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<QualityTypeProvider>(); |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             var types = Mocker.Resolve<QualityTypeProvider>().All(); |  | ||||||
|  |  | ||||||
|             types.Should().HaveCount(QualityTypes.All().Count - 1); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         [Test] |  | ||||||
|         public void GetList_single_quality_type() |  | ||||||
|         { |  | ||||||
|             var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6) |  | ||||||
|                 .Build(); |  | ||||||
|  |  | ||||||
|             var ids = new List<int> { 1 }; |  | ||||||
|  |  | ||||||
|             Db.InsertMany(fakeQualityTypes); |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             var result = Mocker.Resolve<QualityTypeProvider>().GetList(ids); |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             result.Should().HaveCount(ids.Count); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         [Test] |  | ||||||
|         public void GetList_multiple_quality_type() |  | ||||||
|         { |  | ||||||
|             var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6) |  | ||||||
|                 .Build(); |  | ||||||
|  |  | ||||||
|             var ids = new List<int> { 1, 2 }; |  | ||||||
|  |  | ||||||
|             Db.InsertMany(fakeQualityTypes); |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             var result = Mocker.Resolve<QualityTypeProvider>().GetList(ids); |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             result.Should().HaveCount(ids.Count); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -15,7 +15,6 @@ using NzbDrone.Core.Model; | |||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|   | |||||||
| @@ -15,7 +15,6 @@ using NzbDrone.Core.Model; | |||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|   | |||||||
| @@ -15,7 +15,6 @@ using NzbDrone.Core.Model; | |||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|   | |||||||
| @@ -15,7 +15,6 @@ using NzbDrone.Core.Model; | |||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ using FluentAssertions; | |||||||
| using Moq; | using Moq; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Download; | using NzbDrone.Core.Download; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Model.Notification; | using NzbDrone.Core.Model.Notification; | ||||||
| @@ -14,7 +15,6 @@ using NzbDrone.Core.Providers; | |||||||
| using NzbDrone.Core.DecisionEngine; | using NzbDrone.Core.DecisionEngine; | ||||||
| using NzbDrone.Core.Providers.Search; | using NzbDrone.Core.Providers.Search; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Repository.Search; | using NzbDrone.Core.Repository.Search; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|  |  | ||||||
| @@ -113,17 +113,17 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.SeasonNumber = 1) |                 .With(e => e.SeasonNumber = 1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) | ||||||
|                 .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) |                 .With(c => c.Quality = new QualityModel(Quality.DVD, true)) | ||||||
|                 .With(c => c.Age = 10) |                 .With(c => c.Age = 10) | ||||||
|                 .Random(1) |                 .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) |                 .With(c => c.Age = 100) | ||||||
|                 .Build() |                 .Build() | ||||||
|                 .ToList(); |                 .ToList(); | ||||||
|  |  | ||||||
|  |  | ||||||
|             Mocker.GetMock<AllowedDownloadSpecification>() |             Mocker.GetMock<AllowedDownloadSpecification>() | ||||||
|                 .Setup(s => s.IsSatisfiedBy(It.Is<EpisodeParseResult>(d => d.Quality.Quality == QualityTypes.Bluray1080p))) |                 .Setup(s => s.IsSatisfiedBy(It.Is<EpisodeParseResult>(d => d.Quality.Quality == Quality.Bluray1080p))) | ||||||
|                 .Returns(ReportRejectionType.None); |                 .Returns(ReportRejectionType.None); | ||||||
|  |  | ||||||
|             var result = Mocker.Resolve<TestSearch>().ProcessReports(_matchingSeries, new { }, parseResults, _searchHistory, _notification); |             var result = Mocker.Resolve<TestSearch>().ProcessReports(_matchingSeries, new { }, parseResults, _searchHistory, _notification); | ||||||
| @@ -147,7 +147,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.SeasonNumber = 1) |                 .With(e => e.SeasonNumber = 1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) | ||||||
|                 .With(c => c.Quality = new QualityModel(QualityTypes.Bluray1080p, true)) |                 .With(c => c.Quality = new QualityModel(Quality.Bluray1080p, true)) | ||||||
|                 .With(c => c.Age = 300) |                 .With(c => c.Age = 300) | ||||||
|                 .Build() |                 .Build() | ||||||
|                 .ToList(); |                 .ToList(); | ||||||
| @@ -177,7 +177,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.SeasonNumber = 1) |                 .With(e => e.SeasonNumber = 1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) | ||||||
|                 .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) |                 .With(c => c.Quality = new QualityModel(Quality.DVD, true)) | ||||||
|                 .Build() |                 .Build() | ||||||
|                 .ToList(); |                 .ToList(); | ||||||
|  |  | ||||||
| @@ -199,7 +199,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.SeasonNumber = 1) |                 .With(e => e.SeasonNumber = 1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) | ||||||
|                 .With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false)) |                 .With(e => e.Quality = new QualityModel(Quality.HDTV720p, false)) | ||||||
|                 .Build() |                 .Build() | ||||||
|                 .ToList(); |                 .ToList(); | ||||||
|  |  | ||||||
| @@ -223,7 +223,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.SeasonNumber = 1) |                 .With(e => e.SeasonNumber = 1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) | ||||||
|                 .With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false)) |                 .With(e => e.Quality = new QualityModel(Quality.HDTV720p, false)) | ||||||
|                 .Build() |                 .Build() | ||||||
|                 .ToList(); |                 .ToList(); | ||||||
|  |  | ||||||
| @@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.SeasonNumber = 1) |                 .With(e => e.SeasonNumber = 1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 5 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 5 }) | ||||||
|                 .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) |                 .With(c => c.Quality = new QualityModel(Quality.DVD, true)) | ||||||
|                 .TheLast(1) |                 .TheLast(1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 1, 2, 3, 4, 5 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 1, 2, 3, 4, 5 }) | ||||||
|                 .Build() |                 .Build() | ||||||
| @@ -275,9 +275,9 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.SeasonNumber = 1) |                 .With(e => e.SeasonNumber = 1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) | ||||||
|                 .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) |                 .With(c => c.Quality = new QualityModel(Quality.DVD, true)) | ||||||
|                 .TheLast(1) |                 .TheLast(1) | ||||||
|                 .With(c => c.Quality = new QualityModel(QualityTypes.SDTV, true)) |                 .With(c => c.Quality = new QualityModel(Quality.SDTV, true)) | ||||||
|                 .Build() |                 .Build() | ||||||
|                 .ToList(); |                 .ToList(); | ||||||
|  |  | ||||||
| @@ -285,11 +285,11 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|             WithQualityNeeded(); |             WithQualityNeeded(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<DownloadProvider>() |             Mocker.GetMock<DownloadProvider>() | ||||||
|                 .Setup(s => s.DownloadReport(It.Is<EpisodeParseResult>(d => d.Quality.Quality == QualityTypes.DVD))) |                 .Setup(s => s.DownloadReport(It.Is<EpisodeParseResult>(d => d.Quality.Quality == Quality.DVD))) | ||||||
|                 .Returns(false); |                 .Returns(false); | ||||||
|  |  | ||||||
|             Mocker.GetMock<DownloadProvider>() |             Mocker.GetMock<DownloadProvider>() | ||||||
|                 .Setup(s => s.DownloadReport(It.Is<EpisodeParseResult>(d => d.Quality.Quality == QualityTypes.SDTV))) |                 .Setup(s => s.DownloadReport(It.Is<EpisodeParseResult>(d => d.Quality.Quality == Quality.SDTV))) | ||||||
|                 .Returns(true); |                 .Returns(true); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
| @@ -310,10 +310,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|                 .All() |                 .All() | ||||||
|                 .With(e => e.SeasonNumber = 1) |                 .With(e => e.SeasonNumber = 1) | ||||||
|                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) |                 .With(e => e.EpisodeNumbers = new List<int> { 1 }) | ||||||
|                 .With(c => c.Quality = new QualityModel(QualityTypes.DVD, true)) |                 .With(c => c.Quality = new QualityModel(Quality.DVD, true)) | ||||||
|                 .With(c => c.Age = 10) |                 .With(c => c.Age = 10) | ||||||
|                 .Random(1) |                 .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) |                 .With(c => c.Age = 100) | ||||||
|                 .Build() |                 .Build() | ||||||
|                 .ToList(); |                 .ToList(); | ||||||
| @@ -322,7 +322,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests | |||||||
|             WithSuccessfulDownload(); |             WithSuccessfulDownload(); | ||||||
|  |  | ||||||
|             Mocker.GetMock<AllowedDownloadSpecification>() |             Mocker.GetMock<AllowedDownloadSpecification>() | ||||||
|                 .Setup(s => s.IsSatisfiedBy(It.Is<EpisodeParseResult>(d => d.Quality.Quality == QualityTypes.Bluray1080p))) |                 .Setup(s => s.IsSatisfiedBy(It.Is<EpisodeParseResult>(d => d.Quality.Quality == Quality.Bluray1080p))) | ||||||
|                 .Returns(ReportRejectionType.None); |                 .Returns(ReportRejectionType.None); | ||||||
|  |  | ||||||
|             //Act |             //Act | ||||||
|   | |||||||
| @@ -10,7 +10,6 @@ using NzbDrone.Common; | |||||||
| using NzbDrone.Core.Model.Notification; | using NzbDrone.Core.Model.Notification; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|   | |||||||
| @@ -10,7 +10,6 @@ using NzbDrone.Common; | |||||||
| using NzbDrone.Core.Model.Notification; | using NzbDrone.Core.Model.Notification; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using NzbDrone.Test.Common.AutoMoq; | using NzbDrone.Test.Common.AutoMoq; | ||||||
| using NzbDrone.Test.Common; | using NzbDrone.Test.Common; | ||||||
|   | |||||||
| @@ -1,47 +1,44 @@ | |||||||
| using System; | using System.Linq; | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.IO; |  | ||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| 
 | 
 | ||||||
| namespace NzbDrone.Core.Test | namespace NzbDrone.Core.Test.Qualities | ||||||
| { | { | ||||||
|     [TestFixture] |     [TestFixture] | ||||||
|     // ReSharper disable InconsistentNaming |     // ReSharper disable InconsistentNaming | ||||||
|     public class QualityTypesTest : CoreTest |     public class QualityFixture : CoreTest | ||||||
|     { |     { | ||||||
|         public static object[] FromIntCases = |         public static object[] FromIntCases = | ||||||
|                 { |                 { | ||||||
|                         new object[] {1, QualityTypes.SDTV}, |                         new object[] {1, Quality.SDTV}, | ||||||
|                         new object[] {2, QualityTypes.DVD}, |                         new object[] {2, Quality.DVD}, | ||||||
|                         new object[] {4, QualityTypes.HDTV720p}, |                         new object[] {4, Quality.HDTV720p}, | ||||||
|                         new object[] {5, QualityTypes.WEBDL720p}, |                         new object[] {5, Quality.WEBDL720p}, | ||||||
|                         new object[] {6, QualityTypes.Bluray720p}, |                         new object[] {6, Quality.Bluray720p}, | ||||||
|                         new object[] {7, QualityTypes.Bluray1080p} |                         new object[] {7, Quality.Bluray1080p} | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|         public static object[] ToIntCases = |         public static object[] ToIntCases = | ||||||
|                 { |                 { | ||||||
|                         new object[] {QualityTypes.SDTV, 1}, |                         new object[] {Quality.SDTV, 1}, | ||||||
|                         new object[] {QualityTypes.DVD, 2}, |                         new object[] {Quality.DVD, 2}, | ||||||
|                         new object[] {QualityTypes.HDTV720p, 4}, |                         new object[] {Quality.HDTV720p, 4}, | ||||||
|                         new object[] {QualityTypes.WEBDL720p, 5}, |                         new object[] {Quality.WEBDL720p, 5}, | ||||||
|                         new object[] {QualityTypes.Bluray720p, 6}, |                         new object[] {Quality.Bluray720p, 6}, | ||||||
|                         new object[] {QualityTypes.Bluray1080p, 7} |                         new object[] {Quality.Bluray1080p, 7} | ||||||
|                 }; |                 }; | ||||||
| 
 | 
 | ||||||
|         [Test, TestCaseSource("FromIntCases")] |         [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); |             quality.Should().Be(expected); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         [Test, TestCaseSource("ToIntCases")] |         [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; |             var i = (int)source; | ||||||
|             i.Should().Be(expected); |             i.Should().Be(expected); | ||||||
| @@ -51,8 +48,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void Icomparer_greater_test() |         public void Icomparer_greater_test() | ||||||
|         { |         { | ||||||
|             var first = QualityTypes.DVD; |             var first = Quality.DVD; | ||||||
|             var second = QualityTypes.Bluray1080p; |             var second = Quality.Bluray1080p; | ||||||
| 
 | 
 | ||||||
|             second.Should().BeGreaterThan(first); |             second.Should().BeGreaterThan(first); | ||||||
|         } |         } | ||||||
| @@ -60,8 +57,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void Icomparer_lesser() |         public void Icomparer_lesser() | ||||||
|         { |         { | ||||||
|             var first = QualityTypes.DVD; |             var first = Quality.DVD; | ||||||
|             var second = QualityTypes.Bluray1080p; |             var second = Quality.Bluray1080p; | ||||||
| 
 | 
 | ||||||
|             first.Should().BeLessThan(second); |             first.Should().BeLessThan(second); | ||||||
|         } |         } | ||||||
| @@ -69,8 +66,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void equal_operand() |         public void equal_operand() | ||||||
|         { |         { | ||||||
|             var first = QualityTypes.Bluray1080p; |             var first = Quality.Bluray1080p; | ||||||
|             var second = QualityTypes.Bluray1080p; |             var second = Quality.Bluray1080p; | ||||||
| 
 | 
 | ||||||
|             (first == second).Should().BeTrue(); |             (first == second).Should().BeTrue(); | ||||||
|             (first >= second).Should().BeTrue(); |             (first >= second).Should().BeTrue(); | ||||||
| @@ -80,8 +77,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void equal_operand_false() |         public void equal_operand_false() | ||||||
|         { |         { | ||||||
|             var first = QualityTypes.Bluray1080p; |             var first = Quality.Bluray1080p; | ||||||
|             var second = QualityTypes.Unknown; |             var second = Quality.Unknown; | ||||||
| 
 | 
 | ||||||
|             (first == second).Should().BeFalse(); |             (first == second).Should().BeFalse(); | ||||||
|         } |         } | ||||||
| @@ -89,8 +86,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void not_equal_operand() |         public void not_equal_operand() | ||||||
|         { |         { | ||||||
|             var first = QualityTypes.Bluray1080p; |             var first = Quality.Bluray1080p; | ||||||
|             var second = QualityTypes.Bluray1080p; |             var second = Quality.Bluray1080p; | ||||||
| 
 | 
 | ||||||
|             (first != second).Should().BeFalse(); |             (first != second).Should().BeFalse(); | ||||||
|         } |         } | ||||||
| @@ -98,8 +95,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void not_equal_operand_false() |         public void not_equal_operand_false() | ||||||
|         { |         { | ||||||
|             var first = QualityTypes.Bluray1080p; |             var first = Quality.Bluray1080p; | ||||||
|             var second = QualityTypes.Unknown; |             var second = Quality.Unknown; | ||||||
| 
 | 
 | ||||||
|             (first != second).Should().BeTrue(); |             (first != second).Should().BeTrue(); | ||||||
|         } |         } | ||||||
| @@ -107,8 +104,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void greater_operand() |         public void greater_operand() | ||||||
|         { |         { | ||||||
|             var first = QualityTypes.DVD; |             var first = Quality.DVD; | ||||||
|             var second = QualityTypes.Bluray1080p; |             var second = Quality.Bluray1080p; | ||||||
| 
 | 
 | ||||||
|             (first < second).Should().BeTrue(); |             (first < second).Should().BeTrue(); | ||||||
|             (first <= second).Should().BeTrue(); |             (first <= second).Should().BeTrue(); | ||||||
| @@ -117,8 +114,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void lesser_operand() |         public void lesser_operand() | ||||||
|         { |         { | ||||||
|             var first = QualityTypes.DVD; |             var first = Quality.DVD; | ||||||
|             var second = QualityTypes.Bluray1080p; |             var second = Quality.Bluray1080p; | ||||||
| 
 | 
 | ||||||
|             (second > first).Should().BeTrue(); |             (second > first).Should().BeTrue(); | ||||||
|             (second >= first).Should().BeTrue(); |             (second >= first).Should().BeTrue(); | ||||||
							
								
								
									
										44
									
								
								NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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<QualityProfileService> | ||||||
|  |     { | ||||||
|  |         [Test] | ||||||
|  |         public void Init_should_add_two_profiles() | ||||||
|  |         { | ||||||
|  |             Subject.Init(); | ||||||
|  |  | ||||||
|  |             Mocker.GetMock<IQualityProfileRepository>() | ||||||
|  |                 .Verify(v => v.Insert(It.IsAny<QualityProfile>()), 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<IQualityProfileRepository>() | ||||||
|  |                   .Setup(s => s.All()) | ||||||
|  |                   .Returns(Builder<QualityProfile>.CreateListOfSize(2).Build().ToList()); | ||||||
|  |  | ||||||
|  |             Subject.Init(); | ||||||
|  |  | ||||||
|  |             Mocker.GetMock<IQualityProfileRepository>() | ||||||
|  |                 .Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Never()); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										59
									
								
								NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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<QualitySizeService> | ||||||
|  |     { | ||||||
|  |         [Test] | ||||||
|  |         public void Init_should_add_all_sizes() | ||||||
|  |         { | ||||||
|  |             Subject.Init(); | ||||||
|  |              | ||||||
|  |             Mocker.GetMock<IQualitySizeRepository>() | ||||||
|  |                 .Verify(v => v.Insert(It.IsAny<QualitySize>()), Times.Exactly(Quality.All().Count - 1)); | ||||||
|  |  | ||||||
|  |             //Todo: Should we validate each was inserted exactly as configured? | ||||||
|  |  | ||||||
|  |             //var types = Mocker.Resolve<QualitySizeService>().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<IQualitySizeRepository>() | ||||||
|  |                   .Setup(s => s.All()) | ||||||
|  |                   .Returns(new List<QualitySize> | ||||||
|  |                       { | ||||||
|  |                               new QualitySize { QualityId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 } | ||||||
|  |                       }); | ||||||
|  |  | ||||||
|  |             Subject.Init(); | ||||||
|  |  | ||||||
|  |             Mocker.GetMock<IQualitySizeRepository>() | ||||||
|  |                 .Verify(v => v.Insert(It.IsAny<QualitySize>()), Times.Exactly(Quality.All().Count - 2)); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -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<QualityProvider> |  | ||||||
|     { |  | ||||||
|         [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> { QualityTypes.HDTV720p, QualityTypes.DVD }, |  | ||||||
|                                   }; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             var id = Convert.ToInt32(Db.Insert(testProfile)); |  | ||||||
|             var fetch = Db.SingleOrDefault<QualityProfile>(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<QualityProfile>(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<QualityProfile>(id); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             //Update |  | ||||||
|             currentProfile.Cutoff = QualityTypes.Bluray720p; |  | ||||||
|             Mocker.Resolve<QualityProvider>().Update(currentProfile); |  | ||||||
|  |  | ||||||
|             var updated = Mocker.Resolve<QualityProvider>().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> { QualityTypes.HDTV720p, QualityTypes.DVD }, |  | ||||||
|                                   }; |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             var profileId = Convert.ToInt32(Db.Insert(testProfile)); |  | ||||||
|  |  | ||||||
|             var series = Builder<Series>.CreateNew().Build(); |  | ||||||
|             series.QualityProfileId = profileId; |  | ||||||
|  |  | ||||||
|             Db.Insert(testProfile); |  | ||||||
|             Db.Insert(series); |  | ||||||
|  |  | ||||||
|             var result = Db.Fetch<Series>(); |  | ||||||
|  |  | ||||||
|             result.Should().HaveCount(1); |  | ||||||
|             var profile = Db.SingleOrDefault<QualityProfile>(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<QualityProvider>(); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             var profiles = Mocker.Resolve<QualityProvider>().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); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -9,11 +9,11 @@ using Moq; | |||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Configuration; | using NzbDrone.Core.Configuration; | ||||||
| using NzbDrone.Core.Download; | using NzbDrone.Core.Download; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
| using TvdbLib.Data; | using TvdbLib.Data; | ||||||
| @@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests | |||||||
|             WithRealDb(); |             WithRealDb(); | ||||||
|  |  | ||||||
|             var fakeSeries = Builder<Series>.CreateNew().Build(); |             var fakeSeries = Builder<Series>.CreateNew().Build(); | ||||||
|             var fakeFile = Builder<EpisodeFile>.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = QualityTypes.SDTV).Build(); |             var fakeFile = Builder<EpisodeFile>.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = Quality.SDTV).Build(); | ||||||
|             var fakeEpisodes = Builder<Episode>.CreateListOfSize(5) |             var fakeEpisodes = Builder<Episode>.CreateListOfSize(5) | ||||||
|                 .All().With(e => e.SeriesId = 1).TheFirst(1).With(e => e.EpisodeFile = new EpisodeFile { EpisodeFileId = 1 }).With(e => e.EpisodeFile = fakeFile).Build(); |                 .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 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests | |||||||
|             WithRealDb(); |             WithRealDb(); | ||||||
|  |  | ||||||
|             var fakeSeries = Builder<Series>.CreateNew().Build(); |             var fakeSeries = Builder<Series>.CreateNew().Build(); | ||||||
|             var fakeFile = Builder<EpisodeFile>.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = QualityTypes.SDTV).Build(); |             var fakeFile = Builder<EpisodeFile>.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = Quality.SDTV).Build(); | ||||||
|             var fakeEpisodes = Builder<Episode>.CreateListOfSize(5) |             var fakeEpisodes = Builder<Episode>.CreateListOfSize(5) | ||||||
|                 .All().With(e => e.SeriesId = 1).TheFirst(1).With(c => c.EpisodeFile = new EpisodeFile { EpisodeFileId = 1 }).With(e => e.EpisodeFile = fakeFile).Build(); |                 .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 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests | |||||||
|             WithRealDb(); |             WithRealDb(); | ||||||
|  |  | ||||||
|             var fakeSeries = Builder<Series>.CreateNew().Build(); |             var fakeSeries = Builder<Series>.CreateNew().Build(); | ||||||
|             var fakeFile = Builder<EpisodeFile>.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = QualityTypes.SDTV).Build(); |             var fakeFile = Builder<EpisodeFile>.CreateNew().With(f => f.EpisodeFileId).With(c => c.Quality = Quality.SDTV).Build(); | ||||||
|             var fakeEpisodes = Builder<Episode>.CreateListOfSize(5) |             var fakeEpisodes = Builder<Episode>.CreateListOfSize(5) | ||||||
|                 .All().With(e => e.SeriesId = 1).TheFirst(1).With(e => e.EpisodeFile = new EpisodeFile { EpisodeFileId = 1 }).With(e => e.EpisodeFile = fakeFile).Build(); |                 .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 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests | |||||||
|  |  | ||||||
|             var episodeFile = Builder<EpisodeFile>.CreateNew() |             var episodeFile = Builder<EpisodeFile>.CreateNew() | ||||||
|                 .With(c => c.EpisodeFileId = 1) |                 .With(c => c.EpisodeFileId = 1) | ||||||
|                 .With(c => c.Quality = QualityTypes.SDTV) |                 .With(c => c.Quality = Quality.SDTV) | ||||||
|                 .Build(); |                 .Build(); | ||||||
|  |  | ||||||
|             var episodes = Builder<Episode>.CreateListOfSize(2) |             var episodes = Builder<Episode>.CreateListOfSize(2) | ||||||
|   | |||||||
| @@ -1,21 +1,21 @@ | |||||||
| using FluentAssertions; | using System.Linq; | ||||||
|  | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; |  | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using NzbDrone.Core.Test.Framework; | using NzbDrone.Core.Test.Framework; | ||||||
| 
 | 
 | ||||||
| namespace NzbDrone.Core.Test | namespace NzbDrone.Core.Test.TvTests | ||||||
| { | { | ||||||
|     [TestFixture] |     [TestFixture] | ||||||
|     // ReSharper disable InconsistentNaming |     // ReSharper disable InconsistentNaming | ||||||
|     public class QualityTest : CoreTest |     public class QualityModelFixture : CoreTest | ||||||
|     { |     { | ||||||
|         [Test] |         [Test] | ||||||
|         public void Icomparer_greater_test() |         public void Icomparer_greater_test() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.DVD, true); |             var first = new QualityModel(Quality.DVD, true); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, true); |             var second = new QualityModel(Quality.Bluray1080p, true); | ||||||
| 
 | 
 | ||||||
|             second.Should().BeGreaterThan(first); |             second.Should().BeGreaterThan(first); | ||||||
|         } |         } | ||||||
| @@ -23,8 +23,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void Icomparer_greater_proper() |         public void Icomparer_greater_proper() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.Bluray1080p, false); |             var first = new QualityModel(Quality.Bluray1080p, false); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, true); |             var second = new QualityModel(Quality.Bluray1080p, true); | ||||||
| 
 | 
 | ||||||
|             second.Should().BeGreaterThan(first); |             second.Should().BeGreaterThan(first); | ||||||
|         } |         } | ||||||
| @@ -32,8 +32,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void Icomparer_lesser() |         public void Icomparer_lesser() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.DVD, true); |             var first = new QualityModel(Quality.DVD, true); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, true); |             var second = new QualityModel(Quality.Bluray1080p, true); | ||||||
| 
 | 
 | ||||||
|             first.Should().BeLessThan(second); |             first.Should().BeLessThan(second); | ||||||
|         } |         } | ||||||
| @@ -41,8 +41,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void Icomparer_lesser_proper() |         public void Icomparer_lesser_proper() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.DVD, false); |             var first = new QualityModel(Quality.DVD, false); | ||||||
|             var second = new QualityModel(QualityTypes.DVD, true); |             var second = new QualityModel(Quality.DVD, true); | ||||||
| 
 | 
 | ||||||
|             first.Should().BeLessThan(second); |             first.Should().BeLessThan(second); | ||||||
|         } |         } | ||||||
| @@ -50,8 +50,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void equal_operand() |         public void equal_operand() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.Bluray1080p, true); |             var first = new QualityModel(Quality.Bluray1080p, true); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, true); |             var second = new QualityModel(Quality.Bluray1080p, true); | ||||||
| 
 | 
 | ||||||
|             (first == second).Should().BeTrue(); |             (first == second).Should().BeTrue(); | ||||||
|             (first >= second).Should().BeTrue(); |             (first >= second).Should().BeTrue(); | ||||||
| @@ -61,8 +61,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void equal_operand_false() |         public void equal_operand_false() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.Bluray1080p, true); |             var first = new QualityModel(Quality.Bluray1080p, true); | ||||||
|             var second = new QualityModel(QualityTypes.Unknown, true); |             var second = new QualityModel(Quality.Unknown, true); | ||||||
| 
 | 
 | ||||||
|             (first == second).Should().BeFalse(); |             (first == second).Should().BeFalse(); | ||||||
|         } |         } | ||||||
| @@ -70,8 +70,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void equal_operand_false_proper() |         public void equal_operand_false_proper() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.Bluray1080p, true); |             var first = new QualityModel(Quality.Bluray1080p, true); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, false); |             var second = new QualityModel(Quality.Bluray1080p, false); | ||||||
| 
 | 
 | ||||||
|             (first == second).Should().BeFalse(); |             (first == second).Should().BeFalse(); | ||||||
|         } |         } | ||||||
| @@ -79,8 +79,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void not_equal_operand() |         public void not_equal_operand() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.Bluray1080p, true); |             var first = new QualityModel(Quality.Bluray1080p, true); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, true); |             var second = new QualityModel(Quality.Bluray1080p, true); | ||||||
| 
 | 
 | ||||||
|             (first != second).Should().BeFalse(); |             (first != second).Should().BeFalse(); | ||||||
|         } |         } | ||||||
| @@ -88,8 +88,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void not_equal_operand_false() |         public void not_equal_operand_false() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.Bluray1080p, true); |             var first = new QualityModel(Quality.Bluray1080p, true); | ||||||
|             var second = new QualityModel(QualityTypes.Unknown, true); |             var second = new QualityModel(Quality.Unknown, true); | ||||||
| 
 | 
 | ||||||
|             (first != second).Should().BeTrue(); |             (first != second).Should().BeTrue(); | ||||||
|         } |         } | ||||||
| @@ -97,8 +97,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void not_equal_operand_false_proper() |         public void not_equal_operand_false_proper() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.Bluray1080p, true); |             var first = new QualityModel(Quality.Bluray1080p, true); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, false); |             var second = new QualityModel(Quality.Bluray1080p, false); | ||||||
| 
 | 
 | ||||||
|             (first != second).Should().BeTrue(); |             (first != second).Should().BeTrue(); | ||||||
|         } |         } | ||||||
| @@ -106,8 +106,8 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void greater_operand() |         public void greater_operand() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.DVD, true); |             var first = new QualityModel(Quality.DVD, true); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, true); |             var second = new QualityModel(Quality.Bluray1080p, true); | ||||||
| 
 | 
 | ||||||
|             (first < second).Should().BeTrue(); |             (first < second).Should().BeTrue(); | ||||||
|             (first <= second).Should().BeTrue(); |             (first <= second).Should().BeTrue(); | ||||||
| @@ -116,12 +116,11 @@ namespace NzbDrone.Core.Test | |||||||
|         [Test] |         [Test] | ||||||
|         public void lesser_operand() |         public void lesser_operand() | ||||||
|         { |         { | ||||||
|             var first = new QualityModel(QualityTypes.DVD, true); |             var first = new QualityModel(Quality.DVD, true); | ||||||
|             var second = new QualityModel(QualityTypes.Bluray1080p, true); |             var second = new QualityModel(Quality.Bluray1080p, true); | ||||||
| 
 | 
 | ||||||
|             (second > first).Should().BeTrue(); |             (second > first).Should().BeTrue(); | ||||||
|             (second >= first).Should().BeTrue(); |             (second >= first).Should().BeTrue(); | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -5,7 +5,6 @@ using System.Text; | |||||||
| using FluentAssertions; | using FluentAssertions; | ||||||
| using NUnit.Framework; | using NUnit.Framework; | ||||||
| using NzbDrone.Core.Model.Xbmc; | using NzbDrone.Core.Model.Xbmc; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Test | namespace NzbDrone.Core.Test | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| using System; | using System; | ||||||
| using System.Reflection; | using System.Reflection; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Datastore | namespace NzbDrone.Core.Datastore | ||||||
| @@ -9,11 +9,11 @@ namespace NzbDrone.Core.Datastore | |||||||
|     { |     { | ||||||
|         public override Func<object, object> GetToDbConverter(Type sourceType) |         public override Func<object, object> GetToDbConverter(Type sourceType) | ||||||
|         { |         { | ||||||
|             if (sourceType == typeof(QualityTypes)) |             if (sourceType == typeof(Quality)) | ||||||
|             { |             { | ||||||
|                 return delegate(object s) |                 return delegate(object s) | ||||||
|                 { |                 { | ||||||
|                     var source = (QualityTypes)s; |                     var source = (Quality)s; | ||||||
|                     return source.Id; |                     return source.Id; | ||||||
|                 }; |                 }; | ||||||
|             } |             } | ||||||
| @@ -45,13 +45,13 @@ namespace NzbDrone.Core.Datastore | |||||||
|                            }; |                            }; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationType == typeof(QualityTypes)) |             if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationType == typeof(Quality)) | ||||||
|             { |             { | ||||||
|                 return delegate(object s) |                 return delegate(object s) | ||||||
|                 { |                 { | ||||||
|                     int value; |                     int value; | ||||||
|                     Int32.TryParse(s.ToString(), out value); |                     Int32.TryParse(s.ToString(), out value); | ||||||
|                     var quality = (QualityTypes)value; |                     var quality = (Quality)value; | ||||||
|                     return quality; |                     return quality; | ||||||
|                 }; |                 }; | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -1,20 +1,20 @@ | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using NLog; | using NLog; | ||||||
| using NzbDrone.Core.Datastore; | using NzbDrone.Core.Datastore; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.DecisionEngine | namespace NzbDrone.Core.DecisionEngine | ||||||
| { | { | ||||||
|     public class AcceptableSizeSpecification |     public class AcceptableSizeSpecification | ||||||
|     { |     { | ||||||
|         private readonly QualityTypeProvider _qualityTypeProvider; |         private readonly QualitySizeService _qualityTypeProvider; | ||||||
|         private readonly IEpisodeService _episodeService; |         private readonly IEpisodeService _episodeService; | ||||||
|         private static readonly Logger logger = LogManager.GetCurrentClassLogger(); |         private static readonly Logger logger = LogManager.GetCurrentClassLogger(); | ||||||
|  |  | ||||||
|         public AcceptableSizeSpecification(QualityTypeProvider qualityTypeProvider, IEpisodeService episodeService) |         public AcceptableSizeSpecification(QualitySizeService qualityTypeProvider, IEpisodeService episodeService) | ||||||
|         { |         { | ||||||
|             _qualityTypeProvider = qualityTypeProvider; |             _qualityTypeProvider = qualityTypeProvider; | ||||||
|             _episodeService = episodeService; |             _episodeService = episodeService; | ||||||
| @@ -29,7 +29,7 @@ namespace NzbDrone.Core.DecisionEngine | |||||||
|         { |         { | ||||||
|             logger.Trace("Beginning size check for: {0}", 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."); |                 logger.Trace("Raw-HD release found, skipping size check."); | ||||||
|                 return true; |                 return true; | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using NLog; | using NLog; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.DecisionEngine | namespace NzbDrone.Core.DecisionEngine | ||||||
| { | { | ||||||
| @@ -10,7 +10,7 @@ namespace NzbDrone.Core.DecisionEngine | |||||||
|     { |     { | ||||||
|         private static readonly Logger logger = LogManager.GetCurrentClassLogger(); |         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) |             if (currentQuality >= newQuality) | ||||||
|             { |             { | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using NLog; | using NLog; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Providers; | using NzbDrone.Core.Providers; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| @@ -8,10 +9,10 @@ namespace NzbDrone.Core.DecisionEngine | |||||||
| { | { | ||||||
|     public class UpgradePossibleSpecification |     public class UpgradePossibleSpecification | ||||||
|     { |     { | ||||||
|         private readonly QualityProvider _qualityProvider; |         private readonly IQualityProfileService _qualityProvider; | ||||||
|         private static readonly Logger logger = LogManager.GetCurrentClassLogger(); |         private static readonly Logger logger = LogManager.GetCurrentClassLogger(); | ||||||
|  |  | ||||||
|         public UpgradePossibleSpecification(QualityProvider qualityProvider) |         public UpgradePossibleSpecification(IQualityProfileService qualityProvider) | ||||||
|         { |         { | ||||||
|             _qualityProvider = qualityProvider; |             _qualityProvider = qualityProvider; | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -307,6 +307,8 @@ | |||||||
|     <Compile Include="Model\JobQueueItem.cs" /> |     <Compile Include="Model\JobQueueItem.cs" /> | ||||||
|     <Compile Include="Model\LanguageType.cs" /> |     <Compile Include="Model\LanguageType.cs" /> | ||||||
|     <Compile Include="Model\MisnamedEpisodeModel.cs" /> |     <Compile Include="Model\MisnamedEpisodeModel.cs" /> | ||||||
|  |     <Compile Include="Qualities\QualitySizeRepository.cs" /> | ||||||
|  |     <Compile Include="Qualities\QualityProfileRepository.cs" /> | ||||||
|     <Compile Include="Tv\EpisodeService.cs" /> |     <Compile Include="Tv\EpisodeService.cs" /> | ||||||
|     <Compile Include="Tv\Events\SeriesAddedEvent.cs" /> |     <Compile Include="Tv\Events\SeriesAddedEvent.cs" /> | ||||||
|     <Compile Include="Tv\SeasonRepository.cs" /> |     <Compile Include="Tv\SeasonRepository.cs" /> | ||||||
| @@ -390,7 +392,7 @@ | |||||||
|     <Compile Include="Providers\XemCommunicationProvider.cs" /> |     <Compile Include="Providers\XemCommunicationProvider.cs" /> | ||||||
|     <Compile Include="Providers\XemProvider.cs" /> |     <Compile Include="Providers\XemProvider.cs" /> | ||||||
|     <Compile Include="Repository\MetadataDefinition.cs" /> |     <Compile Include="Repository\MetadataDefinition.cs" /> | ||||||
|     <Compile Include="Repository\Quality\QualityTypes.cs" /> |     <Compile Include="Qualities\Quality.cs" /> | ||||||
|     <Compile Include="Repository\Search\SearchHistoryItem.cs" /> |     <Compile Include="Repository\Search\SearchHistoryItem.cs" /> | ||||||
|     <Compile Include="Repository\Search\SearchHistory.cs" /> |     <Compile Include="Repository\Search\SearchHistory.cs" /> | ||||||
|     <Compile Include="Model\ReportRejectionType.cs" /> |     <Compile Include="Model\ReportRejectionType.cs" /> | ||||||
| @@ -525,10 +527,10 @@ | |||||||
|     <Compile Include="Providers\ProwlProvider.cs"> |     <Compile Include="Providers\ProwlProvider.cs"> | ||||||
|       <SubType>Code</SubType> |       <SubType>Code</SubType> | ||||||
|     </Compile> |     </Compile> | ||||||
|     <Compile Include="Providers\QualityProvider.cs"> |     <Compile Include="Qualities\QualityProfileService.cs"> | ||||||
|       <SubType>Code</SubType> |       <SubType>Code</SubType> | ||||||
|     </Compile> |     </Compile> | ||||||
|     <Compile Include="Providers\QualityTypeProvider.cs"> |     <Compile Include="Qualities\QualitySizeService.cs"> | ||||||
|       <SubType>Code</SubType> |       <SubType>Code</SubType> | ||||||
|     </Compile> |     </Compile> | ||||||
|     <Compile Include="Providers\ReferenceDataProvider.cs"> |     <Compile Include="Providers\ReferenceDataProvider.cs"> | ||||||
| @@ -590,8 +592,8 @@ | |||||||
|     <Compile Include="Tv\Episode.cs" /> |     <Compile Include="Tv\Episode.cs" /> | ||||||
|     <Compile Include="Instrumentation\Log.cs" /> |     <Compile Include="Instrumentation\Log.cs" /> | ||||||
|     <Compile Include="History\History.cs" /> |     <Compile Include="History\History.cs" /> | ||||||
|     <Compile Include="Repository\Quality\QualityType.cs" /> |     <Compile Include="Qualities\QualitySize.cs" /> | ||||||
|     <Compile Include="Repository\Quality\QualityProfile.cs" /> |     <Compile Include="Qualities\QualityProfile.cs" /> | ||||||
|     <Compile Include="RootFolders\RootFolder.cs" /> |     <Compile Include="RootFolders\RootFolder.cs" /> | ||||||
|     <Compile Include="Repository\SceneMapping.cs" /> |     <Compile Include="Repository\SceneMapping.cs" /> | ||||||
|     <Compile Include="Tv\Series.cs" /> |     <Compile Include="Tv\Series.cs" /> | ||||||
|   | |||||||
| @@ -6,9 +6,9 @@ using System.Linq; | |||||||
| using System.Text.RegularExpressions; | using System.Text.RegularExpressions; | ||||||
| using NLog; | using NLog; | ||||||
| using NzbDrone.Common; | using NzbDrone.Common; | ||||||
|  |     using NzbDrone.Core.Qualities; | ||||||
|     using NzbDrone.Core.Tv; |     using NzbDrone.Core.Tv; | ||||||
|     using NzbDrone.Core.Model; |     using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
|  |  | ||||||
| namespace NzbDrone.Core | namespace NzbDrone.Core | ||||||
| { | { | ||||||
| @@ -257,12 +257,12 @@ namespace NzbDrone.Core | |||||||
|  |  | ||||||
|             name = name.Trim(); |             name = name.Trim(); | ||||||
|             var normalizedName = NormalizeTitle(name); |             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")); |             result.Proper = (normalizedName.Contains("proper") || normalizedName.Contains("repack")); | ||||||
|  |  | ||||||
|             if (normalizedName.Contains("dvd") || normalizedName.Contains("bdrip") || normalizedName.Contains("brrip")) |             if (normalizedName.Contains("dvd") || normalizedName.Contains("bdrip") || normalizedName.Contains("brrip")) | ||||||
|             { |             { | ||||||
|                 result.Quality = QualityTypes.DVD; |                 result.Quality = Quality.DVD; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -270,11 +270,11 @@ namespace NzbDrone.Core | |||||||
|             { |             { | ||||||
|                 if (normalizedName.Contains("bluray")) |                 if (normalizedName.Contains("bluray")) | ||||||
|                 { |                 { | ||||||
|                     result.Quality = QualityTypes.DVD; |                     result.Quality = Quality.DVD; | ||||||
|                     return result; |                     return result; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 result.Quality = QualityTypes.SDTV; |                 result.Quality = Quality.SDTV; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -282,46 +282,46 @@ namespace NzbDrone.Core | |||||||
|             { |             { | ||||||
|                 if (normalizedName.Contains("720p")) |                 if (normalizedName.Contains("720p")) | ||||||
|                 { |                 { | ||||||
|                     result.Quality = QualityTypes.Bluray720p; |                     result.Quality = Quality.Bluray720p; | ||||||
|                     return result; |                     return result; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 if (normalizedName.Contains("1080p")) |                 if (normalizedName.Contains("1080p")) | ||||||
|                 { |                 { | ||||||
|                     result.Quality = QualityTypes.Bluray1080p; |                     result.Quality = Quality.Bluray1080p; | ||||||
|                     return result; |                     return result; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 result.Quality = QualityTypes.Bluray720p; |                 result.Quality = Quality.Bluray720p; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|             if (normalizedName.Contains("webdl")) |             if (normalizedName.Contains("webdl")) | ||||||
|             { |             { | ||||||
|                 if (normalizedName.Contains("1080p")) |                 if (normalizedName.Contains("1080p")) | ||||||
|                 { |                 { | ||||||
|                     result.Quality = QualityTypes.WEBDL1080p; |                     result.Quality = Quality.WEBDL1080p; | ||||||
|                     return result; |                     return result; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 if (normalizedName.Contains("720p")) |                 if (normalizedName.Contains("720p")) | ||||||
|                 { |                 { | ||||||
|                     result.Quality = QualityTypes.WEBDL720p; |                     result.Quality = Quality.WEBDL720p; | ||||||
|                     return result; |                     return result; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 if(name.Contains("[WEBDL]")) |                 if(name.Contains("[WEBDL]")) | ||||||
|                 { |                 { | ||||||
|                     result.Quality = QualityTypes.WEBDL720p; |                     result.Quality = Quality.WEBDL720p; | ||||||
|                     return result; |                     return result; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 result.Quality = QualityTypes.WEBDL480p; |                 result.Quality = Quality.WEBDL480p; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (normalizedName.Contains("trollhd") || normalizedName.Contains("rawhd")) |             if (normalizedName.Contains("trollhd") || normalizedName.Contains("rawhd")) | ||||||
|             { |             { | ||||||
|                 result.Quality = QualityTypes.RAWHD; |                 result.Quality = Quality.RAWHD; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -329,16 +329,16 @@ namespace NzbDrone.Core | |||||||
|             { |             { | ||||||
|                 if(normalizedName.Contains("1080p")) |                 if(normalizedName.Contains("1080p")) | ||||||
|                 { |                 { | ||||||
|                     result.Quality = QualityTypes.HDTV1080p; |                     result.Quality = Quality.HDTV1080p; | ||||||
|                     return result; |                     return result; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 result.Quality = QualityTypes.HDTV720p; |                 result.Quality = Quality.HDTV720p; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|             //Based on extension |             //Based on extension | ||||||
|  |  | ||||||
|             if (result.Quality == QualityTypes.Unknown) |             if (result.Quality == Quality.Unknown) | ||||||
|             { |             { | ||||||
|                 try |                 try | ||||||
|                 { |                 { | ||||||
| @@ -359,13 +359,13 @@ namespace NzbDrone.Core | |||||||
|                         case ".ogm": |                         case ".ogm": | ||||||
|                         case ".strm": |                         case ".strm": | ||||||
|                             { |                             { | ||||||
|                                 result.Quality = QualityTypes.SDTV; |                                 result.Quality = Quality.SDTV; | ||||||
|                                 break; |                                 break; | ||||||
|                             } |                             } | ||||||
|                         case ".mkv": |                         case ".mkv": | ||||||
|                         case ".ts": |                         case ".ts": | ||||||
|                             { |                             { | ||||||
|                                 result.Quality = QualityTypes.HDTV720p; |                                 result.Quality = Quality.HDTV720p; | ||||||
|                                 break; |                                 break; | ||||||
|                             } |                             } | ||||||
|                     } |                     } | ||||||
| @@ -379,21 +379,21 @@ namespace NzbDrone.Core | |||||||
|  |  | ||||||
|             if (name.Contains("[HDTV]")) |             if (name.Contains("[HDTV]")) | ||||||
|             { |             { | ||||||
|                 result.Quality = QualityTypes.HDTV720p; |                 result.Quality = Quality.HDTV720p; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (normalizedName.Contains("hdtv") && normalizedName.Contains("1080p")) |             if (normalizedName.Contains("hdtv") && normalizedName.Contains("1080p")) | ||||||
|             { |             { | ||||||
|                 result.Quality = QualityTypes.HDTV1080p; |                 result.Quality = Quality.HDTV1080p; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if ((normalizedName.Contains("sdtv") || normalizedName.Contains("pdtv") || |             if ((normalizedName.Contains("sdtv") || normalizedName.Contains("pdtv") || | ||||||
|                 (result.Quality == QualityTypes.Unknown && normalizedName.Contains("hdtv"))) && |                 (result.Quality == Quality.Unknown && normalizedName.Contains("hdtv"))) && | ||||||
|                 !normalizedName.Contains("mpeg")) |                 !normalizedName.Contains("mpeg")) | ||||||
|             { |             { | ||||||
|                 result.Quality = QualityTypes.SDTV; |                 result.Quality = Quality.SDTV; | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,11 +4,11 @@ using System.IO; | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using NLog; | using NLog; | ||||||
| using NzbDrone.Core.Configuration; | using NzbDrone.Core.Configuration; | ||||||
|  | using NzbDrone.Core.Qualities; | ||||||
| using NzbDrone.Core.Tv; | using NzbDrone.Core.Tv; | ||||||
| using NzbDrone.Core.Helpers; | using NzbDrone.Core.Helpers; | ||||||
| using NzbDrone.Core.Providers.Core; | using NzbDrone.Core.Providers.Core; | ||||||
| using NzbDrone.Core.Repository; | using NzbDrone.Core.Repository; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
| using NzbDrone.Common; | using NzbDrone.Common; | ||||||
|  |  | ||||||
| @@ -142,7 +142,7 @@ namespace NzbDrone.Core.Providers | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public virtual string GetNewFilename(IList<Episode> episodes, Series series, QualityTypes quality, bool proper, EpisodeFile episodeFile) |         public virtual string GetNewFilename(IList<Episode> episodes, Series series, Quality quality, bool proper, EpisodeFile episodeFile) | ||||||
|         { |         { | ||||||
|             if (_configService.SortingUseSceneName) |             if (_configService.SortingUseSceneName) | ||||||
|             { |             { | ||||||
| @@ -240,12 +240,12 @@ namespace NzbDrone.Core.Providers | |||||||
|             return CleanFilename(result.Trim()); |             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 }); |             _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 }); |             _database.Execute("UPDATE EpisodeFiles SET Quality = @quality WHERE SeriesId = @seriesId AND SeasonNumber = @seasonNumber", new { seriesId, seasonNumber, quality }); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -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<QualityProfile>("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<QualityProfile>(profileId); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public virtual List<QualityProfile> All() |  | ||||||
|         { |  | ||||||
|             var profiles = _database.Fetch<QualityProfile>().ToList(); |  | ||||||
|  |  | ||||||
|             return profiles; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public virtual QualityProfile Get(int profileId) |  | ||||||
|         { |  | ||||||
|             return _database.Single<QualityProfile>(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> { QualityTypes.SDTV, QualityTypes.DVD }, Cutoff = QualityTypes.SDTV }; |  | ||||||
|  |  | ||||||
|             var hd = new QualityProfile |  | ||||||
|             { |  | ||||||
|                 Name = "HD", |  | ||||||
|                 Allowed = new List<QualityTypes> { QualityTypes.HDTV720p, QualityTypes.WEBDL720p, QualityTypes.Bluray720p }, |  | ||||||
|                 Cutoff = QualityTypes.HDTV720p |  | ||||||
|             }; |  | ||||||
|  |  | ||||||
|             Add(sd); |  | ||||||
|             Add(hd); |  | ||||||
|  |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -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<QualityType> qualityTypes) |  | ||||||
|         { |  | ||||||
|             _database.UpdateMany(qualityTypes); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public virtual List<QualityType> All() |  | ||||||
|         { |  | ||||||
|             return _database.Fetch<QualityType>(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public virtual QualityType Get(int qualityTypeId) |  | ||||||
|         { |  | ||||||
|             return _database.Single<QualityType>(qualityTypeId); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public virtual List<QualityType> GetList(List<int> qualityTypeIds) |  | ||||||
|         { |  | ||||||
|             var queryParams = String.Join(", ", qualityTypeIds); |  | ||||||
|             var query = String.Format("WHERE QualityTypeId IN ({0})", queryParams); |  | ||||||
|  |  | ||||||
|             return _database.Fetch<QualityType>(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 }); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -2,15 +2,15 @@ | |||||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||||
| using System.Linq; | using System.Linq; | ||||||
| 
 | 
 | ||||||
| namespace NzbDrone.Core.Repository.Quality | namespace NzbDrone.Core.Qualities | ||||||
| { | { | ||||||
|     public class QualityTypes : IComparable<QualityTypes> |     public class Quality : IComparable<Quality> | ||||||
|     { |     { | ||||||
|         public int Id { get; set; } |         public int Id { get; set; } | ||||||
|         public string Name { get; set; } |         public string Name { get; set; } | ||||||
|         public int Weight { get; set; } |         public int Weight { get; set; } | ||||||
| 
 | 
 | ||||||
|         public int CompareTo(QualityTypes other) |         public int CompareTo(Quality other) | ||||||
|         { |         { | ||||||
|             if (other.Weight > Weight) |             if (other.Weight > Weight) | ||||||
|                 return -1; |                 return -1; | ||||||
| @@ -24,12 +24,12 @@ namespace NzbDrone.Core.Repository.Quality | |||||||
|             return 0; |             return 0; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public static bool operator !=(QualityTypes x, QualityTypes y) |         public static bool operator !=(Quality x, Quality y) | ||||||
|         { |         { | ||||||
|             return !(x == 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 xObj = (Object)x; | ||||||
|             var yObj = (object)y; |             var yObj = (object)y; | ||||||
| @@ -42,22 +42,22 @@ namespace NzbDrone.Core.Repository.Quality | |||||||
|             return x.CompareTo(y) == 0; |             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; |             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; |             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; |             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; |             return x.CompareTo(y) >= 0; | ||||||
|         } |         } | ||||||
| @@ -77,7 +77,7 @@ namespace NzbDrone.Core.Repository.Quality | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public bool Equals(QualityTypes other) |         public bool Equals(Quality other) | ||||||
|         { |         { | ||||||
|             if (ReferenceEquals(null, other)) return false; |             if (ReferenceEquals(null, other)) return false; | ||||||
|             if (ReferenceEquals(this, other)) return true; |             if (ReferenceEquals(this, other)) return true; | ||||||
| @@ -88,26 +88,26 @@ namespace NzbDrone.Core.Repository.Quality | |||||||
|         { |         { | ||||||
|             if (ReferenceEquals(null, obj)) return false; |             if (ReferenceEquals(null, obj)) return false; | ||||||
|             if (ReferenceEquals(this, obj)) return true; |             if (ReferenceEquals(this, obj)) return true; | ||||||
|             if (obj.GetType() != typeof (QualityTypes)) return false; |             if (obj.GetType() != typeof (Quality)) return false; | ||||||
|             return Equals((QualityTypes) obj); |             return Equals((Quality) obj); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public static QualityTypes Unknown = new QualityTypes { Id = 0, Name = "Unknown", Weight = 0 }; |         public static Quality Unknown = new Quality { Id = 0, Name = "Unknown", Weight = 0 }; | ||||||
|         public static QualityTypes SDTV = new QualityTypes {Id = 1, Name = "SDTV", Weight = 1}; |         public static Quality SDTV = new Quality {Id = 1, Name = "SDTV", Weight = 1}; | ||||||
|         public static QualityTypes WEBDL480p = new QualityTypes { Id = 8, Name = "WEBDL-480p", Weight = 2 }; |         public static Quality WEBDL480p = new Quality { Id = 8, Name = "WEBDL-480p", Weight = 2 }; | ||||||
|         public static QualityTypes DVD = new QualityTypes { Id = 2, Name = "DVD", Weight = 3 }; |         public static Quality DVD = new Quality { Id = 2, Name = "DVD", Weight = 3 }; | ||||||
|         public static QualityTypes HDTV720p = new QualityTypes { Id = 4, Name = "HDTV-720p", Weight = 4 }; |         public static Quality HDTV720p = new Quality { Id = 4, Name = "HDTV-720p", Weight = 4 }; | ||||||
|         public static QualityTypes HDTV1080p = new QualityTypes { Id = 9, Name = "HDTV-1080p", Weight = 5 }; |         public static Quality HDTV1080p = new Quality { Id = 9, Name = "HDTV-1080p", Weight = 5 }; | ||||||
|         public static QualityTypes RAWHD = new QualityTypes { Id = 10, Name = "Raw-HD", Weight = 6 }; |         public static Quality RAWHD = new Quality { Id = 10, Name = "Raw-HD", Weight = 6 }; | ||||||
|         public static QualityTypes WEBDL720p = new QualityTypes { Id = 5, Name = "WEBDL-720p", Weight = 7 }; |         public static Quality WEBDL720p = new Quality { Id = 5, Name = "WEBDL-720p", Weight = 7 }; | ||||||
|         public static QualityTypes Bluray720p = new QualityTypes { Id = 6, Name = "Bluray720p", Weight = 8 }; |         public static Quality Bluray720p = new Quality { Id = 6, Name = "Bluray720p", Weight = 8 }; | ||||||
|         public static QualityTypes WEBDL1080p = new QualityTypes { Id = 3, Name = "WEBDL-1080p", Weight = 9 }; |         public static Quality WEBDL1080p = new Quality { Id = 3, Name = "WEBDL-1080p", Weight = 9 }; | ||||||
|         public static QualityTypes Bluray1080p = new QualityTypes { Id = 7, Name = "Bluray1080p", Weight = 10 }; |         public static Quality Bluray1080p = new Quality { Id = 7, Name = "Bluray1080p", Weight = 10 }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         public static List<QualityTypes> All() |         public static List<Quality> All() | ||||||
|         { |         { | ||||||
|             return new List<QualityTypes> |             return new List<Quality> | ||||||
|                        { |                        { | ||||||
|                                Unknown, |                                Unknown, | ||||||
|                                SDTV, |                                SDTV, | ||||||
| @@ -123,7 +123,7 @@ namespace NzbDrone.Core.Repository.Quality | |||||||
|                        }; |                        }; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public static QualityTypes FindById(int id) |         public static Quality FindById(int id) | ||||||
|         { |         { | ||||||
|             var quality = All().SingleOrDefault(q => q.Id == id); |             var quality = All().SingleOrDefault(q => q.Id == id); | ||||||
| 
 | 
 | ||||||
| @@ -133,12 +133,12 @@ namespace NzbDrone.Core.Repository.Quality | |||||||
|             return quality;             |             return quality;             | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public static explicit operator QualityTypes(int id) |         public static explicit operator Quality(int id) | ||||||
|         { |         { | ||||||
|             return FindById(id); |             return FindById(id); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public static explicit operator int(QualityTypes quality) |         public static explicit operator int(Quality quality) | ||||||
|         { |         { | ||||||
|             return quality.Id; |             return quality.Id; | ||||||
|         } |         } | ||||||
							
								
								
									
										13
									
								
								NzbDrone.Core/Qualities/QualityProfile.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								NzbDrone.Core/Qualities/QualityProfile.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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<Quality> Allowed { get; set; } | ||||||
|  |         public Quality Cutoff { get; set; } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								NzbDrone.Core/Qualities/QualityProfileRepository.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								NzbDrone.Core/Qualities/QualityProfileRepository.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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<QualityProfile> | ||||||
|  |     { | ||||||
|  |          | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public class QualityProfileRepository : BasicRepository<QualityProfile>, IQualityProfileRepository | ||||||
|  |     { | ||||||
|  |         public QualityProfileRepository(IObjectDatabase database) | ||||||
|  |                 : base(database) | ||||||
|  |         { | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										76
									
								
								NzbDrone.Core/Qualities/QualityProfileService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								NzbDrone.Core/Qualities/QualityProfileService.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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<QualityProfile> 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<QualityProfile> 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> { Quality.SDTV, Quality.DVD }, Cutoff = Quality.SDTV }; | ||||||
|  |  | ||||||
|  |             var hd = new QualityProfile | ||||||
|  |             { | ||||||
|  |                 Name = "HD", | ||||||
|  |                 Allowed = new List<Quality> { Quality.HDTV720p, Quality.WEBDL720p, Quality.Bluray720p }, | ||||||
|  |                 Cutoff = Quality.HDTV720p | ||||||
|  |             }; | ||||||
|  |  | ||||||
|  |             Add(sd); | ||||||
|  |             Add(hd); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -1,13 +1,12 @@ | |||||||
| using System.Linq; | using System.Linq; | ||||||
|  | using NzbDrone.Core.Datastore; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
| 
 | 
 | ||||||
| namespace NzbDrone.Core.Repository.Quality | namespace NzbDrone.Core.Qualities | ||||||
| { | { | ||||||
|     [TableName("QualityTypes")] |     public class QualitySize : ModelBase | ||||||
|     [PrimaryKey("QualityTypeId", autoIncrement = false)] |  | ||||||
|     public class QualityType |  | ||||||
|     { |     { | ||||||
|         public int QualityTypeId { get; set; } |         public int QualityId { get; set; } | ||||||
|         public string Name { get; set; } |         public string Name { get; set; } | ||||||
|         public int MinSize { get; set; } |         public int MinSize { get; set; } | ||||||
|         public int MaxSize { get; set; } |         public int MaxSize { get; set; } | ||||||
							
								
								
									
										26
									
								
								NzbDrone.Core/Qualities/QualitySizeRepository.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								NzbDrone.Core/Qualities/QualitySizeRepository.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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> | ||||||
|  |     { | ||||||
|  |         QualitySize GetByQualityId(int qualityId); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public class QualitySizeRepository : BasicRepository<QualitySize>, IQualitySizeRepository | ||||||
|  |     { | ||||||
|  |         public QualitySizeRepository(IObjectDatabase database) | ||||||
|  |                 : base(database) | ||||||
|  |         { | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public QualitySize GetByQualityId(int qualityId) | ||||||
|  |         { | ||||||
|  |             return Queryable.Single(q => q.QualityId == qualityId); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										73
									
								
								NzbDrone.Core/Qualities/QualitySizeService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								NzbDrone.Core/Qualities/QualitySizeService.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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<QualitySize> qualitySizes); | ||||||
|  |         List<QualitySize> 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<QualitySize> qualitySizes) | ||||||
|  |         { | ||||||
|  |             _qualitySizeRepository.UpdateMany(qualitySizes); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public virtual List<QualitySize> 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 | ||||||
|  |                         }); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -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<QualityTypes> 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<QualityTypes>(qualities.Length); |  | ||||||
|                 foreach (var quality in qualities.Where(q => !String.IsNullOrWhiteSpace(q))) |  | ||||||
|                 { |  | ||||||
|                     Allowed.Add(QualityTypes.FindById(Convert.ToInt32(quality))); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -2,7 +2,6 @@ | |||||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||||
| using System.ComponentModel; | using System.ComponentModel; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Repository.Quality; |  | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Repository.Search | namespace NzbDrone.Core.Repository.Search | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||||
| using System.ComponentModel; | using System.ComponentModel; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Repository.Search | namespace NzbDrone.Core.Repository.Search | ||||||
| @@ -19,7 +19,7 @@ namespace NzbDrone.Core.Repository.Search | |||||||
|         public string NzbInfoUrl { get; set; } |         public string NzbInfoUrl { get; set; } | ||||||
|         public bool Success { get; set; } |         public bool Success { get; set; } | ||||||
|         public ReportRejectionType SearchError { get; set; } |         public ReportRejectionType SearchError { get; set; } | ||||||
|         public Quality.QualityTypes Quality { get; set; } |         public Quality Quality { get; set; } | ||||||
|         public bool Proper { get; set; } |         public bool Proper { get; set; } | ||||||
|         public int Age { get; set; } |         public int Age { get; set; } | ||||||
|         public LanguageType Language { get; set; } |         public LanguageType Language { get; set; } | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using System; | using System; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Tv | namespace NzbDrone.Core.Tv | ||||||
| @@ -28,7 +28,7 @@ namespace NzbDrone.Core.Tv | |||||||
|         public int SeriesId { get; set; } |         public int SeriesId { get; set; } | ||||||
|         public int SeasonNumber { get; set; } |         public int SeasonNumber { get; set; } | ||||||
|         public string Path { get; set; } |         public string Path { get; set; } | ||||||
|         public QualityTypes Quality { get; set; } |         public Quality Quality { get; set; } | ||||||
|         public bool Proper { get; set; } |         public bool Proper { get; set; } | ||||||
|         public long Size { get; set; } |         public long Size { get; set; } | ||||||
|         public DateTime DateAdded { get; set; } |         public DateTime DateAdded { get; set; } | ||||||
|   | |||||||
| @@ -1,21 +1,21 @@ | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using System; | using System; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Tv | namespace NzbDrone.Core.Tv | ||||||
| { | { | ||||||
|     public class QualityModel : IComparable<QualityModel> |     public class QualityModel : IComparable<QualityModel> | ||||||
|     { |     { | ||||||
|         public QualityTypes Quality { get; set; } |         public Quality Quality { get; set; } | ||||||
|  |  | ||||||
|         public Boolean Proper { 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; |             Quality = quality; | ||||||
|             Proper = proper; |             Proper = proper; | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| using System; | using System; | ||||||
| using NzbDrone.Core.Datastore; | using NzbDrone.Core.Datastore; | ||||||
| using NzbDrone.Core.Model; | using NzbDrone.Core.Model; | ||||||
| using NzbDrone.Core.Repository.Quality; | using NzbDrone.Core.Qualities; | ||||||
| using PetaPoco; | using PetaPoco; | ||||||
|  |  | ||||||
| namespace NzbDrone.Core.Tv | namespace NzbDrone.Core.Tv | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user