diff --git a/.gitignore b/.gitignore index d6cbb35..645f68d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ CCTVCrawl* devscrape* +OLD_devscrape* *.log __pycache__ diff --git a/main.py b/main.py index 77c17c0..e008ff4 100644 --- a/main.py +++ b/main.py @@ -12,15 +12,15 @@ import threading # author: iRaven (https://iravenhome.net) # Started 9/6/22. -#version = "2021.9.8" +#version = "2022.9.28" # Configure logging logging.basicConfig(filename="TransArchive.log", - format='%(asctime)s %(message)s', + format='%(asctime)s %(levelname)s %(message)s', filemode='a') log = logging.getLogger() log.setLevel(logging.DEBUG) -logging.getLogger("requests").setLevel(logging.WARNING) +logging.getLogger("urllib3").setLevel(logging.WARNING) #define local vars @@ -35,7 +35,7 @@ csvfile = (f"TransArchive_{curdate}.csv") # mainly for debugging but to show sta csvfields = ['time','camera_id', 'status'] # ^ # very important var: where we get everything -cctvurl = (f'https://www.houstontranstar.org/snapshots/cctv/') # Last updated Sep-2022 +cctvurl = (f'https://www.houstontranstar.org/snapshots/cctv/') # Last updated Sep-6-2022 # very important var: list of valid camera feeds generated by devs (likely included and updated in repo) vftxt = open("valid_feed_list.txt", "r") vfdata = vftxt.read() @@ -60,7 +60,7 @@ def initFolder(startmode): log.warning("archive folder for todays date doesn't exist (expected LOL), creating it") os.makedirs(f"archive/{curdate}") elif not os.path.exists(f"TransstarArchive_{curdate}.csv"): - log.error("csv file doesn't exist. creating it for today") + log.warning("csv file doesn't exist. creating it for today") with open(csvfile, 'a') as listfile: csvwrite = csv.writer(listfile) csvwrite.writerow(csvfields) @@ -125,6 +125,7 @@ def MainMenu(): # Arguments for arg in arglist: + # print(arglist) if arg in ("-archive"): # print("Archive was passed") # debugging initFolder("script") @@ -132,7 +133,15 @@ for arg in arglist: elif arg in ("-testarg"): # debugging, left to test arguments print("test arg was passed") log.debug("Test arg was passed -- not running") - else: # no arguments are passed, just running the file from a folder (which is oki) + else: # unrecognized arguments are passed (which is oki) # log.debug("no args were passed!") + # log.debug("unrecognized args were passed!") initFolder("normal") - MainMenu() \ No newline at end of file + MainMenu() + +# noticed an issue where this doesn't run standalone anymore. maybe this will fix it. idk +if len(arglist) == 0: + # log.debug("no args were passed!") + initFolder("noarg") + MainMenu() + # 09/28/22- ok this will semi work for now. if any arg other than the ones defined above are passed it'll ignore them and run like none were passed