summaryrefslogtreecommitdiff
path: root/jfr_playoff/data/info.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-12-30 21:08:45 +0100
committeremkael <emkael@tlen.pl>2019-12-30 21:08:45 +0100
commit8230739ccf52970a61c68f414f0cf2812b79f766 (patch)
tree80bfc95746817447f3824b9f376e8157371778e8 /jfr_playoff/data/info.py
parent885b6773ef59613594f45fa3941797e053931a15 (diff)
Match links fetched via result info client mechanism
Diffstat (limited to 'jfr_playoff/data/info.py')
-rw-r--r--jfr_playoff/data/info.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/jfr_playoff/data/info.py b/jfr_playoff/data/info.py
index f36b003..142abf4 100644
--- a/jfr_playoff/data/info.py
+++ b/jfr_playoff/data/info.py
@@ -143,18 +143,12 @@ class MatchInfo(ResultInfo):
self.info.teams = []
def __fetch_match_link(self):
- if 'link' in self.config:
- self.info.link = self.config['link']
- PlayoffLogger.get('matchinfo').info(
- 'match #%d link pre-defined: %s', self.info.id, self.info.link)
- elif ('round' in self.config) and ('database' in self.config):
- event_info = TournamentInfo(self.config, self.database)
- self.info.link = event_info.get_results_link(
- 'runda%d.html' % (self.config['round']))
- PlayoffLogger.get('matchinfo').info(
- 'match #%d link fetched: %s', self.info.id, self.info.link)
+ link = self.call_client('get_match_link', None)
+ if link is not None:
+ self.info.link = link
else:
- PlayoffLogger.get('matchinfo').info('match #%d link empty', self.info.id)
+ PlayoffLogger.get('matchinfo').info(
+ 'match #%d link empty', self.info.id)
def __get_predefined_scores(self):
teams = [Team(), Team()]
@@ -561,6 +555,12 @@ class MatchInfo(ResultInfo):
PlayoffLogger.get('matchinfo').info(
'applying phase link %s to match #%d: %s',
phase_link, self.info.id, self.info.link)
+ # re-init result info clients
+ if not len(self.clients) and (self.info.link is not None):
+ PlayoffLogger.get('matchinfo').info(
+ 'config link changed, re-initializing result info client list')
+ self.config['link'] = self.info.link
+ ResultInfo.__init__(self, self.config, self.database)
def get_info(self):
self.__fetch_teams_with_scores()