diff options
Diffstat (limited to 'jfr_playoff')
-rw-r--r-- | jfr_playoff/logger.py | 15 | ||||
-rw-r--r-- | jfr_playoff/matchinfo.py | 5 |
2 files changed, 16 insertions, 4 deletions
diff --git a/jfr_playoff/logger.py b/jfr_playoff/logger.py new file mode 100644 index 0000000..8944e5b --- /dev/null +++ b/jfr_playoff/logger.py @@ -0,0 +1,15 @@ +import logging as log + + +class PlayoffLogger: + + @classmethod + def setup(cls, level): + log.basicConfig( + level=getattr(log, level), + streamhandler=log.StreamHandler(), + format='%(levelname)-8s %(name)-8s %(message)s') + + @classmethod + def get(cls, category=''): + return log.getLogger(category) diff --git a/jfr_playoff/matchinfo.py b/jfr_playoff/matchinfo.py index f65c23c..997e685 100644 --- a/jfr_playoff/matchinfo.py +++ b/jfr_playoff/matchinfo.py @@ -180,9 +180,6 @@ class MatchInfo: def __has_towel_image(self, cell): return len(cell.select('img[alt="towel"]')) > 0 - def __has_running_board_count(self, cell): - return len(cell.select('img[alt="running..."]')) > 0 - def __get_html_running_boards(self, cell): return int(cell.contents[-1].strip()) @@ -218,7 +215,7 @@ class MatchInfo: return 1, 1 # entire match is toweled, so mark as finished else: raise ValueError('segments not found') - running_segments = [cell for cell in row.select('td.bdca') if self.__has_running_board_count(cell)] + running_segments = row.select('td.bdca') running_boards = sum([self.__get_html_running_boards(segment) for segment in running_segments]) finished_segments = [] boards_in_segment = None |