QualityType sizes are added automatically

pull/19/merge
Mark McDowall 12 years ago
parent d50091f3a4
commit 21ccdaa68b

@ -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);
}

@ -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 });
}
}
}

Loading…
Cancel
Save