diff --git a/libsickbeard.py b/libsickbeard.py index d64bdde..994fd55 100644 --- a/libsickbeard.py +++ b/libsickbeard.py @@ -49,6 +49,14 @@ class Sickbeard: return (season, episode, episodeResult['data']['name']) return None + + def FindEpisodeName(self, showId, season, episode): + jsonurl = urlopen("{0}?cmd=episode&tvdbid={1}&season={2}&episode={3}".format(self.__GetApiURL(), showId, int(season), int(episode))) + result = json.loads(jsonurl.read()) + if result['result'] == 'error': + return "" + else: + return result['data']['name'] def FindEpisode(self, showId, name=None, description=None): jsonurl = urlopen("{0}?cmd=show.seasons&tvdbid={1}".format(self.__GetApiURL(), showId)) diff --git a/libtvdatasource.py b/libtvdatasource.py index 31e3343..f68364a 100644 --- a/libtvdatasource.py +++ b/libtvdatasource.py @@ -81,10 +81,13 @@ class TVData: show.season = str(result[0]) show.episode = str(result[1]) show.subtitle = result[2] + + if show.subtitle is None or show.subtitle == "": + show.subtitle = sickbeard.FindEpisodeName(showId, show.season, show.episode) #if show.season != "0" and show.episode != "0": - show.season = self.FixEpisodeSeasonNumber(show.season) - show.episode = self.FixEpisodeSeasonNumber(show.episode) + show.season = self.FixEpisodeSeasonNumber(show.season) + show.episode = self.FixEpisodeSeasonNumber(show.episode) seasonFolder = "Season {0}".format(show.season) season = "S{0}".format(show.season) diff --git a/tests/libsickbeardtest.py b/tests/libsickbeardtest.py index 3b0ee68..0776083 100644 --- a/tests/libsickbeardtest.py +++ b/tests/libsickbeardtest.py @@ -4,4 +4,3 @@ Created on Fri Jul 5 14:12:38 2013 @author: shanef """ -