* 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()) { if (selection.isEmpty()) {
for (File f : files) { for (File f : files) {
try { try {
selection.addAll(service.guess(getName(f))); // !!! XML-RPC METHOD CURRENTLY BROKEN !!! selection.addAll(service.guess(getName(f)));
} catch (Exception e) { } catch (Exception e) {
Logger.getLogger(SubtitleUtilities.class.getName()).log(Level.WARNING, String.format("Failed to identify file [%s]: %s", f.getName(), e.getMessage())); 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 @Override
public List<SubtitleSearchResult> guess(String tag) throws Exception { public List<SubtitleSearchResult> guess(String tag) throws Exception {
List<SubtitleSearchResult> subtitles = getCache().getSearchResult("guess", tag); // !!! XML-RPC CURRENTLY METHOD BROKEN !!!
if (subtitles != null) { return emptyList();
return subtitles;
}
// require login // List<SubtitleSearchResult> subtitles = getCache().getSearchResult("guess", tag);
login(); // if (subtitles != null) {
// return subtitles;
subtitles = xmlrpc.guessMovie(singleton(tag)).getOrDefault(tag, emptyList()); // XML-RPC METHOD BROKEN // }
//
getCache().putSearchResult("guess", tag, subtitles); // // require login
return subtitles; // login();
//
// subtitles = xmlrpc.guessMovie(singleton(tag)).getOrDefault(tag, emptyList());
//
// getCache().putSearchResult("guess", tag, subtitles);
// return subtitles;
} }
@Override @Override