summaryrefslogtreecommitdiff
path: root/jfr_playoff/tournamentinfo
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-12-30 00:45:03 +0100
committeremkael <emkael@tlen.pl>2019-12-30 00:45:03 +0100
commitb869655086ca2139a532d5633d858e6fff2ccbfc (patch)
treeeb8c47dc37809cf3eff1d6dc03845be364f45806 /jfr_playoff/tournamentinfo
parent8c3ba61d67a22e8034be0f68b197077ca143e624 (diff)
Proper parsing of TC JSON participant groups
Diffstat (limited to 'jfr_playoff/tournamentinfo')
-rw-r--r--jfr_playoff/tournamentinfo/tcjson.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/jfr_playoff/tournamentinfo/tcjson.py b/jfr_playoff/tournamentinfo/tcjson.py
index 039a9b0..775183e 100644
--- a/jfr_playoff/tournamentinfo/tcjson.py
+++ b/jfr_playoff/tournamentinfo/tcjson.py
@@ -36,7 +36,15 @@ class TCJsonTournamentInfo(TournamentInfoClient):
results = []
results_json = json.loads(
p_remote.fetch_raw(self.get_results_link('results.json')))
+ participant_groups = []
for result in results_json['Results']:
+ group = result['ParticipantGroup']
+ if group is not None:
+ if group not in participant_groups:
+ participant_groups.append(group)
+ group_id = participant_groups.index(group) + 1
+ else:
+ group_id = 999999
participant = result['Participant']
flag_url = None
flag = participant['_flag']
@@ -46,7 +54,7 @@ class TCJsonTournamentInfo(TournamentInfoClient):
if flag['IsCustom']
else '%s/%s.png' % (FLAG_CDN_URL, flag['CountryNameCode']))
results.append((
- result['ParticipantGroup'], result['Place'],
+ group_id, result['Place'],
participant['_name'], participant['_shortName'],
flag_url))
PlayoffLogger.get('tcjson').info(