summaryrefslogtreecommitdiff
path: root/jfr_playoff/generator.py
diff options
context:
space:
mode:
Diffstat (limited to 'jfr_playoff/generator.py')
-rw-r--r--jfr_playoff/generator.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py
index 34d12e7..6d107bd 100644
--- a/jfr_playoff/generator.py
+++ b/jfr_playoff/generator.py
@@ -2,18 +2,25 @@ from datetime import datetime
from jfr_playoff.template import PlayoffTemplate
from jfr_playoff.data import PlayoffData
+from jfr_playoff.logger import PlayoffLogger
class PlayoffGenerator(object):
def __init__(self, settings):
self.data = PlayoffData(settings)
self.page = settings.get('page')
+ PlayoffLogger.get('generator').info(
+ 'page settings: %s', self.page)
self.canvas = {}
if settings.has_section('canvas'):
self.canvas = settings.get('canvas')
+ PlayoffLogger.get('generator').info(
+ 'canvas settings: %s', self.canvas)
self.leaderboard_classes = {}
if settings.has_section('position_styles'):
self.leaderboard_classes = settings.get('position_styles')
+ PlayoffLogger.get('generator').info(
+ 'leaderboard classes settings: %s', self.leaderboard_classes)
self.p_temp = PlayoffTemplate(
settings.get('i18n') if settings.has_section('i18n') else {})
@@ -76,6 +83,8 @@ class PlayoffGenerator(object):
if match.running > 0:
running_html = self.p_temp.get('MATCH_RUNNING', match.running)
html += self.p_temp.get('MATCH_LINK', match.link, running_html) if match.link is not None else running_html
+ PlayoffLogger.get('generator').info(
+ 'match table for #%d generated: %d bytes', match.id, len(html))
return html
def get_phase_header(self, phase, position):
@@ -118,6 +127,8 @@ class PlayoffGenerator(object):
dimensions[1] * (
self.page['height'] + self.page['margin']
) - self.page['margin'])
+ PlayoffLogger.get('generator').info(
+ 'canvas size: %s', canvas_size)
grid_boxes = ''
col_no = 0
for phase in grid:
@@ -128,6 +139,9 @@ class PlayoffGenerator(object):
for match in phase.matches:
grid_y = int(row_no * match_height +
0.5 * (match_height - self.page['height']))
+ PlayoffLogger.get('generator').info(
+ 'grid box (%d, %d) position: (%d, %d)',
+ col_no, row_no, grid_x, grid_y)
grid_boxes += self.get_match_box(
matches[match] if match is not None else None,
(grid_x, grid_y))
@@ -172,6 +186,8 @@ class PlayoffGenerator(object):
position, self.get_flag(team), team or '')
position += 1
html = self.p_temp.get('LEADERBOARD', rows)
+ PlayoffLogger.get('generator').info(
+ 'leaderboard HTML generated: %d bytes', len(html))
return html
def get_swiss_links(self):
@@ -185,7 +201,10 @@ class PlayoffGenerator(object):
else self.p_temp.get(
'SWISS_RUNNING_LINK',
event['link'], event_label)))
- return '\n'.join(info)
+ html = '\n'.join(info)
+ PlayoffLogger.get('generator').info(
+ 'swiss HTML generated: %d bytes', len(html))
+ return html
def get_flag(self, team):
flag = self.data.get_team_image(team)