1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-16 22:35:04 -05:00

* 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.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream; import java.util.stream.Stream;
import net.filebot.Language; 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 // try OpenSubtitles guess function if we can't make sense of the files using local search
if (selection.isEmpty()) { if (selection.isEmpty()) {
for (File f : files) { 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 // require login
login(); login();
subtitles = xmlrpc.guessMovie(singleton(tag)).getOrDefault(tag, emptyList()); subtitles = xmlrpc.guessMovie(singleton(tag)).getOrDefault(tag, emptyList()); // XML-RPC METHOD BROKEN
System.out.println(subtitles);
getCache().putSearchResult("guess", tag, subtitles); getCache().putSearchResult("guess", tag, subtitles);
return subtitles; return subtitles;

View File

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