forked from j62/ctbrec
Wait a few seconds after a problem (404,403) with the HLS playlist occured
This commit is contained in:
parent
25770111da
commit
43cfea36de
|
@ -161,8 +161,10 @@ public class HlsDownload extends AbstractHlsDownload {
|
||||||
} catch(HttpException e) {
|
} catch(HttpException e) {
|
||||||
if(e.getResponseCode() == 404) {
|
if(e.getResponseCode() == 404) {
|
||||||
LOG.debug("Playlist not found (404). Model {} probably went offline", model);
|
LOG.debug("Playlist not found (404). Model {} probably went offline", model);
|
||||||
|
waitSomeTime();
|
||||||
} else if(e.getResponseCode() == 403) {
|
} else if(e.getResponseCode() == 403) {
|
||||||
LOG.debug("Playlist access forbidden (403). Model {} probably went private or offline", model);
|
LOG.debug("Playlist access forbidden (403). Model {} probably went private or offline", model);
|
||||||
|
waitSomeTime();
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -344,4 +346,15 @@ public class HlsDownload extends AbstractHlsDownload {
|
||||||
throw new FileNotFoundException(playlist.getAbsolutePath() + " does not exist");
|
throw new FileNotFoundException(playlist.getAbsolutePath() + " does not exist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Causes the current thread to sleep for a short amount of time.
|
||||||
|
* This is used to slow down retries, if something is wrong with the playlist.
|
||||||
|
* E.g. HTTP 403 or 404
|
||||||
|
*/
|
||||||
|
private void waitSomeTime() {
|
||||||
|
try {
|
||||||
|
Thread.sleep(10_000);
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue