Add Metadata Profiles (#132)

* Add Metadata Profiles

* fixup! Codacy
This commit is contained in:
Qstick
2017-11-25 22:51:37 -05:00
committed by GitHub
parent dd11f74073
commit 5b7339cd73
92 changed files with 2611 additions and 145 deletions
@@ -0,0 +1,41 @@
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();
}
}
}