mirror-yt: Add a sleep between downloads
We want to play nice in the internet.
This commit is contained in:
parent
171163b3d9
commit
16de972f7b
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import click
|
||||
|
||||
|
@ -25,7 +26,7 @@ def download(allow_unknown, base_dir, channel_file):
|
|||
line = line.strip()
|
||||
if line.startswith('#'):
|
||||
continue
|
||||
|
||||
|
||||
dir_name, url = line.split(';')
|
||||
channels[dir_name] = url
|
||||
|
||||
|
@ -61,6 +62,10 @@ def download(allow_unknown, base_dir, channel_file):
|
|||
]
|
||||
subprocess.run(cmd, check=True, cwd=target_dir)
|
||||
|
||||
sleep_seconds = 5
|
||||
print(f"Sleeping {sleep_seconds}s")
|
||||
time.sleep(sleep_seconds)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
download()
|
||||
|
|
Loading…
Reference in New Issue