Skip to content

Instantly share code, notes, and snippets.

@spookyahell
Created November 27, 2018 15:37
Show Gist options
  • Save spookyahell/2f4b2e6dcfe698b44902220fb804bf49 to your computer and use it in GitHub Desktop.
Save spookyahell/2f4b2e6dcfe698b44902220fb804bf49 to your computer and use it in GitHub Desktop.
download relentlessly (even upon error - but sleep inbetween
from subprocess import call
from time import sleep
WAIT_TIME = 5 * 60
def download():
x = call(largs)
if x == 1:
if args.relentless:
try:
print('Now sleeping 5 minutes to give kaltura the deserved break...')
sleep(WAIT_TIME)
except KeyboardInterrupt:
pass
return download()
else:
return False
elif x == 0:
return True, 0
else:
return False, x
success, exit_code = download()
if success is not True:
print(f'exited last with exit code {exit_code}')
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment