Run in regular intervals with less intervention

This commit is contained in:
2025-01-14 18:52:52 -08:00
parent b761fccd69
commit 58fa818128
3 changed files with 236 additions and 22 deletions

View File

@@ -1,11 +1,15 @@
from selenium import webdriver
import AutoTicket
import AutoColor
import AutoColor2
import json
import os
import datetime
import time
urls = {"NOC-PROV": "", "NOC-PROV-ADV" : "", "PROV-DSL" : "", "PROV-FIBER":"", "PROV-IPBB":"","PROV-MISC":"","FUS-PROV":"","TICKETS":""}
tickets_sorted = False
def assign_urls(dictionary):
for key in dictionary:
value = input(f"Enter url for '{key}': ")
@@ -43,29 +47,25 @@ def first_time_setup():
with open('team.json', 'w') as file:
json.dump(users, file)
def choice(urls,users,driver):
print("Tickets or Directly?")
user_choice = input()
if "ti" in user_choice.lower():
AutoTicket.auto_ticket(urls,users,driver)
if "di" in user_choice.lower():
AutoColor.tag_assist(urls,driver,users)
print("Go back to Directly or Tickets choice?")
if input("y/n : ") == "y":
choice(urls,users,driver)
def main():
if os.path.exists('urls.json'):
print("Do first time set up?")
if input("y/n : ") == "y":
first_time_setup()
print("Skipping first time setup")
else: first_time_setup()
driver = webdriver.Firefox()
with open('urls.json', 'r') as file:
urls = json.load(file)
with open('team.json', 'r') as file:
users = json.load(file)
choice(urls,users,driver)
driver.close()
while True:
current_time = datetime.datetime.now().time()
start_time = datetime.time(9, 0, 0)
end_time = datetime.time(17, 0, 0)
if start_time <= current_time <= end_time:
AutoTicket.auto_ticket(urls, users, driver, tickets_sorted)
AutoColor2.tag_assist(urls, driver, users)
else:
print("It's after hours. I'm not doing anything.")
time.sleep(7200) # Sleep for 2 hours
#driver.close()
main()