From 3ed3f92b48eb8e9881828ae0afb5255b338a82f4 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 9 Aug 2016 16:08:18 +0800 Subject: [PATCH] Make sure that OMDb xattr movie data (with imdbid but without tmdbid) doesn't get accepted when processing files with TMDb. @see https://www.filebot.net/forums/viewtopic.php?f=6&t=4038#p22634 --- source/net/filebot/media/MediaDetection.java | 15 +++++++-------- source/net/filebot/ui/rename/MovieMatcher.java | 10 ++++++++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index 77f9de27..86b6310f 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -699,16 +699,15 @@ public class MediaDetection { } public static Movie getLocalizedMovie(MovieIdentificationService service, Movie movie, Locale locale) throws Exception { - // retrieve language-specific movie object if possible - try { - Movie localized = service.getMovieDescriptor(movie, locale); - if (localized != null) { - return localized; + // retrieve language and service specific movie object + if (movie != null) { + try { + return service.getMovieDescriptor(movie, locale); + } catch (Exception e) { + debug.log(Level.WARNING, "Failed to retrieve localized movie data", e); } - } catch (Exception e) { - debug.log(Level.WARNING, "Failed to retrieve localized movie data", e); } - return movie; + return null; } public static SimilarityMetric getSeriesMatchMetric() { diff --git a/source/net/filebot/ui/rename/MovieMatcher.java b/source/net/filebot/ui/rename/MovieMatcher.java index cc280aac..3450cf11 100644 --- a/source/net/filebot/ui/rename/MovieMatcher.java +++ b/source/net/filebot/ui/rename/MovieMatcher.java @@ -183,8 +183,10 @@ class MovieMatcher implements AutoCompleteMatcher { Movie movie = grabMovieName(file, options, strict, locale, autodetect, parent); // make sure to use language-specific movie object if possible + movie = getLocalizedMovie(service, movie, locale); + if (movie != null) { - movieByFile.put(file, getLocalizedMovie(service, movie, locale)); + movieByFile.put(file, movie); } } } @@ -415,7 +417,11 @@ class MovieMatcher implements AutoCompleteMatcher { if (input != null && input.length() > 0) { for (Movie movie : detectMovie(new File(input), service, locale, false)) { // make sure to use language-specific movie object if possible - matches.add(new Match(null, getLocalizedMovie(service, movie, locale))); + movie = getLocalizedMovie(service, movie, locale); + + if (movie != null) { + matches.add(new Match(null, movie)); + } } } return matches;