Fixed a bug with tvdb.py

Certain series will return incomplete episode information. If the episode did
not contain a first run date, the `get_episode_info` function would return
None, but the `tv_next` and `tv_last` functions expected a tuple of three
items.
This commit is contained in:
Alex Vidal 2011-03-10 01:18:30 +08:00 committed by rmmh
parent 1bca0fa7a9
commit 5ea6135927
1 changed files with 22 additions and 12 deletions

View File

@ -99,7 +99,12 @@ def tv_next(inp):
today = datetime.date.today()
for episode in reversed(episodes):
(first_aired, airdate, episode_desc) = get_episode_info(episode)
ep_info = get_episode_info(episode)
if ep_info is None:
continue
(first_aired, airdate, episode_desc) = ep_info
if airdate > today:
next_eps = ['%s (%s)' % (first_aired, episode_desc)]
@ -137,7 +142,12 @@ def tv_last(inp):
today = datetime.date.today()
for episode in reversed(episodes):
(first_aired, airdate, episode_desc) = get_episode_info(episode)
ep_info = get_episode_info(episode)
if ep_info is None:
continue
(first_aired, airdate, episode_desc) = ep_info
if airdate < today:
#iterating in reverse order, so the first episode encountered