summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-12-31 15:34:54 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2010-12-31 15:34:54 +0100
commitfad55f6c208aad8f1699d9b6b7feca3889fb6f6d (patch)
treee8fa29f1c4a068d51f052d34221acf18309d118f
parentc093ba45378a1981a8b40a50531f1fb83f9c22a7 (diff)
mahou_showtime: Include 'Starting Soon' in results.
-rw-r--r--modules/mahou_showtime.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/modules/mahou_showtime.py b/modules/mahou_showtime.py
index 184b9f0..440c3a5 100644
--- a/modules/mahou_showtime.py
+++ b/modules/mahou_showtime.py
@@ -29,17 +29,25 @@ class Module:
return 'Failed to fetch showtime data.'
soup = BeautifulSoup(self.cache)
+ results = []
+
t = soup.find('table', attrs = {'summary': 'Currently Airing'})
trs = t.tr.td.table.findAll('tr')
del trs[0] # delete the "header" table row
-
for tr in trs:
tds = tr.findAll('td')
- title = tds[1].contents[0]
+ results.append((tds[1].contents[0], tds[3].contents[0], tds[5].contents[0], tds[6].contents[0].strip()))
+
+ t = soup.find('table', attrs = {'summary': 'Starting Soon'})
+ trs2 = t.tr.td.table.findAll('tr')
+ del trs2[0] # delete the "header" table row
+ for tr in trs2:
+ tds = tr.findAll('td')
+ results.append((tds[1].contents[0], tds[3].contents[0], tds[5].contents[0], tds[8].contents[0].strip()))
+
+ for r in results:
+ title, channel, airtime, eta = r
if all([x in title.lower() for x in search]):
- channel = tds[3].contents[0]
- airtime = tds[5].contents[0]
- eta = tds[6].contents[0].strip()
s = '%s airs on %s on %s (eta: %s)' % (title, channel, airtime, eta)
return s.encode('utf8')
return 'No match found.'