mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-20 18:02:44 +01:00
New: Add isExisting
flag for movies in collections API
This commit is contained in:
parent
e8e1841e6c
commit
1fc6e88bc4
@ -66,6 +66,7 @@ protected override CollectionResource GetResourceById(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[Produces("application/json")]
|
||||||
public List<CollectionResource> GetCollections(int? tmdbId)
|
public List<CollectionResource> GetCollections(int? tmdbId)
|
||||||
{
|
{
|
||||||
var collectionResources = new List<CollectionResource>();
|
var collectionResources = new List<CollectionResource>();
|
||||||
@ -181,10 +182,13 @@ private IEnumerable<CollectionResource> MapToResource(List<MovieCollection> coll
|
|||||||
var movieResource = movie.ToResource(translation);
|
var movieResource = movie.ToResource(translation);
|
||||||
movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie }, namingConfig);
|
movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie }, namingConfig);
|
||||||
|
|
||||||
|
var isExisting = existingMoviesTmdbIds.Contains(movie.TmdbId);
|
||||||
|
movieResource.IsExisting = isExisting;
|
||||||
|
|
||||||
var isExcluded = listExclusions.Any(e => e.TmdbId == movie.TmdbId);
|
var isExcluded = listExclusions.Any(e => e.TmdbId == movie.TmdbId);
|
||||||
movieResource.IsExcluded = isExcluded;
|
movieResource.IsExcluded = isExcluded;
|
||||||
|
|
||||||
if (!existingMoviesTmdbIds.Contains(movie.TmdbId) && !isExcluded)
|
if (!isExisting && !isExcluded)
|
||||||
{
|
{
|
||||||
resource.MissingMovies++;
|
resource.MissingMovies++;
|
||||||
}
|
}
|
||||||
@ -215,10 +219,13 @@ private CollectionResource MapToResource(MovieCollection collection)
|
|||||||
var movieResource = movie.ToResource(translation);
|
var movieResource = movie.ToResource(translation);
|
||||||
movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie }, namingConfig);
|
movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie }, namingConfig);
|
||||||
|
|
||||||
|
var isExisting = existingMoviesTmdbIds.Contains(movie.TmdbId);
|
||||||
|
movieResource.IsExisting = isExisting;
|
||||||
|
|
||||||
var isExcluded = listExclusions.Any(e => e.TmdbId == movie.TmdbId);
|
var isExcluded = listExclusions.Any(e => e.TmdbId == movie.TmdbId);
|
||||||
movieResource.IsExcluded = isExcluded;
|
movieResource.IsExcluded = isExcluded;
|
||||||
|
|
||||||
if (!existingMoviesTmdbIds.Contains(movie.TmdbId) && !isExcluded)
|
if (!isExisting && !isExcluded)
|
||||||
{
|
{
|
||||||
resource.MissingMovies++;
|
resource.MissingMovies++;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class CollectionMovieResource
|
|||||||
public Ratings Ratings { get; set; }
|
public Ratings Ratings { get; set; }
|
||||||
public List<string> Genres { get; set; }
|
public List<string> Genres { get; set; }
|
||||||
public string Folder { get; set; }
|
public string Folder { get; set; }
|
||||||
|
public bool IsExisting { get; set; }
|
||||||
public bool IsExcluded { get; set; }
|
public bool IsExcluded { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user