forked from j62/ctbrec
Catch JSON parse exception
This commit is contained in:
parent
5fa939ae65
commit
a2e2dbda6d
|
@ -98,16 +98,21 @@ public class BongaCamsModel extends AbstractModel {
|
||||||
return online;
|
return online;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isStreamAvailable() throws IOException {
|
private boolean isStreamAvailable() {
|
||||||
String url = getStreamUrl();
|
try {
|
||||||
Request req = new Request.Builder().url(url).build();
|
String url = getStreamUrl();
|
||||||
try(Response resp = site.getHttpClient().execute(req)) {
|
Request req = new Request.Builder().url(url).build();
|
||||||
if(resp.isSuccessful()) {
|
try (Response resp = site.getHttpClient().execute(req)) {
|
||||||
String body = resp.body().string();
|
if (resp.isSuccessful()) {
|
||||||
return body.contains("#EXT-X-STREAM-INF");
|
String body = resp.body().string();
|
||||||
} else {
|
return body.contains("#EXT-X-STREAM-INF");
|
||||||
return false;
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
LOG.warn("Couldn't check if stream is available: {}", e.getLocalizedMessage());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue