diff --git a/lokrez/__init__.py b/lokrez/__init__.py index 3874a89..80238f7 100644 --- a/lokrez/__init__.py +++ b/lokrez/__init__.py @@ -104,6 +104,7 @@ def main(): default = ROOTDIR / "templates", help = "The local result templates directory", ) + top8_parser.add_argument( "--template", "-T", default = "rebootlyon2020", @@ -115,6 +116,7 @@ def main(): default = [], help = "Template-specific options", ) + top8_parser.add_argument( "--lkrz-file", "-f", type = pathlib.Path, @@ -129,6 +131,7 @@ def main(): help = "The SVG or PNG local result file to output to ; if it's " \ "not specified, it will use the tournament slug as name", ) + top8_parser.add_argument( "--name-seo-delimiter", default = None, @@ -138,6 +141,12 @@ def main(): "Lyon', only the 'Cornismash #42' is the tournament name, "\ "the rest is here to help find the tournament).", ) + top8_parser.add_argument( + "--use-smashgg-prefixes", "-P", + action = "store_true", + help = "Use the prefixes (sponsor, team, etc) set by players on " \ + "smash.gg for the tournament", + ) # ------------------------------------------------------------------------- parser.add_argument( "--verbose", "-v", @@ -254,6 +263,7 @@ def main(): # Get infos from smash.gg and write the config file tournament, top_players = getTournamentTop( id_or_slug = args.tournament, + get_prefixes = args.use_smashgg_prefixes, top = 8, token = args.token, proxy = args.proxy, @@ -322,6 +332,7 @@ def main(): # ----------------------------------------------------------------------------- def getTournamentTop( id_or_slug, + get_prefixes = True, top=8, token = "", proxy = None, @@ -450,10 +461,14 @@ def getTournamentTop( except TypeError: twitterHandle = None + if get_prefixes: + prefix = participant_data["prefix"] + else: + prefix = "" player = smashgg.Player( id = standing["entrant"]["id"], - prefix = participant_data["prefix"], + prefix = prefix, gamerTag = participant_data["gamerTag"], placement = standing["placement"], seeding = seeding, diff --git a/lokrez/smashgg.py b/lokrez/smashgg.py index 20f712b..19b67ee 100644 --- a/lokrez/smashgg.py +++ b/lokrez/smashgg.py @@ -44,7 +44,7 @@ class Player(): self.seeding = int(seeding) self.twitterHandle = ( "" if twitterHandle is None else twitterHandle ) - # Prefix is superseeded by sponsors infos + # Prefix is superseeded by sponsors infos in DB try: self.prefix = PLAYERSKINS[self.gamerTag.lower()]["sponsor"] except: