Add screenshot interval constant
This commit is contained in:
parent
853968a447
commit
159ab0c484
@ -8,6 +8,8 @@ import pyautogui
|
|||||||
# Define the directory where screenshots will be saved
|
# Define the directory where screenshots will be saved
|
||||||
output_dir = os.path.expanduser("~/.screenmonitor/output")
|
output_dir = os.path.expanduser("~/.screenmonitor/output")
|
||||||
|
|
||||||
|
screenshotIntervalInMinutes = 17
|
||||||
|
|
||||||
# Ensure the output directory exists
|
# Ensure the output directory exists
|
||||||
os.makedirs(output_dir, exist_ok=True)
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
|
|
||||||
@ -66,8 +68,10 @@ def delete_old_screenshots():
|
|||||||
def main():
|
def main():
|
||||||
while True:
|
while True:
|
||||||
# Calculate the random time within the next 17-minute interval
|
# Calculate the random time within the next 17-minute interval
|
||||||
next_interval_start = datetime.now() + timedelta(minutes=17)
|
next_interval_start = datetime.now() + timedelta(
|
||||||
random_seconds = random.randint(0, 17 * 60)
|
seconds=screenshotIntervalInMinutes * 60
|
||||||
|
)
|
||||||
|
random_seconds = random.randint(0, screenshotIntervalInMinutes * 60)
|
||||||
random_time = datetime.now() + timedelta(seconds=random_seconds)
|
random_time = datetime.now() + timedelta(seconds=random_seconds)
|
||||||
|
|
||||||
# Sleep until the random time within the interval
|
# Sleep until the random time within the interval
|
||||||
|
Loading…
Reference in New Issue
Block a user