diff options
Diffstat (limited to 'jfr_playoff/generator.py')
-rw-r--r-- | jfr_playoff/generator.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py index 2b5aaf0..ee1a496 100644 --- a/jfr_playoff/generator.py +++ b/jfr_playoff/generator.py @@ -2,18 +2,25 @@ from datetime import datetime import jfr_playoff.template as p_temp 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) def generate_content(self): match_grid = self.get_match_grid( @@ -61,6 +68,8 @@ class PlayoffGenerator(object): if match.running > 0: running_html = p_temp.MATCH_RUNNING % (match.running) html += p_temp.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): @@ -101,6 +110,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: @@ -111,6 +122,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)) @@ -152,6 +166,8 @@ class PlayoffGenerator(object): position, self.get_flag(team), team or '') position += 1 html = p_temp.LEADERBOARD.decode('utf8') % (rows) + PlayoffLogger.get('generator').info( + 'leaderboard HTML generated: %d bytes', len(html)) return html def get_swiss_links(self): @@ -163,7 +179,10 @@ class PlayoffGenerator(object): info.append((p_temp.SWISS_LINK if event['finished'] else p_temp.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) |