1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 00:38:52 -05:00

* remove unused hash-lookup related code

This commit is contained in:
Reinhard Pointner 2015-01-10 20:52:10 +00:00
parent 0efdffabbe
commit 58b5c74a6c
6 changed files with 18 additions and 18 deletions

View File

@ -431,7 +431,7 @@ public class CmdlineOperations implements CmdlineInterface {
// unknown hash, try via imdb id from nfo file
if (movie == null) {
CLILogger.fine(format("Auto-detect movie from context: [%s]", file));
Collection<Movie> options = detectMovie(file, null, service, locale, strict);
Collection<Movie> options = detectMovie(file, service, locale, strict);
// apply filter if defined
options = applyExpressionFilter(options, filter);

View File

@ -243,7 +243,7 @@ public abstract class ScriptShellBaseClass extends Script {
// 3. run full-fledged movie detection
try {
return MediaDetection.detectMovie(file, null, WebServices.TheMovieDB, Locale.ENGLISH, strict).get(0);
return MediaDetection.detectMovie(file, WebServices.TheMovieDB, Locale.ENGLISH, strict).get(0);
} catch (Exception e) {
// ignore and fail
}

View File

@ -554,7 +554,7 @@ public class MediaDetection {
return seriesList;
}
public static List<Movie> detectMovie(File movieFile, MovieIdentificationService hashLookupService, MovieIdentificationService queryLookupService, Locale locale, boolean strict) throws Exception {
public static List<Movie> detectMovie(File movieFile, MovieIdentificationService service, Locale locale, boolean strict) throws Exception {
List<Movie> options = new ArrayList<Movie>();
// try xattr metadata if enabled
@ -564,22 +564,22 @@ public class MediaDetection {
}
// lookup by file hash
if (hashLookupService != null && movieFile.isFile()) {
if (service != null && movieFile.isFile()) {
try {
for (Movie movie : hashLookupService.getMovieDescriptors(singleton(movieFile), locale).values()) {
for (Movie movie : service.getMovieDescriptors(singleton(movieFile), locale).values()) {
if (movie != null) {
options.add(movie);
}
}
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getName()).log(Level.WARNING, hashLookupService.getName() + ": " + e.getMessage());
} catch (UnsupportedOperationException e) {
// ignore logging => hash lookup only supported by OpenSubtitles
}
}
// lookup by id from nfo file
if (queryLookupService != null) {
if (service != null) {
for (int imdbid : grepImdbId(movieFile.getPath())) {
Movie movie = queryLookupService.getMovieDescriptor(new Movie(null, 0, imdbid, -1), locale);
Movie movie = service.getMovieDescriptor(new Movie(null, 0, imdbid, -1), locale);
if (movie != null) {
options.add(movie);
}
@ -587,7 +587,7 @@ public class MediaDetection {
// try to grep imdb id from nfo files
for (int imdbid : grepImdbIdFor(movieFile)) {
Movie movie = queryLookupService.getMovieDescriptor(new Movie(null, 0, imdbid, -1), locale);
Movie movie = service.getMovieDescriptor(new Movie(null, 0, imdbid, -1), locale);
if (movie != null) {
options.add(movie);
}
@ -645,8 +645,8 @@ public class MediaDetection {
}
// query by file / folder name
if (queryLookupService != null) {
List<Movie> results = queryMovieByFileName(terms, queryLookupService, locale);
if (service != null) {
List<Movie> results = queryMovieByFileName(terms, service, locale);
// try query without year as it sometimes messes up results if years don't match properly (movie release years vs dvd release year, etc)
if (results.isEmpty() && !strict) {
@ -662,7 +662,7 @@ public class MediaDetection {
}
}
if (lastResortQueryList.size() > 0) {
results = queryMovieByFileName(lastResortQueryList, queryLookupService, locale);
results = queryMovieByFileName(lastResortQueryList, service, locale);
}
}

View File

@ -86,7 +86,7 @@ public final class SubtitleUtilities {
// might be a movie, auto-detect movie names
if (!isEpisode(f.getPath(), true)) {
for (Movie it : detectMovie(f, null, null, Locale.ENGLISH, strict)) {
for (Movie it : detectMovie(f, null, Locale.ENGLISH, strict)) {
queries.add(it.getName());
}
}

View File

@ -187,7 +187,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
if (year.size() > 0 && parseEpisodeNumber(f, true) == null) {
// allow only movie matches where the the movie year matches the year pattern in the filename
List<Movie> matches = new ArrayList<Movie>();
for (Movie movie : detectMovie(f, null, service, locale, strict)) {
for (Movie movie : detectMovie(f, service, locale, strict)) {
if (year.contains(movie.getYear())) {
matches.add(movie);
}
@ -196,7 +196,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
}
} else {
// in non-strict mode just allow all options
detection.put(f, detectMovie(f, null, service, locale, strict));
detection.put(f, detectMovie(f, service, locale, strict));
}
}
return detection;
@ -477,7 +477,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>();
if (input != null && input.length() > 0) {
List<Movie> results = detectMovie(new File(input), null, service, locale, false);
List<Movie> results = detectMovie(new File(input), service, locale, false);
for (Movie it : results) {
// make sure to retrieve language-specific movie descriptor
matches.add(new Match<File, Movie>(null, service.getMovieDescriptor(it, locale)));

View File

@ -698,7 +698,7 @@ public class SubtitleUploadDialog extends JDialog {
}
}
} else {
Collection<Movie> identity = MediaDetection.detectMovie(mapping.getVideo(), database, database, Locale.ENGLISH, true);
Collection<Movie> identity = MediaDetection.detectMovie(mapping.getVideo(), database, Locale.ENGLISH, true);
for (Movie it : identity) {
if (it.getImdbId() <= 0 && it.getTmdbId() > 0) {
it = WebServices.TheMovieDB.getMovieDescriptor(it, Locale.ENGLISH);