* 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) {
|
||||
// match movie hashes online
|
||||
CLILogger.fine(format("Looking up movie by filehash via [%s]", service.getName()));
|
||||
movieByFileHash = service.getMovieDescriptors(movieFiles, locale);
|
||||
Analytics.trackEvent(service.getName(), "HashLookup", "Movie", movieByFileHash.length - frequency(asList(movieByFileHash), null)); // number of positive hash lookups
|
||||
try {
|
||||
CLILogger.fine(format("Looking up movie by filehash via [%s]", service.getName()));
|
||||
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) {
|
||||
|
|
|
@ -65,8 +65,12 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||
|
||||
if (movieFiles.length > 0) {
|
||||
// match movie hashes online
|
||||
movieByFileHash = service.getMovieDescriptors(movieFiles, locale);
|
||||
Analytics.trackEvent(service.getName(), "HashLookup", "Movie", movieByFileHash.length - frequency(asList(movieByFileHash), null)); // number of positive hash lookups
|
||||
try {
|
||||
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) {
|
||||
// special handling if there is only subtitle files
|
||||
movieByFileHash = new Movie[subtitleFiles.length];
|
||||
|
|
|
@ -203,7 +203,7 @@ public class IMDbClient extends AbstractEpisodeListProvider implements MovieIden
|
|||
|
||||
@Override
|
||||
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 {
|
||||
return emptyList(); // API BROKEN
|
||||
// return searchMovie(OpenSubtitlesHasher.computeHash(file), file.length(), locale);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue