1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* submit only 1 query per request to workaround OpenSubtitles API issues

@see http://forum.opensubtitles.org/viewtopic.php?f=8&t=14704
This commit is contained in:
Reinhard Pointner 2014-04-30 04:38:50 +00:00
parent d18045a383
commit 1329f490b2

View File

@ -157,6 +157,9 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
return results;
}
// max numbers of queries to submit in a single XML-RPC request
private final int batchSize = 1;
public Map<File, List<SubtitleDescriptor>> getSubtitleListByHash(File[] files, String languageName) throws Exception {
// singleton array with or empty array
String[] languageFilter = languageName != null ? new String[] { getSubLanguageID(languageName) } : new String[0];
@ -195,7 +198,6 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
login();
// dispatch query for all hashes
int batchSize = 50;
for (int bn = 0; bn < ceil((float) hashQueryList.size() / batchSize); bn++) {
List<Query> batch = hashQueryList.subList(bn * batchSize, min((bn * batchSize) + batchSize, hashQueryList.size()));
@ -257,7 +259,6 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
login();
// dispatch query for all hashes
int batchSize = 50;
for (int bn = 0; bn < ceil((float) tagQueryList.size() / batchSize); bn++) {
List<Query> batch = tagQueryList.subList(bn * batchSize, min((bn * batchSize) + batchSize, tagQueryList.size()));