forked from j62/ctbrec
Remove retry loop in getNextSegments
This might cause blocks by MFC because we are asking for a resource, which is not available.
This commit is contained in:
parent
a37a018159
commit
0c7650f94f
|
@ -75,7 +75,7 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SegmentPlaylist getNextSegments(String segmentsURL) throws Exception {
|
protected SegmentPlaylist getNextSegments(String segmentsURL) throws IOException, ParseException, PlaylistException {
|
||||||
URL segmentsUrl = new URL(segmentsURL);
|
URL segmentsUrl = new URL(segmentsURL);
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(segmentsUrl)
|
.url(segmentsUrl)
|
||||||
|
@ -87,8 +87,6 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
.header(REFERER, Optional.ofNullable(model).map(Model::getSite).map(Site::getBaseUrl).orElse(""))
|
.header(REFERER, Optional.ofNullable(model).map(Model::getSite).map(Site::getBaseUrl).orElse(""))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Exception lastException = null;
|
|
||||||
for (int tries = 1; tries <= 10 && running; tries++) {
|
|
||||||
try (Response response = client.execute(request)) {
|
try (Response response = client.execute(request)) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
String body = response.body().string();
|
String body = response.body().string();
|
||||||
|
@ -129,19 +127,6 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
|
||||||
} else {
|
} else {
|
||||||
throw new HttpException(response.code(), response.message());
|
throw new HttpException(response.code(), response.message());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.debug("Couldn't download HLS playlist (try {}) {} - [{}]", tries, e.getMessage(), segmentsURL);
|
|
||||||
lastException = e;
|
|
||||||
if (!getModel().isOnline(true)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
waitSomeTime(100 * tries);
|
|
||||||
}
|
|
||||||
if (lastException != null) {
|
|
||||||
throw lastException;
|
|
||||||
} else {
|
|
||||||
throw new IOException("Couldn't download HLS playlist");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class LiveJasminHlsDownload extends HlsDownload {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SegmentPlaylist getNextSegments(String segments) throws Exception {
|
protected SegmentPlaylist getNextSegments(String segments) throws IOException, ParseException, PlaylistException {
|
||||||
if(this.segmentUrl == null) {
|
if(this.segmentUrl == null) {
|
||||||
this.segmentUrl = segments;
|
this.segmentUrl = segments;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class LiveJasminMergedHlsDownload extends MergedFfmpegHlsDownload {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SegmentPlaylist getNextSegments(String segments) throws Exception {
|
protected SegmentPlaylist getNextSegments(String segments) throws IOException, ParseException, PlaylistException {
|
||||||
if(this.segmentUrl == null) {
|
if(this.segmentUrl == null) {
|
||||||
this.segmentUrl = segments;
|
this.segmentUrl = segments;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue