summaryrefslogtreecommitdiff
path: root/jfr_playoff/data/match/tcjson.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/match/tcjson.py
parent885b6773ef59613594f45fa3941797e053931a15 (diff)
Match links fetched via result info client mechanism
Diffstat (limited to 'jfr_playoff/data/match/tcjson.py')
-rw-r--r--jfr_playoff/data/match/tcjson.py26
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']