diff --git a/src/download/download.py b/src/download/download.py index d01e3b8..703bb11 100644 --- a/src/download/download.py +++ b/src/download/download.py @@ -23,10 +23,19 @@ from classes.user import User from classes.gallery import Gallery # GLOBAL VARIABLE SECTION -CONFIGS = load_config_variables() +CONFIGS = None # Enable a default "everyone" flag for when running stuff like download gallery -USERS = ["everyone"] + [user["name"] for user in CONFIGS["users"]] -ARGS = argparser(USERS) +USERS = [] +ARGS = None + + +def init_globals() -> None: + """Initialize global config and CLI args.""" + global CONFIGS, USERS, ARGS + if CONFIGS is None: + CONFIGS = load_config_variables() + USERS = ["everyone"] + [user["name"] for user in CONFIGS["users"]] + ARGS = argparser(USERS) class Video: @@ -304,6 +313,7 @@ def scrap_everyone() -> None: def main(): """Main module to decide what to do based on the parsed arguments""" + init_globals() if ARGS.scrapper: rgx_shared = re.compile("push|main|instagram|kemono") if (ARGS.user in "everyone") and (rgx_shared.search(ARGS.scrapper)):