1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-21 22:05:43 -04:00

Completely overhauled how import exclusions work.

Currently new exclusions can only be added when adding new movies or deleting old ones. Not manually in the settings menu.
Movies can now be hidden in the new discover feature by using the new import exclusions!
This commit is contained in:
Leonardo Galli
2017-05-09 20:44:07 +02:00
parent ab28bfead2
commit fc1585e900
28 changed files with 478 additions and 110 deletions
@@ -16,6 +16,7 @@ using System.Threading;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Profiles;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.NetImport.ImportExclusions;
namespace NzbDrone.Core.MetadataSource.SkyHook
{
@@ -29,8 +30,10 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
private readonly ITmdbConfigService _configService;
private readonly IMovieService _movieService;
private readonly IPreDBService _predbService;
private readonly IImportExclusionsService _exclusionService;
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ITmdbConfigService configService, IMovieService movieService, IPreDBService predbService, Logger logger)
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ITmdbConfigService configService, IMovieService movieService,
IPreDBService predbService, IImportExclusionsService exclusionService, Logger logger)
{
_httpClient = httpClient;
_requestBuilder = requestBuilder.SkyHookTvdb;
@@ -38,6 +41,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
_configService = configService;
_movieService = movieService;
_predbService = predbService;
_exclusionService = exclusionService;
_logger = logger;
}
@@ -351,7 +355,10 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
public List<Movie> DiscoverNewMovies(string action)
{
string allIds = string.Join(",", _movieService.GetAllMovies().Select(m => m.TmdbId));
var allMovies = _movieService.GetAllMovies();
var allExclusions = _exclusionService.GetAllExclusions();
string allIds = string.Join(",", allMovies.Select(m => m.TmdbId));
string ignoredIds = string.Join(",", allExclusions.Select(ex => ex.TmdbId));
HttpRequest request;
List<MovieResult> results;
@@ -387,7 +394,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
request.AllowAutoRedirect = true;
request.Method = HttpMethod.POST;
request.Headers.ContentType = "application/x-www-form-urlencoded";
request.SetContent($"tmdbids={allIds}");
request.SetContent($"tmdbids={allIds}&ignoredIds={ignoredIds}");
var response = _httpClient.Post<List<MovieResult>>(request);
@@ -399,6 +406,8 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
results = response.Resource;
}
results = results.Where(m => allMovies.None(mo => mo.TmdbId == m.id) && allExclusions.None(ex => ex.TmdbId == m.id)).ToList();
return results.SelectList(MapMovie);
}