From ad77849280b2c8231be90349bc4ca6c4c6597d35 Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 17 Feb 2018 13:20:25 +0100 Subject: Ability to define team names for a match manually --- jfr_playoff/matchinfo.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'jfr_playoff') 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 -- cgit v1.2.3