summaryrefslogtreecommitdiff
path: root/jfr_playoff/tournamentinfo/__init__.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-12-30 12:49:54 +0100
committeremkael <emkael@tlen.pl>2019-12-30 12:49:54 +0100
commit7a598f65372b1b694d222946fd6269033bde0e54 (patch)
treee33fb74aad63756f0b3c94f12e29aff6c97064ed /jfr_playoff/tournamentinfo/__init__.py
parentf77bac9b5406c6bf6b1c819f155164568ef4af36 (diff)
New package structure for result info classes
Diffstat (limited to 'jfr_playoff/tournamentinfo/__init__.py')
-rw-r--r--jfr_playoff/tournamentinfo/__init__.py58
1 files changed, 0 insertions, 58 deletions
diff --git a/jfr_playoff/tournamentinfo/__init__.py b/jfr_playoff/tournamentinfo/__init__.py
deleted file mode 100644
index 21cd62a..0000000
--- a/jfr_playoff/tournamentinfo/__init__.py
+++ /dev/null
@@ -1,58 +0,0 @@
-from jfr_playoff.logger import PlayoffLogger
-from jfr_playoff.data import ResultInfo
-
-
-class TournamentInfoClient(object):
- def __init__(self, settings, database=None):
- self.settings = settings
- self.database = database
-
- def get_results_link(self, suffix):
- pass
-
- def is_finished(self):
- pass
-
- def get_tournament_results(self):
- pass
-
- def get_exceptions(self, method):
- pass
-
-
-class TournamentInfo(ResultInfo):
- def __init__(self, settings, database):
- self.settings = settings
- ResultInfo.__init__(self, settings, database)
-
- def fill_client_list(self, settings, database):
- clients = []
- from jfr_playoff.tournamentinfo.jfrdb import JFRDbTournamentInfo
- from jfr_playoff.tournamentinfo.jfrhtml import JFRHtmlTournamentInfo
- from jfr_playoff.tournamentinfo.tcjson import TCJsonTournamentInfo
- if (database is not None) and ('database' in settings):
- clients.append(JFRDbTournamentInfo(settings, database))
- if 'link' in settings:
- if settings['link'].endswith('leaderb.html'):
- clients.append(JFRHtmlTournamentInfo(settings))
- clients.append(TCJsonTournamentInfo(settings))
- return clients
-
- def get_tournament_results(self):
- teams = self.call_client('get_tournament_results', [])
- if self.is_finished():
- final_positions = self.settings.get('final_positions', [])
- PlayoffLogger.get('tournamentinfo').info(
- 'setting final positions from tournament results: %s',
- final_positions)
- for position in final_positions:
- if len(teams) >= position:
- teams[position-1] = (teams[position-1] + [None] * 4)[0:4]
- teams[position-1][3] = position
- return teams
-
- def is_finished(self):
- return self.call_client('is_finished', True)
-
- def get_results_link(self, suffix='leaderb.html'):
- return self.call_client('get_results_link', None, suffix)