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.
30 lines
738 B
30 lines
738 B
using System.Collections.Generic;
|
|
using Nancy;
|
|
using NzbDrone.Core.Movies;
|
|
using Radarr.Http;
|
|
using Radarr.Http.Extensions;
|
|
|
|
namespace Radarr.Api.V3.Movies
|
|
{
|
|
public class MovieImportModule : RadarrRestModule<MovieResource>
|
|
{
|
|
private readonly IMovieService _movieService;
|
|
|
|
public MovieImportModule(IMovieService movieService)
|
|
: base("/movie/import")
|
|
{
|
|
_movieService = movieService;
|
|
Post("/", x => Import());
|
|
}
|
|
|
|
|
|
private object Import()
|
|
{
|
|
var resource = Request.Body.FromJson<List<MovieResource>>();
|
|
var newSeries = resource.ToModel();
|
|
|
|
return _movieService.AddMovies(newSeries).ToResource();
|
|
}
|
|
}
|
|
}
|