1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-25 22:46:31 -04:00

Quality groups

This commit is contained in:
Mark McDowall
2017-06-18 10:02:20 -07:00
committed by Taloth Saldono
parent 068ea1e934
commit f31ac39e37
52 changed files with 1119 additions and 197 deletions
@@ -1,34 +1,24 @@
using System.Linq;
using NzbDrone.Core.Profiles.Qualities;
using NzbDrone.Core.Qualities;
using Sonarr.Http;
namespace Sonarr.Api.V3.Profiles.Quality
{
public class QualityProfileSchemaModule : SonarrRestModule<QualityProfileResource>
{
private readonly IQualityDefinitionService _qualityDefinitionService;
private readonly IProfileService _profileService;
public QualityProfileSchemaModule(IQualityDefinitionService qualityDefinitionService)
public QualityProfileSchemaModule(IProfileService profileService)
: base("/qualityprofile/schema")
{
_qualityDefinitionService = qualityDefinitionService;
_profileService = profileService;
GetResourceSingle = GetSchema;
}
private QualityProfileResource GetSchema()
{
var items = _qualityDefinitionService.All()
.OrderBy(v => v.Weight)
.Select(v => new ProfileQualityItem { Quality = v.Quality, Allowed = false })
.ToList();
var qualityProfile = new Profile();
qualityProfile.Cutoff = NzbDrone.Core.Qualities.Quality.Unknown;
qualityProfile.Items = items;
var qualityProfile = _profileService.GetDefaultProfile(string.Empty);
return qualityProfile.ToResource();
}
}
}
}