Skip to content

Commit

Permalink
Make tvmaze the default .ep command, old one is .tvdb now
Browse files Browse the repository at this point in the history
  • Loading branch information
lepinkainen committed Jan 4, 2016
1 parent 9f30a71 commit 3d1512e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions pyfibot/modules/module_thetvdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def selectSeries(self, allSeries):
print(api['house of cards']) # House of Cards (US)


def command_ep(bot, user, channel, args):
"""Usage: ep <series name>"""
def command_tvdb(bot, user, channel, args):
"""Usage: tvdb <series name>"""

if not api_ok:
return

t = tvdb_api.Tvdb(custom_ui=SmartUI)
now = datetime.now()
# one day resolution maximum
Expand Down
12 changes: 9 additions & 3 deletions pyfibot/modules/module_tvmaze.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
import pytz
from datetime import datetime

def command_ep(bot, user, channel, args):
"""Usage: ep <series name>"""
return command_maze(bot, user, channel, args)

def command_maze(bot, user, channel, args):

try:
show = pytvmaze.get_show(show_name=args, embed='episodes')
except pytvmaze.exceptions.ShowNotFound:
print("Show '%s' not found" % args)
bot.say(channel, "Show '%s' not found" % args)
return

next_episode = None
next_delta = None
Expand All @@ -25,7 +31,7 @@ def command_maze(bot, user, channel, args):
if delta.months <= 0 and \
delta.days <= 0 and \
delta.minutes <= 0:
break
break
else:
# episode is (still) in the future
next_episode = episode
Expand All @@ -46,7 +52,7 @@ def command_maze(bot, user, channel, args):
show_id = "%s %s '%s'" % (show.name, "%dx%02d" % (next_episode.season_number, next_episode.episode_number), next_episode.title)

if show.status == "Ended":
msg = "Latest episode of %s aired on %s (%s ago) on %s" % (show_id, next_episode.airdate, _ago(latest_delta), show.network['name'])
msg = "Latest episode of %s aired on %s (%s ago) on %s [Ended]" % (show_id, next_episode.airdate, _ago(latest_delta), show.network['name'])
else:
msg = "Next episode of %s airs %s (%s) on %s" % (show_id, next_episode.airdate, _ago(next_delta), show.network['name'])

Expand Down

0 comments on commit 3d1512e

Please sign in to comment.