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.
|
|
|
using System.Collections.Generic;
|
|
|
|
using Lidarr.Http;
|
|
|
|
using Lidarr.Http.Extensions;
|
|
|
|
using Nancy;
|
|
|
|
using NzbDrone.Core.Music;
|
|
|
|
|
|
|
|
namespace Lidarr.Api.V1.Artist
|
|
|
|
{
|
|
|
|
public class ArtistImportModule : LidarrRestModule<ArtistResource>
|
|
|
|
{
|
|
|
|
private readonly IAddArtistService _addArtistService;
|
|
|
|
|
|
|
|
public ArtistImportModule(IAddArtistService addArtistService)
|
|
|
|
: base("/artist/import")
|
|
|
|
{
|
|
|
|
_addArtistService = addArtistService;
|
|
|
|
Post("/", x => Import());
|
|
|
|
}
|
|
|
|
|
|
|
|
private object Import()
|
|
|
|
{
|
|
|
|
var resource = Request.Body.FromJson<List<ArtistResource>>();
|
|
|
|
var newArtists = resource.ToModel();
|
|
|
|
|
|
|
|
return _addArtistService.AddArtists(newArtists).ToResource();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|