forked from j62/ctbrec
1
0
Fork 0

Wait a few seconds after a problem (404,403) with the HLS playlist occured

This commit is contained in:
0xboobface 2019-06-01 17:27:59 +02:00
parent 25770111da
commit 43cfea36de
1 changed files with 13 additions and 0 deletions

View File

@ -161,8 +161,10 @@ public class HlsDownload extends AbstractHlsDownload {
} catch(HttpException e) {
if(e.getResponseCode() == 404) {
LOG.debug("Playlist not found (404). Model {} probably went offline", model);
waitSomeTime();
} else if(e.getResponseCode() == 403) {
LOG.debug("Playlist access forbidden (403). Model {} probably went private or offline", model);
waitSomeTime();
} else {
throw e;
}
@ -344,4 +346,15 @@ public class HlsDownload extends AbstractHlsDownload {
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) {}
}
}