* remove unused hash-lookup related code
This commit is contained in:
parent
0efdffabbe
commit
58b5c74a6c
|
@ -431,7 +431,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
// unknown hash, try via imdb id from nfo file
|
// unknown hash, try via imdb id from nfo file
|
||||||
if (movie == null) {
|
if (movie == null) {
|
||||||
CLILogger.fine(format("Auto-detect movie from context: [%s]", file));
|
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
|
// apply filter if defined
|
||||||
options = applyExpressionFilter(options, filter);
|
options = applyExpressionFilter(options, filter);
|
||||||
|
|
|
@ -243,7 +243,7 @@ public abstract class ScriptShellBaseClass extends Script {
|
||||||
|
|
||||||
// 3. run full-fledged movie detection
|
// 3. run full-fledged movie detection
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
// ignore and fail
|
// ignore and fail
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,7 +554,7 @@ public class MediaDetection {
|
||||||
return seriesList;
|
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>();
|
List<Movie> options = new ArrayList<Movie>();
|
||||||
|
|
||||||
// try xattr metadata if enabled
|
// try xattr metadata if enabled
|
||||||
|
@ -564,22 +564,22 @@ public class MediaDetection {
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookup by file hash
|
// lookup by file hash
|
||||||
if (hashLookupService != null && movieFile.isFile()) {
|
if (service != null && movieFile.isFile()) {
|
||||||
try {
|
try {
|
||||||
for (Movie movie : hashLookupService.getMovieDescriptors(singleton(movieFile), locale).values()) {
|
for (Movie movie : service.getMovieDescriptors(singleton(movieFile), locale).values()) {
|
||||||
if (movie != null) {
|
if (movie != null) {
|
||||||
options.add(movie);
|
options.add(movie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (UnsupportedOperationException e) {
|
||||||
Logger.getLogger(MediaDetection.class.getName()).log(Level.WARNING, hashLookupService.getName() + ": " + e.getMessage());
|
// ignore logging => hash lookup only supported by OpenSubtitles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookup by id from nfo file
|
// lookup by id from nfo file
|
||||||
if (queryLookupService != null) {
|
if (service != null) {
|
||||||
for (int imdbid : grepImdbId(movieFile.getPath())) {
|
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) {
|
if (movie != null) {
|
||||||
options.add(movie);
|
options.add(movie);
|
||||||
}
|
}
|
||||||
|
@ -587,7 +587,7 @@ public class MediaDetection {
|
||||||
|
|
||||||
// try to grep imdb id from nfo files
|
// try to grep imdb id from nfo files
|
||||||
for (int imdbid : grepImdbIdFor(movieFile)) {
|
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) {
|
if (movie != null) {
|
||||||
options.add(movie);
|
options.add(movie);
|
||||||
}
|
}
|
||||||
|
@ -645,8 +645,8 @@ public class MediaDetection {
|
||||||
}
|
}
|
||||||
|
|
||||||
// query by file / folder name
|
// query by file / folder name
|
||||||
if (queryLookupService != null) {
|
if (service != null) {
|
||||||
List<Movie> results = queryMovieByFileName(terms, queryLookupService, locale);
|
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)
|
// 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) {
|
if (results.isEmpty() && !strict) {
|
||||||
|
@ -662,7 +662,7 @@ public class MediaDetection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastResortQueryList.size() > 0) {
|
if (lastResortQueryList.size() > 0) {
|
||||||
results = queryMovieByFileName(lastResortQueryList, queryLookupService, locale);
|
results = queryMovieByFileName(lastResortQueryList, service, locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ public final class SubtitleUtilities {
|
||||||
|
|
||||||
// might be a movie, auto-detect movie names
|
// might be a movie, auto-detect movie names
|
||||||
if (!isEpisode(f.getPath(), true)) {
|
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());
|
queries.add(it.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||||
if (year.size() > 0 && parseEpisodeNumber(f, true) == null) {
|
if (year.size() > 0 && parseEpisodeNumber(f, true) == null) {
|
||||||
// allow only movie matches where the the movie year matches the year pattern in the filename
|
// allow only movie matches where the the movie year matches the year pattern in the filename
|
||||||
List<Movie> matches = new ArrayList<Movie>();
|
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())) {
|
if (year.contains(movie.getYear())) {
|
||||||
matches.add(movie);
|
matches.add(movie);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// in non-strict mode just allow all options
|
// 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;
|
return detection;
|
||||||
|
@ -477,7 +477,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||||
|
|
||||||
List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>();
|
List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>();
|
||||||
if (input != null && input.length() > 0) {
|
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) {
|
for (Movie it : results) {
|
||||||
// make sure to retrieve language-specific movie descriptor
|
// make sure to retrieve language-specific movie descriptor
|
||||||
matches.add(new Match<File, Movie>(null, service.getMovieDescriptor(it, locale)));
|
matches.add(new Match<File, Movie>(null, service.getMovieDescriptor(it, locale)));
|
||||||
|
|
|
@ -698,7 +698,7 @@ public class SubtitleUploadDialog extends JDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
for (Movie it : identity) {
|
||||||
if (it.getImdbId() <= 0 && it.getTmdbId() > 0) {
|
if (it.getImdbId() <= 0 && it.getTmdbId() > 0) {
|
||||||
it = WebServices.TheMovieDB.getMovieDescriptor(it, Locale.ENGLISH);
|
it = WebServices.TheMovieDB.getMovieDescriptor(it, Locale.ENGLISH);
|
||||||
|
|
Loading…
Reference in New Issue