diff options
Diffstat (limited to 'jfr_playoff/data/match/tcjson.py')
-rw-r--r-- | jfr_playoff/data/match/tcjson.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/jfr_playoff/data/match/tcjson.py b/jfr_playoff/data/match/tcjson.py new file mode 100644 index 0000000..fbc28ce --- /dev/null +++ b/jfr_playoff/data/match/tcjson.py @@ -0,0 +1,26 @@ +import urlparse + +from jfr_playoff.data.match import MatchInfoClient +from jfr_playoff.logger import PlayoffLogger + + +class TCJsonMatchInfo(MatchInfoClient): + @property + def priority(self): + return 20 + + def is_capable(self): + return ('link' in self.settings) and ('#' in self.settings['link']) + + def get_exceptions(self, method): + return (TypeError, IndexError, KeyError, IOError, ValueError) + + def _get_round_from_link(self, link): + fragment = urlparse.urlparse(link).fragment + return fragment[11:14], fragment[14:17] + + def get_match_link(self): + PlayoffLogger.get('match.tcjson').info( + 'match #%d link pre-defined: %s', + self.settings['id'], self.settings['link']) + return self.settings['link'] |