mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-22 22:14:44 -04:00
21428cba6f
* Multi Disc Stage 1 - Backend Work * Quality Group Functionality * Fixed: Only show wanted album types on ArtistDetail page * Add Media Count Column to ArtistDetail Page * Parser updates for multidisc cases, other usenet release title formats * Search for Tracks by Medium Number in Addition to Title and TrackNumber * Medium Renaming Token for Track Naming * fixup Codacy and Comment Cleanup * fixup remove comments
53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NzbDrone.Core.Profiles.Qualities;
|
|
using Lidarr.Http;
|
|
|
|
namespace Lidarr.Api.V1.Profiles.Quality
|
|
{
|
|
public class QualityProfileSchemaModule : LidarrRestModule<QualityProfileResource>
|
|
{
|
|
public QualityProfileSchemaModule()
|
|
: base("/qualityprofile/schema")
|
|
{
|
|
GetResourceSingle = GetSchema;
|
|
}
|
|
|
|
private QualityProfileResource GetSchema()
|
|
{
|
|
var groupedQualites = NzbDrone.Core.Qualities.Quality.DefaultQualityDefinitions.GroupBy(q => q.Weight);
|
|
var items = new List<ProfileQualityItem>();
|
|
var groupId = 1000;
|
|
|
|
foreach (var group in groupedQualites)
|
|
{
|
|
if (group.Count() == 1)
|
|
{
|
|
items.Add(new ProfileQualityItem { Quality = group.First().Quality, Allowed = false });
|
|
continue;
|
|
}
|
|
|
|
items.Add(new ProfileQualityItem
|
|
{
|
|
Id = groupId,
|
|
Name = group.First().GroupName,
|
|
Items = group.Select(g => new ProfileQualityItem
|
|
{
|
|
Quality = g.Quality,
|
|
Allowed = false
|
|
}).ToList(),
|
|
Allowed = false
|
|
});
|
|
|
|
groupId++;
|
|
}
|
|
|
|
var qualityProfile = new Profile();
|
|
qualityProfile.Cutoff = NzbDrone.Core.Qualities.Quality.Unknown.Id;
|
|
qualityProfile.Items = items;
|
|
|
|
return qualityProfile.ToResource();
|
|
}
|
|
}
|
|
}
|