From fad55f6c208aad8f1699d9b6b7feca3889fb6f6d Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Fri, 31 Dec 2010 15:34:54 +0100 Subject: mahou_showtime: Include 'Starting Soon' in results. --- modules/mahou_showtime.py | 18 +++++++++++++----- 1 file 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.' -- cgit v1.2.3