mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-25 09:18:51 -05:00
handle error response correctly
This commit is contained in:
parent
56900ad542
commit
869a571f2a
@ -91,10 +91,14 @@ public class ShooterSubtitles implements VideoHashSubtitleService {
|
|||||||
|
|
||||||
// use the first best option and ignore the rest
|
// use the first best option and ignore the rest
|
||||||
return getCache().castList(SubtitleDescriptor.class).computeIfAbsent(param.toString(), it -> {
|
return getCache().castList(SubtitleDescriptor.class).computeIfAbsent(param.toString(), it -> {
|
||||||
ByteBuffer post = WebRequest.post(endpoint, param, null);
|
ByteBuffer bb = WebRequest.post(endpoint, param, null);
|
||||||
Object response = readJson(UTF_8.decode(post));
|
|
||||||
|
// error response
|
||||||
|
if (bb.remaining() == 1 && bb.get(0) == -1)
|
||||||
|
return emptyList();
|
||||||
|
|
||||||
String name = getNameWithoutExtension(file.getName());
|
String name = getNameWithoutExtension(file.getName());
|
||||||
|
Object response = readJson(UTF_8.decode(bb));
|
||||||
|
|
||||||
return streamJsonObjects(response).flatMap(n -> streamJsonObjects(n, "Files")).map(f -> {
|
return streamJsonObjects(response).flatMap(n -> streamJsonObjects(n, "Files")).map(f -> {
|
||||||
String type = getString(f, "Ext");
|
String type = getString(f, "Ext");
|
||||||
|
Loading…
Reference in New Issue
Block a user