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