From 159ab0c4841482170d73525842442c4a4bec601b Mon Sep 17 00:00:00 2001 From: PAlexanderFranklin Date: Fri, 2 Aug 2024 13:35:09 -0700 Subject: [PATCH] Add screenshot interval constant --- src/screenmonitor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/screenmonitor.py b/src/screenmonitor.py index 3523ea2..6db4a80 100644 --- a/src/screenmonitor.py +++ b/src/screenmonitor.py @@ -8,6 +8,8 @@ import pyautogui # Define the directory where screenshots will be saved output_dir = os.path.expanduser("~/.screenmonitor/output") +screenshotIntervalInMinutes = 17 + # Ensure the output directory exists os.makedirs(output_dir, exist_ok=True) @@ -66,8 +68,10 @@ def delete_old_screenshots(): def main(): while True: # Calculate the random time within the next 17-minute interval - next_interval_start = datetime.now() + timedelta(minutes=17) - random_seconds = random.randint(0, 17 * 60) + next_interval_start = datetime.now() + timedelta( + seconds=screenshotIntervalInMinutes * 60 + ) + random_seconds = random.randint(0, screenshotIntervalInMinutes * 60) random_time = datetime.now() + timedelta(seconds=random_seconds) # Sleep until the random time within the interval