* catch XML-RPC errors

This commit is contained in:
Reinhard Pointner 2015-11-04 04:08:57 +00:00
parent 41cd488bae
commit 66d0d401cf
2 changed files with 15 additions and 12 deletions

View File

@ -113,7 +113,7 @@ public final class SubtitleUtilities {
if (selection.isEmpty()) {
for (File f : files) {
try {
selection.addAll(service.guess(getName(f))); // !!! XML-RPC METHOD CURRENTLY BROKEN !!!
selection.addAll(service.guess(getName(f)));
} catch (Exception e) {
Logger.getLogger(SubtitleUtilities.class.getName()).log(Level.WARNING, String.format("Failed to identify file [%s]: %s", f.getName(), e.getMessage()));
}

View File

@ -94,18 +94,21 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
@Override
public List<SubtitleSearchResult> guess(String tag) throws Exception {
List<SubtitleSearchResult> subtitles = getCache().getSearchResult("guess", tag);
if (subtitles != null) {
return subtitles;
}
// !!! XML-RPC CURRENTLY METHOD BROKEN !!!
return emptyList();
// require login
login();
subtitles = xmlrpc.guessMovie(singleton(tag)).getOrDefault(tag, emptyList()); // XML-RPC METHOD BROKEN
getCache().putSearchResult("guess", tag, subtitles);
return subtitles;
// List<SubtitleSearchResult> subtitles = getCache().getSearchResult("guess", tag);
// if (subtitles != null) {
// return subtitles;
// }
//
// // require login
// login();
//
// subtitles = xmlrpc.guessMovie(singleton(tag)).getOrDefault(tag, emptyList());
//
// getCache().putSearchResult("guess", tag, subtitles);
// return subtitles;
}
@Override