QualityType sizes are added automatically

This commit is contained in:
Mark McDowall 2012-11-13 08:37:08 -08:00
parent d50091f3a4
commit 21ccdaa68b
2 changed files with 9 additions and 15 deletions

View File

@ -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 @@ namespace NzbDrone.Core.Test.ProviderTests
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);
}

View File

@ -58,21 +58,15 @@ namespace NzbDrone.Core.Providers
Logger.Debug("Setting up default quality types");
var qualityTypes = new List<QualityType>();
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 });
}
}
}