[TV] Fixed episode info updates

This commit is contained in:
Dean Gardiner
2014-07-26 22:31:58 +12:00
parent 0f434afd33
commit 5f2dd0aac3
2 changed files with 22 additions and 6 deletions
+10 -1
View File
@@ -63,7 +63,16 @@ class Episode(MediaBase):
# Get new info # Get new info
if not info: if not info:
info = fireEvent('episode.info', episode.get('identifiers'), merge = True) season = db.get('id', episode['parent_id'])
show = db.get('id', season['parent_id'])
info = fireEvent(
'episode.info', show.get('identifiers'), {
'season_identifier': season.get('info', {}).get('number'),
'episode_identifier': episode.get('identifiers')
},
merge = True
)
# Update/create media # Update/create media
if force: if force:
@@ -172,15 +172,16 @@ class TheTVDb(ShowProvider):
"""Either return a list of all episodes or a single episode. """Either return a list of all episodes or a single episode.
If episode_identifer contains an episode number to search for If episode_identifer contains an episode number to search for
""" """
season_identifier = params.get('season_identifier', None) season_identifier = self.getIdentifier(params.get('season_identifier', None))
episode_identifier = params.get('episode_identifier', None) episode_identifier = self.getIdentifier(params.get('episode_identifier', None))
identifier = self.getIdentifier(identifier)
if not identifier and season_identifier is None: if not identifier and season_identifier is None:
return False return False
# season_identifier must contain the 'show id : season number' since there is no tvdb id # season_identifier must contain the 'show id : season number' since there is no tvdb id
# for season and we need a reference to both the show id and season number # for season and we need a reference to both the show id and season number
if season_identifier: if not identifier and season_identifier:
try: try:
identifier, season_identifier = season_identifier.split(':') identifier, season_identifier = season_identifier.split(':')
season_identifier = int(season_identifier) season_identifier = int(season_identifier)
@@ -205,15 +206,21 @@ class TheTVDb(ShowProvider):
for episode in season.values(): for episode in season.values():
if episode_identifier is not None and episode['id'] == toUnicode(episode_identifier): if episode_identifier is not None and episode['id'] == toUnicode(episode_identifier):
result = self._parseEpisode(show, episode) result = self._parseEpisode(episode)
self.setCache(cache_key, result) self.setCache(cache_key, result)
return result return result
else: else:
result.append(self._parseEpisode(show, episode)) result.append(self._parseEpisode(episode))
self.setCache(cache_key, result) self.setCache(cache_key, result)
return result return result
def getIdentifier(self, value):
if type(value) is dict:
return value.get('thetvdb')
return value
def _parseShow(self, show): def _parseShow(self, show):
# #