You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
using System.Linq;
|
|
using NzbDrone.Core.Profiles.Qualities;
|
|
using NzbDrone.Core.Qualities;
|
|
using Lidarr.Http;
|
|
|
|
namespace Lidarr.Api.V1.Profiles.Quality
|
|
{
|
|
public class QualityProfileSchemaModule : LidarrRestModule<QualityProfileResource>
|
|
{
|
|
private readonly IQualityDefinitionService _qualityDefinitionService;
|
|
|
|
public QualityProfileSchemaModule(IQualityDefinitionService qualityDefinitionService)
|
|
: base("/qualityprofile/schema")
|
|
{
|
|
_qualityDefinitionService = qualityDefinitionService;
|
|
|
|
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;
|
|
|
|
return qualityProfile.ToResource();
|
|
}
|
|
}
|
|
} |