forked from j62/ctbrec
1
0
Fork 0

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:
0xboobface 2020-04-18 19:09:38 +02:00
parent a37a018159
commit 0c7650f94f
3 changed files with 38 additions and 53 deletions

View File

@ -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);
Request request = new Request.Builder()
.url(segmentsUrl)
@ -87,8 +87,6 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
.header(REFERER, Optional.ofNullable(model).map(Model::getSite).map(Site::getBaseUrl).orElse(""))
.build();
Exception lastException = null;
for (int tries = 1; tries <= 10 && running; tries++) {
try (Response response = client.execute(request)) {
if (response.isSuccessful()) {
String body = response.body().string();
@ -129,19 +127,6 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
} else {
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");
}
}

View File

@ -26,7 +26,7 @@ public class LiveJasminHlsDownload extends HlsDownload {
}
@Override
protected SegmentPlaylist getNextSegments(String segments) throws Exception {
protected SegmentPlaylist getNextSegments(String segments) throws IOException, ParseException, PlaylistException {
if(this.segmentUrl == null) {
this.segmentUrl = segments;
}

View File

@ -26,7 +26,7 @@ public class LiveJasminMergedHlsDownload extends MergedFfmpegHlsDownload {
}
@Override
protected SegmentPlaylist getNextSegments(String segments) throws Exception {
protected SegmentPlaylist getNextSegments(String segments) throws IOException, ParseException, PlaylistException {
if(this.segmentUrl == null) {
this.segmentUrl = segments;
}