* refactored "hash lookup not supported" logic
This commit is contained in:
parent
9f4eb944e9
commit
e7d8e8bb05
@ -270,9 +270,14 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||||||
|
|
||||||
if (movieFiles.length > 0 && query == null) {
|
if (movieFiles.length > 0 && query == null) {
|
||||||
// match movie hashes online
|
// match movie hashes online
|
||||||
CLILogger.fine(format("Looking up movie by filehash via [%s]", service.getName()));
|
try {
|
||||||
movieByFileHash = service.getMovieDescriptors(movieFiles, locale);
|
CLILogger.fine(format("Looking up movie by filehash via [%s]", service.getName()));
|
||||||
Analytics.trackEvent(service.getName(), "HashLookup", "Movie", movieByFileHash.length - frequency(asList(movieByFileHash), null)); // number of positive hash lookups
|
movieByFileHash = service.getMovieDescriptors(movieFiles, locale);
|
||||||
|
Analytics.trackEvent(service.getName(), "HashLookup", "Movie", movieByFileHash.length - frequency(asList(movieByFileHash), null)); // number of positive hash lookups
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
CLILogger.fine(format("%s: Hash lookup not supported", service.getName()));
|
||||||
|
movieByFileHash = new Movie[movieFiles.length];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subtitleFiles.length > 0 && movieFiles.length == 0) {
|
if (subtitleFiles.length > 0 && movieFiles.length == 0) {
|
||||||
|
@ -65,8 +65,12 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||||||
|
|
||||||
if (movieFiles.length > 0) {
|
if (movieFiles.length > 0) {
|
||||||
// match movie hashes online
|
// match movie hashes online
|
||||||
movieByFileHash = service.getMovieDescriptors(movieFiles, locale);
|
try {
|
||||||
Analytics.trackEvent(service.getName(), "HashLookup", "Movie", movieByFileHash.length - frequency(asList(movieByFileHash), null)); // number of positive hash lookups
|
movieByFileHash = service.getMovieDescriptors(movieFiles, locale);
|
||||||
|
Analytics.trackEvent(service.getName(), "HashLookup", "Movie", movieByFileHash.length - frequency(asList(movieByFileHash), null)); // number of positive hash lookups
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
movieByFileHash = new Movie[movieFiles.length];
|
||||||
|
}
|
||||||
} else if (subtitleFiles.length > 0) {
|
} else if (subtitleFiles.length > 0) {
|
||||||
// special handling if there is only subtitle files
|
// special handling if there is only subtitle files
|
||||||
movieByFileHash = new Movie[subtitleFiles.length];
|
movieByFileHash = new Movie[subtitleFiles.length];
|
||||||
|
@ -203,7 +203,7 @@ public class IMDbClient extends AbstractEpisodeListProvider implements MovieIden
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Movie[] getMovieDescriptors(File[] movieFiles, Locale locale) throws Exception {
|
public Movie[] getMovieDescriptors(File[] movieFiles, Locale locale) throws Exception {
|
||||||
return new Movie[movieFiles.length]; // UNSUPPORTED OPERATION => EMPTY RESULT
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,7 @@ public class TMDbClient implements MovieIdentificationService {
|
|||||||
|
|
||||||
|
|
||||||
public List<Movie> searchMovie(File file, Locale locale) throws IOException, SAXException {
|
public List<Movie> searchMovie(File file, Locale locale) throws IOException, SAXException {
|
||||||
return emptyList(); // API BROKEN
|
throw new UnsupportedOperationException();
|
||||||
// return searchMovie(OpenSubtitlesHasher.computeHash(file), file.length(), locale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user