init variable order, so that tests can be built.

This commit is contained in:
Danilo Reyes
2026-02-28 19:48:49 -06:00
parent 83210d4356
commit c71ff53b23

View File

@@ -23,10 +23,19 @@ from classes.user import User
from classes.gallery import Gallery from classes.gallery import Gallery
# GLOBAL VARIABLE SECTION # GLOBAL VARIABLE SECTION
CONFIGS = load_config_variables() CONFIGS = None
# Enable a default "everyone" flag for when running stuff like download gallery # Enable a default "everyone" flag for when running stuff like download gallery
USERS = ["everyone"] + [user["name"] for user in CONFIGS["users"]] USERS = []
ARGS = argparser(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: class Video:
@@ -304,6 +313,7 @@ def scrap_everyone() -> None:
def main(): def main():
"""Main module to decide what to do based on the parsed arguments""" """Main module to decide what to do based on the parsed arguments"""
init_globals()
if ARGS.scrapper: if ARGS.scrapper:
rgx_shared = re.compile("push|main|instagram|kemono") rgx_shared = re.compile("push|main|instagram|kemono")
if (ARGS.user in "everyone") and (rgx_shared.search(ARGS.scrapper)): if (ARGS.user in "everyone") and (rgx_shared.search(ARGS.scrapper)):