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

handle error response correctly

This commit is contained in:
Reinhard Pointner 2016-03-31 20:13:51 +00:00
parent 56900ad542
commit 869a571f2a

View File

@ -91,10 +91,14 @@ public class ShooterSubtitles implements VideoHashSubtitleService {
// use the first best option and ignore the rest
return getCache().castList(SubtitleDescriptor.class).computeIfAbsent(param.toString(), it -> {
ByteBuffer post = WebRequest.post(endpoint, param, null);
Object response = readJson(UTF_8.decode(post));
ByteBuffer bb = WebRequest.post(endpoint, param, null);
// error response
if (bb.remaining() == 1 && bb.get(0) == -1)
return emptyList();
String name = getNameWithoutExtension(file.getName());
Object response = readJson(UTF_8.decode(bb));
return streamJsonObjects(response).flatMap(n -> streamJsonObjects(n, "Files")).map(f -> {
String type = getString(f, "Ext");