Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: 404 Client Error: Not Found for url: https://api.thetvdb.com/series/69629/episodes/query?airedSeason=1&page=1

### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.9.35-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.9`
**Commit**: pymedusa/Medusa@52a946339926c31010f794da5f5858fecc5f5b1d
**Link to Log**: https://gist.github.com/a01297183fdfd1d174c7d1975479aa10
### ERROR
<pre>
2018-01-19 02:11:55 ERROR    SHOWQUEUE-REFRESH :: [52a9463] 69629: Error while refreshing show The Gifted. Error: Show episode search exception, could not get any episodes. Did a season [1] search. Exception: HTTPError
404 Client Error: Not Found for url: https://api.thetvdb.com/series/69629/episodes/query?airedSeason=1&page=1
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/show_queue.py#L628">medusa/show_queue.py</a>", line 628, in run
    self.show.refresh_dir()
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/tv/series.py#L1749">medusa/tv/series.py</a>", line 1749, in refresh_dir
    self.load_episodes_from_dir()
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/tv/series.py#L927">medusa/tv/series.py</a>", line 927, in load_episodes_from_dir
    cur_episode = self.make_ep_from_file(os.path.join(self.location, media_file))
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/tv/series.py#L1393">medusa/tv/series.py</a>", line 1393, in make_ep_from_file
    **********_ep.create_meta_files()
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/tv/episode.py#L1108">medusa/tv/episode.py</a>", line 1108, in create_meta_files
    self.__create_thumbnail(metadata_provider)
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/tv/episode.py#L1131">medusa/tv/episode.py</a>", line 1131, in __create_thumbnail
    result = metadata_provider.create_episode_thumb(self) or result
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/metadata/generic.py#L327">medusa/metadata/generic.py</a>", line 327, in create_episode_thumb
    ep_obj.set_indexer_data(season=ep_obj.season, indexer_api=self.indexer_api)
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/tv/episode.py#L679">medusa/tv/episode.py</a>", line 679, in set_indexer_data
    api._get_episodes(self.series.series_id, aired_season=season)
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/indexers/tvdbv2/tvdbv2_api.py#L222">medusa/indexers/tvdbv2/tvdbv2_api.py</a>", line 222, in _get_episodes
    episodes = self._query_series(tvdb_id, specials=specials, aired_season=aired_season, full_info=True)
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/indexers/tvdbv2/fallback.py#L110">medusa/indexers/tvdbv2/fallback.py</a>", line 110, in __call__
    return self.func(*args, **kwargs)
  File "/home/pi/Medusa/<a href="../blob/52a946339926c31010f794da5f5858fecc5f5b1d/medusa/indexers/tvdbv2/tvdbv2_api.py#L302">medusa/indexers/tvdbv2/tvdbv2_api.py</a>", line 302, in _query_series
    (search_type='full' if not aired_season else 'season {season}'.format(season=aired_season), e=e.reason)
IndexerShowIncomplete: Show episode search exception, could not get any episodes. Did a season [1] search. Exception: HTTPError
404 Client Error: Not Found for url: https://api.thetvdb.com/series/69629/episodes/query?airedSeason=1&page=1
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators



Discussion:

Resolving patch:
diff --git a/medusa/tv/episode.py b/medusa/tv/episode.py
--- a/medusa/tv/episode.py
+++ b/medusa/tv/episode.py
@@ -670,7 +670,7 @@ def set_indexer_data(self, season=None, indexer_api=None):
         if season is None:
             season = self.season
 
-        if indexer_api is None:
+        if indexer_api is None or indexer_api.indexer != self.series.indexer_api.indexer:
             api = self.series.indexer_api
         else:
             api = indexer_api


Test patch: