From 0c6cfd452a44f81901c0105b6752c6fa840f6b2e Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 25 Aug 2023 17:05:07 +0200 Subject: [PATCH] Wait a bit between two channel udpates. --- ytdl_link_gen.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ytdl_link_gen.py b/ytdl_link_gen.py index c877bab..da333d0 100644 --- a/ytdl_link_gen.py +++ b/ytdl_link_gen.py @@ -18,6 +18,8 @@ import sys import datetime import shutil import gc +import time +import random config_data = [] video_file_data = {} @@ -29,6 +31,9 @@ def print_usage(): print("gen : generates video download shell script"); exit() +def sleep_range(min_sleep, rand_add): + time.sleep(random.random() * float(rand_add) + float(min_sleep)) + def copy(src, dest): try: shutil.copytree(src, dest) @@ -838,3 +843,6 @@ if command == "gen": collected = gc.collect() print("Garbage collector: collected", "%d objects." % collected) + + # TODO make this customizable from the commadn line + sleep_range(10, 5)