Skip to content

Commit

Permalink
🚸 Make the artwork downloader a cli flag
Browse files Browse the repository at this point in the history
"Make the artwork downloader a cli flag rather than requiring user input"
  • Loading branch information
DrgnFireYellow committed Feb 17, 2024
1 parent 51d0c3b commit 12bcd7e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 12 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argparse
import json
import logging
import os
Expand All @@ -14,6 +15,16 @@
from rich.table import Table
from yaml import Loader, load

argumentparser = argparse.ArgumentParser(
prog="EmuWeb",
description="Script to generate EmuWeb output from game and artwork files.",
)
argumentparser.add_argument(
"--download_artwork",
action="store_true",
help="attempt to automatically download game artwork (slow)",
)
args = argumentparser.parse_args()
with open("EmuWeb.log", "w") as logfile:
logfile.write("")
logging.basicConfig(
Expand Down Expand Up @@ -46,9 +57,7 @@
<div id="gamelist">
<i class="bi bi-search text-light ms-1"></i><input class="search ms-2 mb-2 rounded-pill border-dark" type="search" placeholder="Search...">
<ul class="list">"""
downloadartwork = questionary.confirm(
"Would you like to attempt to automatically download artwork?"
).ask()
downloadartwork = args.download_artwork
if downloadartwork:
for system in SYSTEMS:
if system in ARTWORKURLS:
Expand Down
7 changes: 6 additions & 1 deletion wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def projectidvalidator(projectid):
with open("config.yml", "w") as configfile:
dump(config, configfile, Dumper=Dumper)
elif action == "Regenerate Output":
run([sys.executable, "main.py"])
if questionary.confirm(
"Would you like to attempt to automatically download artwork?"
).ask():
run([sys.executable, "main.py", "--download_artwork"])
else:
run([sys.executable, "main.py"])
elif action == "Quit":
quit()

0 comments on commit 12bcd7e

Please sign in to comment.