* fix subtitles-not-found issue caused by the limit of 500. The limit should now be 2000 and effectively not ever be an issue again

This commit is contained in:
Reinhard Pointner 2014-01-28 09:39:22 +00:00
parent 5fadfbe3e3
commit 2ad88bd306
3 changed files with 11 additions and 2 deletions

View File

@ -108,7 +108,7 @@ public class OpenSubtitlesSubtitleDescriptor implements SubtitleDescriptor, Seri
try {
stream = new GZIPInputStream(stream);
} catch (ZipException e) {
throw new IOException(String.format("%s: anti-leech limit may have been reached", e.getMessage()));
throw new IOException(String.format("%s: anti-leech limit has been reached", e.getMessage()));
}
// fully download

View File

@ -96,7 +96,7 @@ public class OpenSubtitlesXmlRpc {
@SuppressWarnings("unchecked")
public List<OpenSubtitlesSubtitleDescriptor> searchSubtitles(Collection<Query> queryList) throws XmlRpcFault {
List<OpenSubtitlesSubtitleDescriptor> subtitles = new ArrayList<OpenSubtitlesSubtitleDescriptor>();
Map<?, ?> response = invoke("SearchSubtitles", token, queryList);
Map<?, ?> response = invoke("SearchSubtitles", token, queryList, singletonMap("limit", 2000));
try {
List<Map<String, String>> subtitleData = (List<Map<String, String>>) response.get("data");

View File

@ -177,6 +177,15 @@ public class OpenSubtitlesXmlRpcTest {
assertEquals(48717, data.remaining(), 0);
}
// @Test(expected = IOException.class)
public void fetchSubtitlesExceedLimit() throws Exception {
List<OpenSubtitlesSubtitleDescriptor> list = xmlrpc.searchSubtitles(773262, "eng");
for (int i = 0; true; i++) {
System.out.format("Fetch #%d: %s%n", i, list.get(i).fetch());
}
}
@AfterClass
public static void logout() throws Exception {
// logout manually