mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 08:19:38 +02:00
Fixed: Prevent excluded movies from being added by collections
This commit is contained in:
parent
e89b98d0f6
commit
b6920cfe82
@ -3,12 +3,11 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Instrumentation.Extensions;
|
using NzbDrone.Common.Instrumentation.Extensions;
|
||||||
using NzbDrone.Core.Exceptions;
|
using NzbDrone.Core.Exceptions;
|
||||||
|
using NzbDrone.Core.ImportLists.ImportExclusions;
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
|
||||||
using NzbDrone.Core.MetadataSource;
|
using NzbDrone.Core.MetadataSource;
|
||||||
using NzbDrone.Core.Movies.Collections;
|
using NzbDrone.Core.Movies.Collections;
|
||||||
using NzbDrone.Core.Movies.Commands;
|
using NzbDrone.Core.Movies.Commands;
|
||||||
using NzbDrone.Core.Movies.Events;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Movies
|
namespace NzbDrone.Core.Movies
|
||||||
{
|
{
|
||||||
@ -19,6 +18,7 @@ public class RefreshCollectionService : IExecute<RefreshCollectionsCommand>
|
|||||||
private readonly IMovieService _movieService;
|
private readonly IMovieService _movieService;
|
||||||
private readonly IMovieMetadataService _movieMetadataService;
|
private readonly IMovieMetadataService _movieMetadataService;
|
||||||
private readonly IAddMovieService _addMovieService;
|
private readonly IAddMovieService _addMovieService;
|
||||||
|
private readonly IImportExclusionsService _importExclusionService;
|
||||||
|
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ public RefreshCollectionService(IProvideMovieInfo movieInfo,
|
|||||||
IMovieService movieService,
|
IMovieService movieService,
|
||||||
IMovieMetadataService movieMetadataService,
|
IMovieMetadataService movieMetadataService,
|
||||||
IAddMovieService addMovieService,
|
IAddMovieService addMovieService,
|
||||||
|
IImportExclusionsService importExclusionsService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
{
|
{
|
||||||
_movieInfo = movieInfo;
|
_movieInfo = movieInfo;
|
||||||
@ -34,6 +35,7 @@ public RefreshCollectionService(IProvideMovieInfo movieInfo,
|
|||||||
_movieService = movieService;
|
_movieService = movieService;
|
||||||
_movieMetadataService = movieMetadataService;
|
_movieMetadataService = movieMetadataService;
|
||||||
_addMovieService = addMovieService;
|
_addMovieService = addMovieService;
|
||||||
|
_importExclusionService = importExclusionsService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +101,8 @@ private void SyncCollectionMovies(MovieCollection collection)
|
|||||||
{
|
{
|
||||||
var existingMovies = _movieService.AllMovieTmdbIds();
|
var existingMovies = _movieService.AllMovieTmdbIds();
|
||||||
var collectionMovies = _movieMetadataService.GetMoviesByCollectionTmdbId(collection.TmdbId);
|
var collectionMovies = _movieMetadataService.GetMoviesByCollectionTmdbId(collection.TmdbId);
|
||||||
var moviesToAdd = collectionMovies.Where(m => !existingMovies.Contains(m.TmdbId));
|
var excludedMovies = _importExclusionService.GetAllExclusions().Select(e => e.TmdbId);
|
||||||
|
var moviesToAdd = collectionMovies.Where(m => !existingMovies.Contains(m.TmdbId)).Where(m => !excludedMovies.Contains(m.TmdbId));
|
||||||
|
|
||||||
if (moviesToAdd.Any())
|
if (moviesToAdd.Any())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user