2010-09-29 17:19:18 +00:00
|
|
|
|
using System;
|
2011-06-18 04:39:02 +00:00
|
|
|
|
using System.Linq;
|
2010-09-29 17:19:18 +00:00
|
|
|
|
using System.Collections.Generic;
|
2010-09-30 06:59:00 +00:00
|
|
|
|
using System.ComponentModel;
|
2011-02-11 01:22:29 +00:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2011-06-17 20:31:25 +00:00
|
|
|
|
using PetaPoco;
|
2010-09-29 17:19:18 +00:00
|
|
|
|
|
2010-10-21 01:49:23 +00:00
|
|
|
|
namespace NzbDrone.Core.Repository.Quality
|
2010-09-29 17:19:18 +00:00
|
|
|
|
{
|
2011-06-17 20:31:25 +00:00
|
|
|
|
[TableName("QualityProfiles")]
|
|
|
|
|
[PrimaryKey("QualityProfileId", autoIncrement = true)]
|
2010-09-29 17:19:18 +00:00
|
|
|
|
public class QualityProfile
|
|
|
|
|
{
|
2011-03-31 01:42:27 +00:00
|
|
|
|
public virtual int QualityProfileId { get; set; }
|
2011-02-06 02:52:49 +00:00
|
|
|
|
|
2011-02-16 08:16:14 +00:00
|
|
|
|
[Required(ErrorMessage = "A Name is Required")]
|
2011-02-05 18:27:14 +00:00
|
|
|
|
[DisplayName("Name")]
|
2011-02-15 01:20:17 +00:00
|
|
|
|
[DisplayFormat(ConvertEmptyStringToNull = false)]
|
2011-02-03 01:07:36 +00:00
|
|
|
|
public string Name { get; set; }
|
2011-04-10 02:44:01 +00:00
|
|
|
|
|
2011-06-17 20:31:25 +00:00
|
|
|
|
[Ignore]
|
2011-02-05 18:27:14 +00:00
|
|
|
|
[DisplayName("Allowed Qualities")]
|
2011-02-03 19:47:51 +00:00
|
|
|
|
public List<QualityTypes> Allowed { get; set; }
|
|
|
|
|
|
2011-06-17 20:31:25 +00:00
|
|
|
|
[Ignore]
|
2011-02-06 02:52:49 +00:00
|
|
|
|
[DisplayName("Allowed Qualities String")]
|
2011-02-15 01:20:17 +00:00
|
|
|
|
[DisplayFormat(ConvertEmptyStringToNull = false)]
|
2011-02-06 02:52:49 +00:00
|
|
|
|
public string AllowedString { get; set; }
|
|
|
|
|
|
2011-03-31 01:42:27 +00:00
|
|
|
|
[DisplayName("Cut-off")]
|
|
|
|
|
[Required(ErrorMessage = "Valid Cut-off is Required")]
|
2011-02-03 20:09:19 +00:00
|
|
|
|
public QualityTypes Cutoff { get; set; }
|
2010-09-30 06:59:00 +00:00
|
|
|
|
|
2011-02-03 20:09:19 +00:00
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
|
|
|
public string SonicAllowed
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
string result = String.Empty;
|
2011-04-05 05:30:13 +00:00
|
|
|
|
if (Allowed == null) return result;
|
2011-04-10 02:44:01 +00:00
|
|
|
|
|
2011-02-03 20:09:19 +00:00
|
|
|
|
foreach (var q in Allowed)
|
|
|
|
|
{
|
2011-04-20 01:56:02 +00:00
|
|
|
|
result += (int)q + "|";
|
2011-02-03 20:09:19 +00:00
|
|
|
|
}
|
|
|
|
|
return result.Trim('|');
|
|
|
|
|
}
|
|
|
|
|
private set
|
|
|
|
|
{
|
|
|
|
|
var qualities = value.Split('|');
|
|
|
|
|
Allowed = new List<QualityTypes>(qualities.Length);
|
2011-06-18 04:39:02 +00:00
|
|
|
|
foreach (var quality in qualities.Where(q => !String.IsNullOrWhiteSpace(q)))
|
2011-02-03 20:09:19 +00:00
|
|
|
|
{
|
2011-04-20 01:56:02 +00:00
|
|
|
|
Allowed.Add((QualityTypes)Convert.ToInt32(quality));
|
2011-02-03 20:09:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-09-29 17:19:18 +00:00
|
|
|
|
}
|
2011-04-10 02:44:01 +00:00
|
|
|
|
}
|