Added Quality Provider to interface with QualityProfiles.

Changed QualityProfile and AllowedQuality to be meet requirements
This commit is contained in:
markus101 2011-02-02 17:07:36 -08:00
commit 3b63cfb5d2
5 changed files with 112 additions and 26 deletions

View file

@ -1,4 +1,6 @@
namespace NzbDrone.Core.Repository.Quality
using SubSonic.SqlGeneration.Schema;
namespace NzbDrone.Core.Repository.Quality
{
public class AllowedQuality
{
@ -7,5 +9,8 @@
public int Order { get; set; }
public bool MarkComplete { get; set; }
public QualityTypes Quality { get; set; }
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
public virtual QualityProfile QualityProfile { get; private set; }
}
}

View file

@ -7,33 +7,15 @@ namespace NzbDrone.Core.Repository.Quality
{
public class QualityProfile
{
public int Id { get; set; }
public QualityTypes Cutoff { get; set; }
[SubSonicPrimaryKey(true)]
public int ProfileId { get; set; }
public string Name { get; set; }
public bool UserProfile { get; set; } //Allows us to tell the difference between default and user profiles
[EditorBrowsable(EditorBrowsableState.Never)]
public string SonicAllowed
{
get
{
string result = String.Empty;
foreach (var q in Allowed)
{
result += (int)q + "|";
}
return result.Trim('|');
}
private set
{
var qualities = value.Split('|');
Allowed = new List<QualityTypes>(qualities.Length);
foreach (var quality in qualities)
{
Allowed.Add((QualityTypes)Convert.ToInt32(quality));
}
}
}
[SubSonicToManyRelation]
public virtual List<AllowedQuality> Allowed { get; private set; }
[SubSonicIgnore]
public List<QualityTypes> Allowed { get; set; }
public List<AllowedQuality> AllowedQualities { get; set; }
}
}