parent
f4115da4d0
commit
8b61e6b8a6
|
@ -15,6 +15,8 @@ import lokrez.version as version
|
|||
# =============================================================================
|
||||
__version__ = version.__version__
|
||||
|
||||
ROOTDIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# =============================================================================
|
||||
def main():
|
||||
|
||||
|
@ -34,11 +36,6 @@ def main():
|
|||
default = None,
|
||||
help = "the authentication token to use" )
|
||||
|
||||
parser.add_argument(
|
||||
"--rootdir", "-RD",
|
||||
default = None,
|
||||
help = "The directories containing this script, defaults to '.'",
|
||||
)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
init_parser = subparsers.add_parser(
|
||||
|
@ -53,7 +50,7 @@ def main():
|
|||
|
||||
init_parser.add_argument(
|
||||
"--imgdir", "-ID",
|
||||
default = "res/ssbu/chars",
|
||||
default = os.path.join(ROOTDIR, "res"),
|
||||
help = "The directory we should download the resources to",
|
||||
)
|
||||
|
||||
|
@ -69,18 +66,19 @@ def main():
|
|||
)
|
||||
top8_parser.add_argument(
|
||||
"--imgdir", "-ID",
|
||||
default = "res/ssbu/chars",
|
||||
help = "The directories containing images",
|
||||
default = os.path.join(ROOTDIR, "res"),
|
||||
help = "The directories containing images, be careful whether " \
|
||||
"you specify an absolute path or a relative one.",
|
||||
)
|
||||
top8_parser.add_argument(
|
||||
"--playerskinsdb", "-PD",
|
||||
default = "res/ssbu/playerskins/lyon.json",
|
||||
help = "A CSV file matching player tags, characters and " \
|
||||
default = os.path.join(ROOTDIR, "data", "playerskinsdb.json"),
|
||||
help = "A JSON file matching player tags, characters and " \
|
||||
"preferred skins",
|
||||
)
|
||||
top8_parser.add_argument(
|
||||
"--templatesdir", "-TD",
|
||||
default = "templates",
|
||||
default = os.path.join(ROOTDIR, "templates"),
|
||||
help = "The local result templates directory",
|
||||
)
|
||||
top8_parser.add_argument(
|
||||
|
@ -153,12 +151,6 @@ def main():
|
|||
print(version.VERSION_NAME)
|
||||
return 0
|
||||
|
||||
# Set default arguments
|
||||
# -------------------------------------------------------------------------
|
||||
# Default rootdir is "."
|
||||
if args.rootdir is None:
|
||||
args.rootdir = "." # TODO compute script root?
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
if args.command not in [ "init", "top8" ]:
|
||||
parser.print_help()
|
||||
|
@ -268,10 +260,7 @@ def main():
|
|||
top_players.values(),
|
||||
key = lambda p: p.placement,
|
||||
),
|
||||
"dir_root": args.rootdir,
|
||||
"dir_res_ssbu": os.path.join(
|
||||
args.imgdir,
|
||||
),
|
||||
"dir_res_ssbu": args.imgdir,
|
||||
}
|
||||
|
||||
rv = export.generate_outfile(
|
||||
|
@ -344,6 +333,7 @@ def getTournamentTop(
|
|||
"id" : int(id_or_slug), # If this fails, it's a slug
|
||||
"top": top,
|
||||
},
|
||||
query_dir = os.path.join( ROOTDIR, "queries" ),
|
||||
token = token,
|
||||
proxy = proxy,
|
||||
log = log,
|
||||
|
@ -356,6 +346,7 @@ def getTournamentTop(
|
|||
"slug" : id_or_slug,
|
||||
"top": top,
|
||||
},
|
||||
query_dir = os.path.join( ROOTDIR, "queries" ),
|
||||
token = token,
|
||||
proxy = proxy,
|
||||
log = log,
|
||||
|
@ -440,6 +431,7 @@ def getTournamentTop(
|
|||
"tournamentId" : int(tournament.id),
|
||||
"entrantIds": [ id for id in top_players.keys() ],
|
||||
},
|
||||
query_dir = os.path.join( ROOTDIR, "queries" ),
|
||||
token = token,
|
||||
proxy = proxy,
|
||||
log = log,
|
||||
|
|
Loading…
Reference in New Issue