always check exclusions with tmdbid

pull/1016/head
geogolem 8 years ago
parent f49d68ad6a
commit 3f2da1441f

@ -25,11 +25,13 @@ namespace NzbDrone.Core.NetImport
private readonly ISearchForNewMovie _movieSearch; private readonly ISearchForNewMovie _movieSearch;
private readonly IRootFolderService _rootFolder; private readonly IRootFolderService _rootFolder;
private readonly IConfigService _configService; private readonly IConfigService _configService;
private readonly IProvideMovieInfo _movieInfo;
public NetImportSearchService(INetImportFactory netImportFactory, IMovieService movieService, public NetImportSearchService(INetImportFactory netImportFactory, IMovieService movieService,
ISearchForNewMovie movieSearch, IRootFolderService rootFolder, IConfigService configService, Logger logger) ISearchForNewMovie movieSearch, IRootFolderService rootFolder, IConfigService configService, IProvideMovieInfo movieInfo, Logger logger)
{ {
_movieInfo = movieInfo;
_netImportFactory = netImportFactory; _netImportFactory = netImportFactory;
_movieService = movieService; _movieService = movieService;
_movieSearch = movieSearch; _movieSearch = movieSearch;
@ -142,25 +144,37 @@ namespace NzbDrone.Core.NetImport
foreach (var movie in movies) foreach (var movie in movies)
{ {
bool shouldAdd = true; bool shouldAdd = true;
var mapped = _movieSearch.MapMovieToTmdbMovie(movie);
if (mapped != null)
{
if (importExclusions != null) if (importExclusions != null)
{ {
foreach (var exclusion in importExclusions) foreach (var exclusion in importExclusions)
{ {
if (exclusion == movie.ImdbId || exclusion == movie.TmdbId.ToString()) int tmdbId;
if (exclusion.StartsWith("tt"))
{ {
_logger.Info("Movie: {0} was found but will not be added because {1} was found on your exclusion list",movie, exclusion); var result = _movieInfo.GetMovieInfo(exclusion);
tmdbId = result.TmdbId;
}
else
{
tmdbId = Int32.Parse(exclusion);
}
if (tmdbId == movie.TmdbId)
{
_logger.Info("Movie: {0} was found but will not be added because {1} was found on your exclusion list", movie, exclusion);
shouldAdd = false; shouldAdd = false;
break; break;
} }
} }
} }
if (shouldAdd)
var mapped = _movieSearch.MapMovieToTmdbMovie(movie);
if ((mapped != null) && shouldAdd)
{ {
_movieService.AddMovie(mapped); _movieService.AddMovie(mapped);
} }
} }
} }
} }
}
} }

Loading…
Cancel
Save