* catch XML-RPC errors

This commit is contained in:
Reinhard Pointner 2015-11-04 04:07:14 +00:00
parent be648102c6
commit 41cd488bae
3 changed files with 9 additions and 3 deletions

View File

@ -26,6 +26,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
import net.filebot.Language;
@ -110,7 +112,11 @@ public final class SubtitleUtilities {
// try OpenSubtitles guess function if we can't make sense of the files using local search
if (selection.isEmpty()) {
for (File f : files) {
selection.addAll(service.guess(getName(f)));
try {
selection.addAll(service.guess(getName(f))); // !!! XML-RPC METHOD CURRENTLY BROKEN !!!
} 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

@ -102,8 +102,7 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
// require login
login();
subtitles = xmlrpc.guessMovie(singleton(tag)).getOrDefault(tag, emptyList());
System.out.println(subtitles);
subtitles = xmlrpc.guessMovie(singleton(tag)).getOrDefault(tag, emptyList()); // XML-RPC METHOD BROKEN
getCache().putSearchResult("guess", tag, subtitles);
return subtitles;

View File

@ -233,6 +233,7 @@ public class OpenSubtitlesXmlRpc {
return subHashMap;
}
@Deprecated
public Map<String, List<SubtitleSearchResult>> guessMovie(Collection<String> tags) throws XmlRpcFault {
Map<String, List<SubtitleSearchResult>> results = new HashMap<String, List<SubtitleSearchResult>>();