Merge branch 'master' of github.com:lukeroge/CloudBot

This commit is contained in:
Luke Rogers 2011-11-21 12:01:40 +13:00
commit a35b7240a4
1 changed files with 7 additions and 7 deletions

View File

@ -13,7 +13,7 @@ from util import hook, http
base_url = "http://thetvdb.com/api/"
api_key = "469B73127CA0C411"
api_key = "F021D0F747892137"
def get_zipped_xml(*args, **kwargs):
@ -31,13 +31,13 @@ def get_episodes_for_series(seriesname):
try:
query = http.get_xml(base_url + 'GetSeries.php', seriesname=seriesname)
except URLError:
res["error"] = "error contacting thetvdb.com"
res["error"] = "Error contacting thetvdb.com."
return res
series_id = query.xpath('//seriesid/text()')
if not series_id:
res["error"] = "unknown tv series (using www.thetvdb.com)"
res["error"] = "Unknown TV series (using www.thetvdb.com)."
return res
series_id = series_id[0]
@ -46,7 +46,7 @@ def get_episodes_for_series(seriesname):
series = get_zipped_xml(base_url + '%s/series/%s/all/en.zip' %
(api_key, series_id), path="en.xml")
except URLError:
res["error"] = "error contacting thetvdb.com"
res["error"] = "Error contacting thetvdb.com."
return res
series_name = series.xpath('//SeriesName/text()')[0]
@ -119,13 +119,13 @@ def tv_next(inp):
break
if not next_eps:
return "there are no new episodes scheduled for %s" % series_name
return "There are no new episodes scheduled for %s." % series_name
if len(next_eps) == 1:
return "the next episode of %s airs %s" % (series_name, next_eps[0])
return "The next episode of %s airs %s." % (series_name, next_eps[0])
else:
next_eps = ', '.join(next_eps)
return "the next episodes of %s: %s" % (series_name, next_eps)
return "The next episodes of %s: %s." % (series_name, next_eps)
@hook.command