mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-24 16:51:58 +00:00
Fixed up a couple things according to comments
This commit is contained in:
parent
e0702f5f67
commit
240d06d6a8
3 changed files with 17 additions and 20 deletions
|
@ -92,17 +92,17 @@ public override bool Equals(object obj)
|
|||
return Equals((Quality) obj);
|
||||
}
|
||||
|
||||
public static Quality Unknown = new Quality { Id = 0, Name = "Unknown", Weight = 0 };
|
||||
public static Quality SDTV = new Quality {Id = 1, Name = "SDTV", Weight = 1};
|
||||
public static Quality WEBDL480p = new Quality { Id = 8, Name = "WEBDL-480p", Weight = 2 };
|
||||
public static Quality DVD = new Quality { Id = 2, Name = "DVD", Weight = 3 };
|
||||
public static Quality HDTV720p = new Quality { Id = 4, Name = "HDTV-720p", Weight = 4 };
|
||||
public static Quality HDTV1080p = new Quality { Id = 9, Name = "HDTV-1080p", Weight = 5 };
|
||||
public static Quality RAWHD = new Quality { Id = 10, Name = "Raw-HD", Weight = 6 };
|
||||
public static Quality WEBDL720p = new Quality { Id = 5, Name = "WEBDL-720p", Weight = 7 };
|
||||
public static Quality Bluray720p = new Quality { Id = 6, Name = "Bluray720p", Weight = 8 };
|
||||
public static Quality WEBDL1080p = new Quality { Id = 3, Name = "WEBDL-1080p", Weight = 9 };
|
||||
public static Quality Bluray1080p = new Quality { Id = 7, Name = "Bluray1080p", Weight = 10 };
|
||||
public static readonly Quality Unknown = new Quality { Id = 0, Name = "Unknown", Weight = 0 };
|
||||
public static readonly Quality SDTV = new Quality {Id = 1, Name = "SDTV", Weight = 1};
|
||||
public static readonly Quality WEBDL480p = new Quality { Id = 8, Name = "WEBDL-480p", Weight = 2 };
|
||||
public static readonly Quality DVD = new Quality { Id = 2, Name = "DVD", Weight = 3 };
|
||||
public static readonly Quality HDTV720p = new Quality { Id = 4, Name = "HDTV-720p", Weight = 4 };
|
||||
public static readonly Quality HDTV1080p = new Quality { Id = 9, Name = "HDTV-1080p", Weight = 5 };
|
||||
public static readonly Quality RAWHD = new Quality { Id = 10, Name = "Raw-HD", Weight = 6 };
|
||||
public static readonly Quality WEBDL720p = new Quality { Id = 5, Name = "WEBDL-720p", Weight = 7 };
|
||||
public static readonly Quality Bluray720p = new Quality { Id = 6, Name = "Bluray720p", Weight = 8 };
|
||||
public static readonly Quality WEBDL1080p = new Quality { Id = 3, Name = "WEBDL-1080p", Weight = 9 };
|
||||
public static readonly Quality Bluray1080p = new Quality { Id = 7, Name = "Bluray1080p", Weight = 10 };
|
||||
|
||||
|
||||
public static List<Quality> All()
|
||||
|
|
|
@ -55,7 +55,7 @@ public QualityProfile Get(int id)
|
|||
|
||||
public void Init()
|
||||
{
|
||||
if (All().Count != 0)
|
||||
if (All().Any())
|
||||
return;
|
||||
|
||||
_logger.Info("Setting up default quality profiles");
|
||||
|
|
|
@ -48,18 +48,14 @@ public virtual QualitySize Get(int qualityId)
|
|||
|
||||
public void Init()
|
||||
{
|
||||
var inDb = All();
|
||||
var existing = All();
|
||||
|
||||
_logger.Debug("Setting up default quality sizes");
|
||||
|
||||
foreach (var quality in Quality.All())
|
||||
foreach (var quality in Quality.All().Where(q => q.Id > 0))
|
||||
{
|
||||
//Skip UNKNOWN
|
||||
if (quality.Id == 0) continue;
|
||||
|
||||
var db = inDb.SingleOrDefault(s => s.QualityId == quality.Id);
|
||||
|
||||
if(db == null)
|
||||
if(existing.SingleOrDefault(s => s.QualityId == quality.Id) == null)
|
||||
{
|
||||
_qualitySizeRepository.Insert(new QualitySize
|
||||
{
|
||||
QualityId = quality.Id,
|
||||
|
@ -67,6 +63,7 @@ public void Init()
|
|||
MinSize = 0,
|
||||
MaxSize = 100
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue