diff options
Diffstat (limited to 'jfr_playoff/data/tournament')
-rw-r--r-- | jfr_playoff/data/tournament/__init__.py | 10 | ||||
-rw-r--r-- | jfr_playoff/data/tournament/jfrdb.py | 8 | ||||
-rw-r--r-- | jfr_playoff/data/tournament/jfrhtml.py | 8 | ||||
-rw-r--r-- | jfr_playoff/data/tournament/tcjson.py | 7 |
4 files changed, 25 insertions, 8 deletions
diff --git a/jfr_playoff/data/tournament/__init__.py b/jfr_playoff/data/tournament/__init__.py index 9ec71dd..ef16e54 100644 --- a/jfr_playoff/data/tournament/__init__.py +++ b/jfr_playoff/data/tournament/__init__.py @@ -1,8 +1,7 @@ -class TournamentInfoClient(object): - def __init__(self, settings, database=None): - self.settings = settings - self.database = database +from jfr_playoff.data.info import ResultInfoClient + +class TournamentInfoClient(ResultInfoClient): def get_results_link(self, suffix): pass @@ -11,6 +10,3 @@ class TournamentInfoClient(object): def get_tournament_results(self): pass - - def get_exceptions(self, method): - pass diff --git a/jfr_playoff/data/tournament/jfrdb.py b/jfr_playoff/data/tournament/jfrdb.py index 48645df..6317a79 100644 --- a/jfr_playoff/data/tournament/jfrdb.py +++ b/jfr_playoff/data/tournament/jfrdb.py @@ -1,5 +1,4 @@ import jfr_playoff.sql as p_sql - from jfr_playoff.logger import PlayoffLogger from jfr_playoff.data.tournament import TournamentInfoClient @@ -9,6 +8,13 @@ SWISS_TIE_WARNING = 'tie detected in swiss %s.' + \ class JFRDbTournamentInfo(TournamentInfoClient): + @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) diff --git a/jfr_playoff/data/tournament/jfrhtml.py b/jfr_playoff/data/tournament/jfrhtml.py index 017ce3b..ac57d4c 100644 --- a/jfr_playoff/data/tournament/jfrhtml.py +++ b/jfr_playoff/data/tournament/jfrhtml.py @@ -7,6 +7,14 @@ from jfr_playoff.data.tournament import TournamentInfoClient class JFRHtmlTournamentInfo(TournamentInfoClient): + @property + def priority(self): + return 30 + + def is_capable(self): + return ('link' in self.settings) \ + and (self.settings['link'].endswith('leaderb.html')) + def get_exceptions(self, method): if method == 'get_results_link': return (KeyError, ValueError) diff --git a/jfr_playoff/data/tournament/tcjson.py b/jfr_playoff/data/tournament/tcjson.py index 5e375ed..8d7cd34 100644 --- a/jfr_playoff/data/tournament/tcjson.py +++ b/jfr_playoff/data/tournament/tcjson.py @@ -9,6 +9,13 @@ FLAG_CDN_URL = 'https://cdn.tournamentcalculator.com/flags/' class TCJsonTournamentInfo(TournamentInfoClient): + @property + def priority(self): + return 20 + + def is_capable(self): + return 'link' in self.settings + def get_exceptions(self, method): return (TypeError, IndexError, KeyError, IOError, ValueError) |