[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
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
if force:
@@ -172,15 +172,16 @@ class TheTVDb(ShowProvider):
"""Either return a list of all episodes or a single episode.
If episode_identifer contains an episode number to search for
"""
season_identifier = params.get('season_identifier', None)
episode_identifier = params.get('episode_identifier', None)
season_identifier = self.getIdentifier(params.get('season_identifier', None))
episode_identifier = self.getIdentifier(params.get('episode_identifier', None))
identifier = self.getIdentifier(identifier)
if not identifier and season_identifier is None:
return False
# 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
if season_identifier:
if not identifier and season_identifier:
try:
identifier, season_identifier = season_identifier.split(':')
season_identifier = int(season_identifier)
@@ -205,15 +206,21 @@ class TheTVDb(ShowProvider):
for episode in season.values():
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)
return result
else:
result.append(self._parseEpisode(show, episode))
result.append(self._parseEpisode(episode))
self.setCache(cache_key, result)
return result
def getIdentifier(self, value):
if type(value) is dict:
return value.get('thetvdb')
return value
def _parseShow(self, show):
#