blob: 7d9e067c23b3d6caaa0f6139d0a5b2361c60b478 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
|