using System.Collections.Generic; using NzbDrone.Core.Qualities; using NzbDrone.Api.Mapping; using System.Linq; namespace NzbDrone.Api.Qualities { public class QualityProfileSchemaModule : NzbDroneRestModule { public QualityProfileSchemaModule() : base("/qualityprofiles/schema") { GetResourceAll = GetAll; } private List GetAll() { var profile = new QualityProfile(); profile.Cutoff = Quality.Unknown; profile.Allowed = new List(); return new List{ QualityToResource(profile)}; } private static QualityProfileResource QualityToResource(QualityProfile profile) { return new QualityProfileResource { Available = Quality.All() .Where(c => !profile.Allowed.Any(q => c.Id == q.Id)) .InjectTo>(), Allowed = profile.Allowed.InjectTo>(), Name = profile.Name, Id = profile.Id }; } } }