summaryrefslogtreecommitdiff
path: root/jfr_playoff
diff options
context:
space:
mode:
Diffstat (limited to 'jfr_playoff')
-rw-r--r--jfr_playoff/tournamentinfo/jfrdb.py10
-rw-r--r--jfr_playoff/tournamentinfo/jfrhtml.py20
-rw-r--r--jfr_playoff/tournamentinfo/tcjson.py6
3 files changed, 18 insertions, 18 deletions
diff --git a/jfr_playoff/tournamentinfo/jfrdb.py b/jfr_playoff/tournamentinfo/jfrdb.py
index 8fd77c0..0f39b47 100644
--- a/jfr_playoff/tournamentinfo/jfrdb.py
+++ b/jfr_playoff/tournamentinfo/jfrdb.py
@@ -18,7 +18,7 @@ class JFRDbTournamentInfo(TournamentInfoClient):
if row is not None:
if len(row) > 0:
link = row[0] + suffix
- PlayoffLogger.get('jfrdb').info(
+ PlayoffLogger.get('tournament.jfrdb').info(
'generating tournament-specific link from DB %s prefix: %s -> %s',
self.settings['database'], suffix, link)
return link
@@ -27,7 +27,7 @@ class JFRDbTournamentInfo(TournamentInfoClient):
def is_finished(self):
finished = self.database.fetch(
self.settings['database'], p_sql.SWISS_ENDED, {})
- PlayoffLogger.get('jfrdb').info(
+ PlayoffLogger.get('tournament.jfrdb').info(
'fetching tournament finished status from DB %s: %s',
self.settings['database'], finished)
return (len(finished) > 0) and (finished[0] > 0)
@@ -44,17 +44,17 @@ class JFRDbTournamentInfo(TournamentInfoClient):
swiss_results = sorted(
swiss_results, key=lambda t: t[1], reverse=True)
swiss_results = sorted(swiss_results, key=lambda team: team[2])
- PlayoffLogger.get('jfrdb').info(
+ PlayoffLogger.get('tournament.jfrdb').info(
'fetched tournament results from database %s: %s',
self.settings['database'], swiss_results)
prev_result = None
for team in swiss_results:
if prev_result == team[1]:
- PlayoffLogger.get('jfrdb').warning(
+ PlayoffLogger.get('tournament.jfrdb').warning(
SWISS_TIE_WARNING, self.settings['database'])
prev_result = team[1]
db_teams = [[team[0], team[3], team[4]] for team in swiss_results]
- PlayoffLogger.get('jfrdb').info(
+ PlayoffLogger.get('tournament.jfrdb').info(
'fetched team list from database %s: %s',
self.settings['database'], db_teams)
return db_teams
diff --git a/jfr_playoff/tournamentinfo/jfrhtml.py b/jfr_playoff/tournamentinfo/jfrhtml.py
index 607d0ca..8f40c55 100644
--- a/jfr_playoff/tournamentinfo/jfrhtml.py
+++ b/jfr_playoff/tournamentinfo/jfrhtml.py
@@ -14,19 +14,19 @@ class JFRHtmlTournamentInfo(TournamentInfoClient):
def get_results_link(self, suffix='leaderb.html'):
link = re.sub(r'leaderb.html$', suffix, self.settings['link'])
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'generating tournament-specific link from leaderboard link %s: %s -> %s',
self.settings['link'], suffix, link)
return link
def is_finished(self):
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'fetching tournament finished status from HTML: %s',
self.settings['link'])
leaderboard = p_remote.fetch(self.settings['link'])
leaderb_heading = leaderboard.select('td.bdnl12')[0].text
contains_digits = any(char.isdigit() for char in leaderb_heading)
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'tournament header from HTML: %s, %s',
leaderb_heading,
'contains digits' if contains_digits else "doesn't contain digits")
@@ -35,17 +35,17 @@ class JFRHtmlTournamentInfo(TournamentInfoClient):
for imps
in leaderboard.select('td.bdc small')
if imps.text != '0-0']
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'tournament leaderboard from HTML: has %d non-zero scores',
len(non_zero_scores))
finished = (not contains_digits) and (len(non_zero_scores) > 0)
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'tournament leaderboard from HTML indicates finished: %s',
finished)
return finished
def get_tournament_results(self):
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'fetching tournament results from leaderboard URL: %s',
self.settings['link'])
leaderboard = p_remote.fetch(self.settings['link'])
@@ -72,21 +72,21 @@ class JFRHtmlTournamentInfo(TournamentInfoClient):
if team_image is not None:
team_info.append(team_image['src'].replace('images/', ''))
teams.append(team_info)
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'read tournament results from leaderboard: %s', teams)
for table in range(1, int(ceil(len(teams)/2.0))+1):
table_url = self.get_results_link('1t%d-1.html' % (table))
table_content = p_remote.fetch(table_url)
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'reading team shortnames from traveller: %s', table_url)
for link in table_content.select('a.br'):
if link['href'] in team_links:
for team in teams:
if team[0] == team_links[link['href']]:
team[1] = link.text.strip(u'\xa0')
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'shortname for %s: %s', team[0], team[1])
break
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.jfrhtml').info(
'tournament results from HTML: %s', teams)
return teams
diff --git a/jfr_playoff/tournamentinfo/tcjson.py b/jfr_playoff/tournamentinfo/tcjson.py
index 775183e..5a81ef3 100644
--- a/jfr_playoff/tournamentinfo/tcjson.py
+++ b/jfr_playoff/tournamentinfo/tcjson.py
@@ -14,7 +14,7 @@ class TCJsonTournamentInfo(TournamentInfoClient):
def get_results_link(self, suffix):
link = urlparse.urljoin(self.settings['link'], suffix)
- PlayoffLogger.get('tcjson').info(
+ PlayoffLogger.get('tournament.tcjson').info(
'generating tournament-specific link from leaderboard link %s: %s -> %s',
self.settings['link'], suffix, link)
return link
@@ -27,7 +27,7 @@ class TCJsonTournamentInfo(TournamentInfoClient):
last_session = settings_json['LastPlayedSession']
finished = (not live_results) \
and (last_round > 0) and (last_session > 0)
- PlayoffLogger.get('jfrhtml').info(
+ PlayoffLogger.get('tournament.tcjson').info(
'tournament settings (live = %s, last_round = %d, last_session = %d) indicate finished: %s',
live_results, last_round, last_session, finished)
return finished
@@ -57,6 +57,6 @@ class TCJsonTournamentInfo(TournamentInfoClient):
group_id, result['Place'],
participant['_name'], participant['_shortName'],
flag_url))
- PlayoffLogger.get('tcjson').info(
+ PlayoffLogger.get('tournament.tcjson').info(
'tournament results fetched: %s' % results)
return [list(r[2:]) + [None] for r in sorted(results)]