|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using FluentValidation;
|
|
|
|
using FluentValidation;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
|
|
|
|
using NzbDrone.Api.Extensions;
|
|
|
|
using NzbDrone.Core.Datastore.Events;
|
|
|
|
using NzbDrone.Core.Datastore.Events;
|
|
|
|
using NzbDrone.Core.MediaCover;
|
|
|
|
using NzbDrone.Core.MediaCover;
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
@ -33,6 +34,8 @@ namespace NzbDrone.Api.Movie
|
|
|
|
private readonly IMovieStatisticsService _moviesStatisticsService;
|
|
|
|
private readonly IMovieStatisticsService _moviesStatisticsService;
|
|
|
|
private readonly IMapCoversToLocal _coverMapper;
|
|
|
|
private readonly IMapCoversToLocal _coverMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private const string TITLE_SLUG_ROUTE = "/titleslug/(?<slug>[^/]+)";
|
|
|
|
|
|
|
|
|
|
|
|
public MovieModule(IBroadcastSignalRMessage signalRBroadcaster,
|
|
|
|
public MovieModule(IBroadcastSignalRMessage signalRBroadcaster,
|
|
|
|
IMovieService moviesService,
|
|
|
|
IMovieService moviesService,
|
|
|
|
IMovieStatisticsService moviesStatisticsService,
|
|
|
|
IMovieStatisticsService moviesStatisticsService,
|
|
|
@ -55,6 +58,9 @@ namespace NzbDrone.Api.Movie
|
|
|
|
GetResourceAll = AllMovie;
|
|
|
|
GetResourceAll = AllMovie;
|
|
|
|
GetResourcePaged = GetMoviePaged;
|
|
|
|
GetResourcePaged = GetMoviePaged;
|
|
|
|
GetResourceById = GetMovie;
|
|
|
|
GetResourceById = GetMovie;
|
|
|
|
|
|
|
|
Get[TITLE_SLUG_ROUTE] = (options) => {
|
|
|
|
|
|
|
|
return ReqResExtensions.AsResponse(GetByTitleSlug(options.slug));
|
|
|
|
|
|
|
|
};
|
|
|
|
CreateResource = AddMovie;
|
|
|
|
CreateResource = AddMovie;
|
|
|
|
UpdateResource = UpdateMovie;
|
|
|
|
UpdateResource = UpdateMovie;
|
|
|
|
DeleteResource = DeleteMovie;
|
|
|
|
DeleteResource = DeleteMovie;
|
|
|
@ -186,6 +192,11 @@ namespace NzbDrone.Api.Movie
|
|
|
|
return moviesResources;
|
|
|
|
return moviesResources;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MovieResource GetByTitleSlug(string slug)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return MapToResource(_moviesService.FindByTitleSlug(slug));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private int AddMovie(MovieResource moviesResource)
|
|
|
|
private int AddMovie(MovieResource moviesResource)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var model = moviesResource.ToModel();
|
|
|
|
var model = moviesResource.ToModel();
|
|
|
|