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/match/jfrdb.py | |
parent | 885b6773ef59613594f45fa3941797e053931a15 (diff) |
Match links fetched via result info client mechanism
Diffstat (limited to 'jfr_playoff/data/match/jfrdb.py')
-rw-r--r-- | jfr_playoff/data/match/jfrdb.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/jfr_playoff/data/match/jfrdb.py b/jfr_playoff/data/match/jfrdb.py new file mode 100644 index 0000000..7d9e067 --- /dev/null +++ b/jfr_playoff/data/match/jfrdb.py @@ -0,0 +1,28 @@ +from jfr_playoff.data import TournamentInfo +from jfr_playoff.data.match import MatchInfoClient +from jfr_playoff.logger import PlayoffLogger + + +class JFRDbMatchInfo(MatchInfoClient): + @property + def priority(self): + return 50 + + def is_capable(self): + return (self.database is not None) and ('database' in self.settings) + + def get_exceptions(self, method): + return (IOError, TypeError, IndexError, KeyError) + + def get_match_link(self): + if 'link' in self.settings: + raise NotImplementedError( + 'link specified in config, skipping lookup') + if 'round' not in self.settings: + raise IndexError('round number not specified in match config') + event_info = TournamentInfo(self.settings, self.database) + link = event_info.get_results_link( + 'runda%d.html' % (self.settings['round'])) + PlayoffLogger.get('match.jfrdb').info( + 'match #%d link fetched: %s', self.settings['id'], link) + return link |