summaryrefslogtreecommitdiff
path: root/jfr_playoff/matchinfo.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-02-21 14:09:05 +0100
committeremkael <emkael@tlen.pl>2018-02-21 14:09:05 +0100
commitccc54fde2f8c9301962e9c6f464d5f2eacd5506a (patch)
tree21a2f05ea664065d1aa98a3c69d58d6c14afdf59 /jfr_playoff/matchinfo.py
parent415748f29a6b3048bef08703a93c4f441f67d1eb (diff)
Not rendering phase/match links if they're not set
Fixes #13
Diffstat (limited to 'jfr_playoff/matchinfo.py')
-rw-r--r--jfr_playoff/matchinfo.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/jfr_playoff/matchinfo.py b/jfr_playoff/matchinfo.py
index ebae673..1f6446e 100644
--- a/jfr_playoff/matchinfo.py
+++ b/jfr_playoff/matchinfo.py
@@ -90,6 +90,8 @@ class MatchInfo:
return None
def __get_html_teams(self, teams, fetch_score):
+ if self.info.link is None:
+ raise ValueError('link not set')
row = self.__find_table_row(self.info.link)
if row is None:
raise ValueError('table row not found')
@@ -205,6 +207,8 @@ class MatchInfo:
return 0, False
def __get_html_board_count(self):
+ if self.info.link is None:
+ raise ValueError('link not set')
row = self.__find_table_row(self.info.link)
if row is None:
raise ValueError('table row not found')
@@ -265,6 +269,8 @@ class MatchInfo:
prefix, round_no, self.config['table'], current_segment)
def __get_html_running_link(self):
+ if self.info.link is None:
+ raise ValueError('link not set')
row = self.__find_table_row(self.info.link)
running_link = row.select('td.bdcg a[href]')
if len(running_link) == 0:
@@ -272,6 +278,8 @@ class MatchInfo:
return urljoin(self.info.link, running_link[0]['href'])
def __determine_running_link(self):
+ if self.info.link is None:
+ return
link_match = re.match(r'^(.*)runda(\d+)\.html$', self.info.link)
if link_match:
try: