mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-30 19:50:15 -07:00
Quality Size knobbed, other quality changes
This commit is contained in:
parent
a3a1cf26ee
commit
f78f396940
25 changed files with 888 additions and 405 deletions
41
NzbDrone.Api/Qualities/QualityProfileSchemaModule.cs
Normal file
41
NzbDrone.Api/Qualities/QualityProfileSchemaModule.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Api.Mapping;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Api.Qualities
|
||||
{
|
||||
public class QualityProfileSchemaModule : NzbDroneRestModule<QualityProfileResource>
|
||||
{
|
||||
public QualityProfileSchemaModule()
|
||||
: base("/qualityprofiles/schema")
|
||||
{
|
||||
GetResourceAll = GetAll;
|
||||
}
|
||||
|
||||
private List<QualityProfileResource> GetAll()
|
||||
{
|
||||
var profile = new QualityProfile();
|
||||
profile.Cutoff = Quality.Unknown;
|
||||
profile.Allowed = new List<Quality>();
|
||||
|
||||
return new List<QualityProfileResource>{ 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<List<QualityResource>>(),
|
||||
|
||||
Allowed = profile.Allowed.InjectTo<List<QualityResource>>(),
|
||||
Name = profile.Name,
|
||||
Id = profile.Id
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue