Merge branch 'config-flag' of https://github.com/r-pufky/bulk-downloader-for-reddit into r-pufky-config-flag
This commit is contained in:
29
script.py
29
script.py
@@ -268,15 +268,27 @@ def printLogo():
|
||||
f"https://github.com/aliparlakci/bulk-downloader-for-reddit/\n"
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
sys.argv = sys.argv + GLOBAL.config["options"].split()
|
||||
arguments = Arguments.parse()
|
||||
GLOBAL.arguments = arguments
|
||||
|
||||
if Path("config.json").exists():
|
||||
GLOBAL.configDirectory = Path("config.json")
|
||||
if arguments.config:
|
||||
if arguments.use_local_config:
|
||||
sys.exit()
|
||||
if Path(arguments.config).exists():
|
||||
GLOBAL.configDirectory = Path(arguments.config)
|
||||
else:
|
||||
VanillaPrint("custom config",arguments.config,"not found. Exiting.")
|
||||
sys.exit()
|
||||
else:
|
||||
if not Path(GLOBAL.defaultConfigDirectory).is_dir():
|
||||
os.makedirs(GLOBAL.defaultConfigDirectory)
|
||||
GLOBAL.configDirectory = GLOBAL.defaultConfigDirectory / "config.json"
|
||||
if Path("config.json").exists():
|
||||
GLOBAL.configDirectory = Path("config.json")
|
||||
else:
|
||||
if not Path(GLOBAL.defaultConfigDirectory).is_dir():
|
||||
os.makedirs(GLOBAL.defaultConfigDirectory)
|
||||
GLOBAL.configDirectory = GLOBAL.defaultConfigDirectory / "config.json"
|
||||
try:
|
||||
GLOBAL.config = Config(GLOBAL.configDirectory).generate()
|
||||
except InvalidJSONFile as exception:
|
||||
@@ -285,11 +297,6 @@ def main():
|
||||
input("\nPress enter to quit")
|
||||
sys.exit()
|
||||
|
||||
sys.argv = sys.argv + GLOBAL.config["options"].split()
|
||||
|
||||
arguments = Arguments.parse()
|
||||
GLOBAL.arguments = arguments
|
||||
|
||||
if arguments.set_filename:
|
||||
Config(GLOBAL.configDirectory).setCustomFileName()
|
||||
sys.exit()
|
||||
|
||||
Reference in New Issue
Block a user