From a12085cbfc7bfc49e17fd47cacbe7e6a30ef76d8 Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 19 May 2014 10:53:47 -0700 Subject: [PATCH] Fxi for failed downloads --- sickbeard/failedProcessor.py | 3 +++ sickbeard/search_queue.py | 34 +++++++++++++++------------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/sickbeard/failedProcessor.py b/sickbeard/failedProcessor.py index 62043244..e126eaad 100644 --- a/sickbeard/failedProcessor.py +++ b/sickbeard/failedProcessor.py @@ -53,6 +53,7 @@ class FailedProcessor(object): raise exceptions.FailedProcessingFailed() parser = NameParser(False) + try: parsed = parser.parse(releaseName) except InvalidNameException: @@ -75,7 +76,9 @@ class FailedProcessor(object): logger.WARNING) raise exceptions.FailedProcessingFailed() + # scene -> indexer numbering parsed = parsed.convert(self._show_obj) + segment = {parsed.season_number:[]} for episode in parsed.episode_numbers: epObj = self._show_obj.getEpisode(parsed.season_number, episode) diff --git a/sickbeard/search_queue.py b/sickbeard/search_queue.py index 9a5b8774..0b8e65fd 100644 --- a/sickbeard/search_queue.py +++ b/sickbeard/search_queue.py @@ -212,7 +212,6 @@ class FailedQueueItem(generic_queue.QueueItem): def execute(self): generic_queue.QueueItem.execute(self) - failed_episodes = [] for season in self.segment: epObj = self.segment[season] @@ -223,30 +222,27 @@ class FailedQueueItem(generic_queue.QueueItem): failed_history.logFailed(release) history.logFailed(epObj, release, provider) failed_history.revertEpisode(epObj) - failed_episodes.append(epObj) logger.log( "Beginning failed download search for [" + epObj.prettyName() + "]") + try: + searchResult = search.searchProviders(self.show, season, [epObj], True) - if len(failed_episodes): - try: - searchResult = search.searchProviders(self.show, failed_episodes[0].season, failed_episodes, True) + # reset thread back to original name + threading.currentThread().name = self.thread_name - # reset thread back to original name - threading.currentThread().name = self.thread_name + if searchResult: + for result in searchResult: + # just use the first result for now + logger.log(u"Downloading " + result.name + " from " + result.provider.name) + search.snatchEpisode(result) - if searchResult: - for result in searchResult: - # just use the first result for now - logger.log(u"Downloading " + result.name + " from " + result.provider.name) - search.snatchEpisode(result) + # give the CPU a break + time.sleep(2) - # give the CPU a break - time.sleep(2) - - else: - logger.log(u"No episodes found to retry for failed downloads return from providers!") - except Exception, e: - logger.log(traceback.format_exc(), logger.DEBUG) + else: + logger.log(u"No episodes found to retry for failed downloads return from providers!") + except Exception, e: + logger.log(traceback.format_exc(), logger.DEBUG) self.finish() \ No newline at end of file