diff options
author | emkael <emkael@tlen.pl> | 2018-02-17 13:20:25 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-02-17 13:20:25 +0100 |
commit | ad77849280b2c8231be90349bc4ca6c4c6597d35 (patch) | |
tree | 7077237c088fa4f0797ec650228703233a304e3e /jfr_playoff | |
parent | fef0d2d2651182da000c67e22ad7a6695f856811 (diff) |
Ability to define team names for a match manually
Diffstat (limited to 'jfr_playoff')
-rw-r--r-- | jfr_playoff/matchinfo.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/jfr_playoff/matchinfo.py b/jfr_playoff/matchinfo.py index 1df6305..b566b39 100644 --- a/jfr_playoff/matchinfo.py +++ b/jfr_playoff/matchinfo.py @@ -55,8 +55,21 @@ class MatchInfo: scores_fetched = False teams_fetched = False if 'score' in self.config: - for i in range(0, 2): - teams[i].score = self.config['score'][i] + i = 0 + for score in self.config['score']: + if isinstance(self.config['score'], dict): + teams[i].score = self.config['score'][score] + try: + team_no = int(score) + teams[i].name = self.teams[team_no-1][0] + except ValueError: + teams[i].name = score + teams_fetched = True + else: + teams[i].score = score + i += 1 + if i == 2: + break scores_fetched = True return scores_fetched, teams_fetched, teams |