From 581c4daca2dc42e771fac5c54eaa6dee870f9319 Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 10 Mar 2014 05:18:04 -0700 Subject: [PATCH] Automaticly determins the indexer for auto post-processing of shows. this should fix any other issues that were present with post processing --- sickbeard/postProcessor.py | 18 ++++++++++++++++-- sickbeard/tv.py | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index e7aa06cf..e548284f 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -602,6 +602,7 @@ class PostProcessor(object): try: showObj = helpers.findCertainShow(sickbeard.showList, indexer_id) if(showObj != None): + self.indexer = showObj.indexer indexer_lang = showObj.lang except exceptions.MultipleShowObjectsException: raise #TODO: later I'll just log this, for now I want to know about it ASAP @@ -825,8 +826,21 @@ class PostProcessor(object): # if we don't have it then give up if not indexer_id or season == None or not episodes: - self._log(u"Can't find show id from " + self.indexer + " or season or episode, skipping", logger.WARNING) - return False + if 'Tvdb' in self.indexer: + self._log(u"Can't find show id from " + self.indexer + " or season or episode, trying other indexer", logger.WARNING) + self.indexer = 'TVRage' + else: + self._log(u"Can't find show id from " + self.indexer + " or season or episode, trying other indexer", logger.WARNING) + self.indexer = 'Tvdb' + + sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer + + # try to find the file info with a different indexer + (indexer_id, season, episodes) = self._find_info() + + if not indexer_id or season == None or not episodes: + self._log(u"Can't find show id from ANY of the indexers or season or episode, skipping", logger.WARNING) + return False # retrieve/create the corresponding TVEpisode objects ep_obj = self._get_ep_obj(indexer_id, season, episodes) diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 1d99b443..0725e215 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -1938,10 +1938,10 @@ class TVEpisode(object): logger.log(str(self.indexerid) + u": File " + self.location + " is already named correctly, skipping", logger.DEBUG) return - related_files = postProcessor.PostProcessor(self.location).list_associated_files(self.location) + related_files = postProcessor.PostProcessor(self.location, indexer=self.indexer).list_associated_files(self.location) if self.show.subtitles and sickbeard.SUBTITLES_DIR != '': - related_subs = postProcessor.PostProcessor(self.location).list_associated_files(sickbeard.SUBTITLES_DIR, subtitles_only=True) + related_subs = postProcessor.PostProcessor(self.location, indexer=self.indexer).list_associated_files(sickbeard.SUBTITLES_DIR, subtitles_only=True) absolute_proper_subs_path = ek.ek(os.path.join, sickbeard.SUBTITLES_DIR, self.formatted_filename()) logger.log(u"Files associated to " + self.location + ": " + str(related_files), logger.DEBUG)