From 963fb62172be47be8015a29671de4da32b260bef Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 27 Mar 2016 22:35:19 +0000 Subject: [PATCH] Remove @Depricated "Movie Search By Hash" interface. OpenSubtitles is not used as a Movie datasource anymore, and TMDb doesn't do hashes anymore. --- source/net/filebot/cli/CmdlineOperations.java | 12 ------------ source/net/filebot/media/MediaDetection.java | 13 ------------- source/net/filebot/ui/rename/MovieHashMatcher.java | 10 +--------- .../net/filebot/web/MovieIdentificationService.java | 9 ++------- source/net/filebot/web/OMDbClient.java | 7 ------- source/net/filebot/web/OpenSubtitlesClient.java | 1 - source/net/filebot/web/TMDbClient.java | 7 ------- 7 files changed, 3 insertions(+), 56 deletions(-) diff --git a/source/net/filebot/cli/CmdlineOperations.java b/source/net/filebot/cli/CmdlineOperations.java index 6b344214..ba9c788a 100644 --- a/source/net/filebot/cli/CmdlineOperations.java +++ b/source/net/filebot/cli/CmdlineOperations.java @@ -342,18 +342,6 @@ public class CmdlineOperations implements CmdlineInterface { // match movie hashes online final Map movieByFile = new TreeMap(); if (query == null) { - if (movieFiles.size() > 0) { - try { - Map hashLookup = service.getMovieDescriptors(movieFiles, locale); - if (hashLookup.size() > 0) { - log.finest(format("Looking up up movie by hash via [%s]", service.getName())); - movieByFile.putAll(hashLookup); - } - } catch (UnsupportedOperationException e) { - // ignore logging => hash lookup only supported by OpenSubtitles - } - } - // collect useful nfo files even if they are not part of the selected fileset Set effectiveNfoFileSet = new TreeSet(nfoFiles); for (File dir : mapByFolder(movieFiles).keySet()) { diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index 89278c9a..17e0b860 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -580,19 +580,6 @@ public class MediaDetection { options.add((Movie) metaObject); } - // lookup by file hash - if (service != null && movieFile.isFile()) { - try { - for (Movie movie : service.getMovieDescriptors(singleton(movieFile), locale).values()) { - if (movie != null) { - options.add(movie); - } - } - } catch (UnsupportedOperationException e) { - // ignore logging => hash lookup only supported by OpenSubtitles - } - } - // lookup by id from nfo file if (service != null) { for (int imdbid : grepImdbId(movieFile.getPath())) { diff --git a/source/net/filebot/ui/rename/MovieHashMatcher.java b/source/net/filebot/ui/rename/MovieHashMatcher.java index ca179f4f..dd7f01a4 100644 --- a/source/net/filebot/ui/rename/MovieHashMatcher.java +++ b/source/net/filebot/ui/rename/MovieHashMatcher.java @@ -94,15 +94,7 @@ class MovieHashMatcher implements AutoCompleteMatcher { } // match movie hashes online - final Map movieByFile = new TreeMap(); - if (autodetect && movieFiles.size() > 0) { - try { - Map hashLookup = service.getMovieDescriptors(movieFiles, locale); - movieByFile.putAll(hashLookup); - } catch (UnsupportedOperationException e) { - // ignore - } - } + Map movieByFile = new TreeMap(); // collect useful nfo files even if they are not part of the selected fileset Set effectiveNfoFileSet = new TreeSet(nfoFiles); diff --git a/source/net/filebot/web/MovieIdentificationService.java b/source/net/filebot/web/MovieIdentificationService.java index 81fcfe7b..3439e4c7 100644 --- a/source/net/filebot/web/MovieIdentificationService.java +++ b/source/net/filebot/web/MovieIdentificationService.java @@ -1,17 +1,12 @@ package net.filebot.web; -import java.io.File; -import java.util.Collection; import java.util.List; import java.util.Locale; -import java.util.Map; public interface MovieIdentificationService extends Datasource { - public List searchMovie(String query, Locale locale) throws Exception; + List searchMovie(String query, Locale locale) throws Exception; - public Movie getMovieDescriptor(Movie movie, Locale locale) throws Exception; - - public Map getMovieDescriptors(Collection movieFiles, Locale locale) throws Exception; + Movie getMovieDescriptor(Movie movie, Locale locale) throws Exception; } diff --git a/source/net/filebot/web/OMDbClient.java b/source/net/filebot/web/OMDbClient.java index 5abfc73d..7ec159a2 100644 --- a/source/net/filebot/web/OMDbClient.java +++ b/source/net/filebot/web/OMDbClient.java @@ -8,14 +8,12 @@ import static net.filebot.util.JsonUtilities.*; import static net.filebot.util.StringUtilities.*; import static net.filebot.web.WebRequest.*; -import java.io.File; import java.net.URL; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; import java.util.ArrayList; -import java.util.Collection; import java.util.EnumMap; import java.util.LinkedHashMap; import java.util.List; @@ -129,11 +127,6 @@ public class OMDbClient implements MovieIdentificationService { } } - @Override - public Map getMovieDescriptors(Collection movieFiles, Locale locale) throws Exception { - throw new UnsupportedOperationException(); - } - public Object request(Map parameters) throws Exception { Cache cache = Cache.getCache(getName(), CacheType.Weekly); String key = '?' + encodeParameters(parameters, true); diff --git a/source/net/filebot/web/OpenSubtitlesClient.java b/source/net/filebot/web/OpenSubtitlesClient.java index 812b470d..23d99162 100644 --- a/source/net/filebot/web/OpenSubtitlesClient.java +++ b/source/net/filebot/web/OpenSubtitlesClient.java @@ -335,7 +335,6 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS return getMovieDescriptors(singleton(movieFile), locale).get(movieFile); } - @Override public synchronized Map getMovieDescriptors(Collection movieFiles, Locale locale) throws Exception { // create result array Map results = new HashMap(); diff --git a/source/net/filebot/web/TMDbClient.java b/source/net/filebot/web/TMDbClient.java index 2e5b85d9..7a466a68 100644 --- a/source/net/filebot/web/TMDbClient.java +++ b/source/net/filebot/web/TMDbClient.java @@ -9,13 +9,11 @@ import static net.filebot.util.JsonUtilities.*; import static net.filebot.util.StringUtilities.*; import static net.filebot.web.WebRequest.*; -import java.io.File; import java.io.FileNotFoundException; import java.io.Serializable; import java.net.URI; import java.net.URL; import java.util.ArrayList; -import java.util.Collection; import java.util.EnumMap; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -158,11 +156,6 @@ public class TMDbClient implements MovieIdentificationService { return null; } - @Override - public Map getMovieDescriptors(Collection movieFiles, Locale locale) throws Exception { - throw new UnsupportedOperationException(); - } - public MovieInfo getMovieInfo(Movie movie, Locale locale, boolean extendedInfo) throws Exception { try { if (movie.getTmdbId() > 0) {