diff --git a/core/config.py b/core/config.py index 33dce5e..b0c3862 100644 --- a/core/config.py +++ b/core/config.py @@ -28,7 +28,8 @@ if not os.path.exists('config'): "acls": {}, "api_keys": { - "geoip": "INSERT KEY FROM ipinfodb.com HERE", + "geoip": "INSERT API KEY FROM ipinfodb.com HERE", + "tvdb": "INSERT API KEY FROM thetvdb.com HERE", "bitly_user": "INSERT USERNAME FROM bitly.com HERE", "bitly_api": "INSERT API KEY FROM bitly.com HERE", "mc_user": "INSERT MINECRAFT USERNAME HERE (used to check login servers in mclogin.py)", diff --git a/plugins/tvdb.py b/plugins/tvdb.py index 320bcec..279d02f 100644 --- a/plugins/tvdb.py +++ b/plugins/tvdb.py @@ -25,7 +25,7 @@ def get_zipped_xml(*args, **kwargs): return etree.parse(ZipFile(zip_buffer, "r").open(path)) -def get_episodes_for_series(seriesname): +def get_episodes_for_series(seriesname, api_key): res = {"error": None, "ended": False, "episodes": None, "name": None} # http://thetvdb.com/wiki/index.php/API:GetSeries try: @@ -84,9 +84,11 @@ def get_episode_info(episode): @hook.command @hook.command('tv') -def tv_next(inp): +def tv_next(inp, bot = None): ".tv_next -- get the next episode of " - episodes = get_episodes_for_series(inp) + + api_key = bot.config["api_keys"]["tvdb"] + episodes = get_episodes_for_series(inp, api_key) if episodes["error"]: return episodes["error"] @@ -130,9 +132,11 @@ def tv_next(inp): @hook.command @hook.command('tv_prev') -def tv_last(inp): +def tv_last(inp, bot = None): ".tv_last -- gets the most recently aired episode of " - episodes = get_episodes_for_series(inp) + + api_key = bot.config["api_keys"]["tvdb"] + episodes = get_episodes_for_series(inp, api_key) if episodes["error"]: return episodes["error"]