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.
Lidarr/src/Lidarr.Api.V1/Profiles/Metadata/MetadataProfileSchemaModule.cs

42 lines
1.5 KiB

using System.Linq;
using NzbDrone.Core.Profiles.Metadata;
using Lidarr.Http;
namespace Lidarr.Api.V1.Profiles.Metadata
{
public class MetadataProfileSchemaModule : LidarrRestModule<MetadataProfileResource>
{
public MetadataProfileSchemaModule()
: base("/metadataprofile/schema")
{
GetResourceSingle = GetAll;
}
private MetadataProfileResource GetAll()
{
var orderedPrimTypes = NzbDrone.Core.Music.PrimaryAlbumType.All
.OrderByDescending(l => l.Id)
.ToList();
var orderedSecTypes = NzbDrone.Core.Music.SecondaryAlbumType.All
.OrderByDescending(l => l.Id)
.ToList();
var primTypes = orderedPrimTypes.Select(v => new ProfilePrimaryAlbumTypeItem {PrimaryAlbumType = v, Allowed = false})
.ToList();
var secTypes = orderedSecTypes.Select(v => new ProfileSecondaryAlbumTypeItem { SecondaryAlbumType = v, Allowed = false })
.ToList();
var profile = new MetadataProfile
{
PrimaryAlbumTypes = primTypes,
SecondaryAlbumTypes = secTypes
};
return profile.ToResource();
}
}
}