mirror-yt: Add a sleep between downloads

We want to play nice in the internet.
This commit is contained in:
MasterofJOKers 2024-04-21 23:18:19 +02:00
parent 171163b3d9
commit 16de972f7b
1 changed files with 6 additions and 1 deletions

View File

@ -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()