diff --git a/couchpotato/core/media/show/episode.py b/couchpotato/core/media/show/episode.py index 216b7ab6..e184e900 100755 --- a/couchpotato/core/media/show/episode.py +++ b/couchpotato/core/media/show/episode.py @@ -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: diff --git a/couchpotato/core/media/show/providers/info/thetvdb.py b/couchpotato/core/media/show/providers/info/thetvdb.py index b2e58d96..e57057c3 100755 --- a/couchpotato/core/media/show/providers/info/thetvdb.py +++ b/couchpotato/core/media/show/providers/info/thetvdb.py @@ -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): #