diff --git a/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs index aa77d5911..6a76de3cd 100644 --- a/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs @@ -17,7 +17,7 @@ namespace NzbDrone.Core.Test.ProviderTests public class QualityTypeProviderTest : CoreTest { [Test] - public void SetupDefault_should_add_six_profiles() + public void SetupDefault_should_add_all_profiles() { var db = TestDbHelper.GetEmptyDatabase(); @@ -33,8 +33,8 @@ public void SetupDefault_should_add_six_profiles() 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 == "HDTV" && e.QualityTypeId == 4); - types.Should().Contain(e => e.Name == "WEBDL720p" && e.QualityTypeId == 5); - types.Should().Contain(e => e.Name == "WEBDL1080p" && e.QualityTypeId == 3); + 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); } diff --git a/NzbDrone.Core/Providers/QualityTypeProvider.cs b/NzbDrone.Core/Providers/QualityTypeProvider.cs index bec9b7843..fba4d417c 100644 --- a/NzbDrone.Core/Providers/QualityTypeProvider.cs +++ b/NzbDrone.Core/Providers/QualityTypeProvider.cs @@ -58,21 +58,15 @@ public virtual void SetupDefault() Logger.Debug("Setting up default quality types"); - var qualityTypes = new List(); - qualityTypes.Add(new QualityType { QualityTypeId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 }); - qualityTypes.Add(new QualityType { QualityTypeId = 2, Name = "DVD", MinSize = 0, MaxSize = 100 }); - qualityTypes.Add(new QualityType { QualityTypeId = 4, Name = "HDTV", MinSize = 0, MaxSize = 100 }); - qualityTypes.Add(new QualityType { QualityTypeId = 5, Name = "WEBDL720p", MinSize = 0, MaxSize = 100 }); - qualityTypes.Add(new QualityType { QualityTypeId = 3, Name = "WEBDL1080p", MinSize = 0, MaxSize = 100 }); - qualityTypes.Add(new QualityType { QualityTypeId = 6, Name = "Bluray720p", MinSize = 0, MaxSize = 100 }); - qualityTypes.Add(new QualityType { QualityTypeId = 7, Name = "Bluray1080p", MinSize = 0, MaxSize = 100 }); - - foreach(var qualityType in qualityTypes) + foreach(var qualityType in QualityTypes.All()) { - var db = inDb.SingleOrDefault(s => s.QualityTypeId == qualityType.QualityTypeId); + //Skip UNKNOWN + if (qualityType.Id == 0) continue; + + var db = inDb.SingleOrDefault(s => s.QualityTypeId == qualityType.Id); if (db == null) - _database.Insert(qualityType); + _database.Insert(new QualityType { QualityTypeId = qualityType.Id, Name = qualityType.Name, MinSize = 0, MaxSize = 100 }); } } }