mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-01 07:55:22 +02:00
Fixed: Cutoff Status and Filter on MovieIndex
This commit is contained in:
@@ -3,6 +3,7 @@ using FluentValidation;
|
||||
using Nancy;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
@@ -28,20 +29,22 @@ namespace Radarr.Api.V3.Movies
|
||||
{
|
||||
protected readonly IMovieService _moviesService;
|
||||
private readonly IMapCoversToLocal _coverMapper;
|
||||
private readonly IUpgradableSpecification _qualityUpgradableSpecification;
|
||||
|
||||
public MovieModule(IBroadcastSignalRMessage signalRBroadcaster,
|
||||
IMovieService moviesService,
|
||||
IMapCoversToLocal coverMapper,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
MoviePathValidator moviesPathValidator,
|
||||
MovieExistsValidator moviesExistsValidator,
|
||||
MovieAncestorValidator moviesAncestorValidator,
|
||||
ProfileExistsValidator profileExistsValidator,
|
||||
MovieFolderAsRootFolderValidator movieFolderAsRootFolderValidator)
|
||||
IMovieService moviesService,
|
||||
IMapCoversToLocal coverMapper,
|
||||
IUpgradableSpecification qualityUpgradableSpecification,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
MoviePathValidator moviesPathValidator,
|
||||
MovieExistsValidator moviesExistsValidator,
|
||||
MovieAncestorValidator moviesAncestorValidator,
|
||||
ProfileExistsValidator profileExistsValidator,
|
||||
MovieFolderAsRootFolderValidator movieFolderAsRootFolderValidator)
|
||||
: base(signalRBroadcaster)
|
||||
{
|
||||
_moviesService = moviesService;
|
||||
|
||||
_qualityUpgradableSpecification = qualityUpgradableSpecification;
|
||||
_coverMapper = coverMapper;
|
||||
|
||||
GetResourceAll = AllMovie;
|
||||
@@ -75,7 +78,7 @@ namespace Radarr.Api.V3.Movies
|
||||
|
||||
private List<MovieResource> AllMovie()
|
||||
{
|
||||
var moviesResources = _moviesService.GetAllMovies().ToResource();
|
||||
var moviesResources = _moviesService.GetAllMovies().ToResource(_qualityUpgradableSpecification);
|
||||
|
||||
MapCoversToLocal(moviesResources.ToArray());
|
||||
PopulateAlternateTitles(moviesResources);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Movies;
|
||||
using Radarr.Api.V3.MovieFiles;
|
||||
@@ -132,6 +133,67 @@ namespace Radarr.Api.V3.Movies
|
||||
};
|
||||
}
|
||||
|
||||
public static MovieResource ToResource(this Movie model, IUpgradableSpecification upgradableSpecification)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
long size = model.MovieFile?.Size ?? 0;
|
||||
MovieFileResource movieFile = model.MovieFile?.ToResource(model, upgradableSpecification);
|
||||
|
||||
return new MovieResource
|
||||
{
|
||||
Id = model.Id,
|
||||
TmdbId = model.TmdbId,
|
||||
Title = model.Title,
|
||||
SortTitle = model.SortTitle,
|
||||
InCinemas = model.InCinemas,
|
||||
PhysicalRelease = model.PhysicalRelease,
|
||||
PhysicalReleaseNote = model.PhysicalReleaseNote,
|
||||
HasFile = model.HasFile,
|
||||
|
||||
SizeOnDisk = size,
|
||||
Status = model.Status,
|
||||
Overview = model.Overview,
|
||||
|
||||
Images = model.Images,
|
||||
|
||||
Year = model.Year,
|
||||
SecondaryYear = model.SecondaryYear,
|
||||
SecondaryYearSourceId = model.SecondaryYearSourceId,
|
||||
|
||||
Path = model.Path,
|
||||
QualityProfileId = model.ProfileId,
|
||||
PathState = model.PathState,
|
||||
|
||||
Monitored = model.Monitored,
|
||||
MinimumAvailability = model.MinimumAvailability,
|
||||
|
||||
IsAvailable = model.IsAvailable(),
|
||||
FolderName = model.FolderName(),
|
||||
|
||||
Runtime = model.Runtime,
|
||||
LastInfoSync = model.LastInfoSync,
|
||||
CleanTitle = model.CleanTitle,
|
||||
ImdbId = model.ImdbId,
|
||||
TitleSlug = model.TitleSlug,
|
||||
RootFolderPath = model.RootFolderPath,
|
||||
Certification = model.Certification,
|
||||
Website = model.Website,
|
||||
Genres = model.Genres,
|
||||
Tags = model.Tags,
|
||||
Added = model.Added,
|
||||
AddOptions = model.AddOptions,
|
||||
AlternateTitles = model.AlternativeTitles.ToResource(),
|
||||
Ratings = model.Ratings,
|
||||
MovieFile = movieFile,
|
||||
YouTubeTrailerId = model.YouTubeTrailerId,
|
||||
Studio = model.Studio
|
||||
};
|
||||
}
|
||||
|
||||
public static Movie ToModel(this MovieResource resource)
|
||||
{
|
||||
if (resource == null)
|
||||
@@ -197,6 +259,11 @@ namespace Radarr.Api.V3.Movies
|
||||
return movies.Select(ToResource).ToList();
|
||||
}
|
||||
|
||||
public static List<MovieResource> ToResource(this IEnumerable<Movie> movies, IUpgradableSpecification upgradableSpecification)
|
||||
{
|
||||
return movies.ToList().ConvertAll(f => f.ToResource(upgradableSpecification));
|
||||
}
|
||||
|
||||
public static List<Movie> ToModel(this IEnumerable<MovieResource> resources)
|
||||
{
|
||||
return resources.Select(ToModel).ToList();
|
||||
|
Reference in New Issue
Block a user