Add screenshot interval constant

This commit is contained in:
PAlexanderFranklin 2024-08-02 13:35:09 -07:00
parent 853968a447
commit 159ab0c484

View File

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