diff options
author | emkael <emkael@tlen.pl> | 2019-12-30 21:08:45 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-12-30 21:08:45 +0100 |
commit | 8230739ccf52970a61c68f414f0cf2812b79f766 (patch) | |
tree | 80bfc95746817447f3824b9f376e8157371778e8 /jfr_playoff/data/info.py | |
parent | 885b6773ef59613594f45fa3941797e053931a15 (diff) |
Match links fetched via result info client mechanism
Diffstat (limited to 'jfr_playoff/data/info.py')
-rw-r--r-- | jfr_playoff/data/info.py | 22 |
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() |