diff --git a/sickbeard/failedProcessor.py b/sickbeard/failedProcessor.py index 586c5aed..b66f9be2 100644 --- a/sickbeard/failedProcessor.py +++ b/sickbeard/failedProcessor.py @@ -67,7 +67,7 @@ class FailedProcessor(object): for episode in parsed.episode_numbers: segment = parsed.show.getEpisode(parsed.season_number, episode) - cur_failed_queue_item = search_queue.FailedQueueItem(parsed.show, segment) + cur_failed_queue_item = search_queue.FailedQueueItem(parsed.show, [segment]) sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item) return True diff --git a/sickbeard/search_queue.py b/sickbeard/search_queue.py index 6d196258..34bdcf8e 100644 --- a/sickbeard/search_queue.py +++ b/sickbeard/search_queue.py @@ -245,21 +245,24 @@ class FailedQueueItem(generic_queue.QueueItem): def run(self): generic_queue.QueueItem.run(self) - + self.started = True + try: - logger.log(u"Marking episode as bad: [" + self.segment.prettyName() + "]") - self.started = True - failed_history.markFailed(self.segment) + for epObj in self.segment: + + logger.log(u"Marking episode as bad: [" + epObj.prettyName() + "]") + + failed_history.markFailed(epObj) + + (release, provider) = failed_history.findRelease(epObj) + if release: + failed_history.logFailed(release) + history.logFailed(epObj, release, provider) + + failed_history.revertEpisode(epObj) + logger.log("Beginning failed download search for: [" + epObj.prettyName() + "]") - (release, provider) = failed_history.findRelease(self.segment) - if release: - failed_history.logFailed(release) - history.logFailed(self.segment, release, provider) - - failed_history.revertEpisode(self.segment) - logger.log("Beginning failed download search for: [" + self.segment.prettyName() + "]") - - searchResult = search.searchProviders(self.show, [self.segment], True) + searchResult = search.searchProviders(self.show, self.segment, True) if searchResult: for result in searchResult: @@ -270,7 +273,8 @@ class FailedQueueItem(generic_queue.QueueItem): # give the CPU a break time.sleep(common.cpu_presets[sickbeard.CPU_PRESET]) else: - logger.log(u"No valid episode found to retry for: [" + self.segment.prettyName() + "]") + pass + #logger.log(u"No valid episode found to retry for: [" + self.segment.prettyName() + "]") except Exception: logger.log(traceback.format_exc(), logger.DEBUG) diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 11e08e89..3ae7792f 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -4204,7 +4204,7 @@ class Home(MainHandler): msg = "Retrying Search was automatically started for the following season of " + showObj.name + ":
" for season, segment in segments.items(): - cur_failed_queue_item = search_queue.FailedQueueItem(showObj, segment) + cur_failed_queue_item = search_queue.FailedQueueItem(showObj, [segment]) sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item) # @UndefinedVariable msg += "
  • Season " + str(season) + "
  • " @@ -4358,36 +4358,59 @@ class Home(MainHandler): if currentManualSearchThreadsQueued: for searchThread in currentManualSearchThreadsQueued: searchstatus = 'queued' - - episodes.append({'episode': searchThread.segment.episode, - 'episodeindexid': searchThread.segment.indexerid, - 'season' : searchThread.segment.season, - 'searchstatus' : searchstatus, - 'status' : statusStrings[searchThread.segment.status], - 'quality': self.getQualityClass(searchThread.segment)}) + if isinstance(searchThread, sickbeard.search_queue.ManualSearchQueueItem): + episodes.append({'episode': searchThread.segment.episode, + 'episodeindexid': searchThread.segment.indexerid, + 'season' : searchThread.segment.season, + 'searchstatus' : searchstatus, + 'status' : statusStrings[searchThread.segment.status], + 'quality': self.getQualityClass(searchThread.segment)}) + else: + for epObj in searchThread.segment: + episodes.append({'episode': epObj.episode, + 'episodeindexid': epObj.indexerid, + 'season' : epObj.season, + 'searchstatus' : searchstatus, + 'status' : statusStrings[epObj.status], + 'quality': self.getQualityClass(epObj)}) if currentManualSearchThreadActive: searchThread = currentManualSearchThreadActive searchstatus = 'searching' if searchThread.success: searchstatus = 'finished' + else: + searchstatus = 'searching' episodes.append({'episode': searchThread.segment.episode, 'episodeindexid': searchThread.segment.indexerid, - 'season' : searchThread.segment.season, - 'searchstatus' : searchstatus, - 'status' : statusStrings[searchThread.segment.status], - 'quality': self.getQualityClass(searchThread.segment)}) - - if finishedManualSearchThreadItems: - for searchThread in finishedManualSearchThreadItems: - if str(searchThread.show.indexerid) == show and not [x for x in episodes if x['episodeindexid'] == searchThread.segment.indexerid]: - searchstatus = 'finished' - episodes.append({'episode': searchThread.segment.episode, - 'episodeindexid': searchThread.segment.indexerid, 'season' : searchThread.segment.season, 'searchstatus' : searchstatus, 'status' : statusStrings[searchThread.segment.status], 'quality': self.getQualityClass(searchThread.segment)}) + + if finishedManualSearchThreadItems: + for searchThread in finishedManualSearchThreadItems: + if isinstance(searchThread, sickbeard.search_queue.ManualSearchQueueItem): + if str(searchThread.show.indexerid) == show and not [x for x in episodes if x['episodeindexid'] == searchThread.segment.indexerid]: + searchstatus = 'finished' + episodes.append({'episode': searchThread.segment.episode, + 'episodeindexid': searchThread.segment.indexerid, + 'season' : searchThread.segment.season, + 'searchstatus' : searchstatus, + 'status' : statusStrings[searchThread.segment.status], + 'quality': self.getQualityClass(searchThread.segment)}) + else: + ### These are only Failed Downloads/Retry SearchThreadItems.. lets loop through the segement/episodes + if str(searchThread.show.indexerid) == show: + for epObj in searchThread.segment: + if not [x for x in episodes if x['episodeindexid'] == epObj.indexerid]: + searchstatus = 'finished' + episodes.append({'episode': epObj.episode, + 'episodeindexid': epObj.indexerid, + 'season' : epObj.season, + 'searchstatus' : searchstatus, + 'status' : statusStrings[epObj.status], + 'quality': self.getQualityClass(epObj)}) return json.dumps({'show': show, 'episodes' : episodes}) @@ -4514,7 +4537,7 @@ class Home(MainHandler): return json.dumps({'result': 'failure'}) # make a queue item for it and put it on the queue - ep_queue_item = search_queue.FailedQueueItem(ep_obj.show, ep_obj) + ep_queue_item = search_queue.FailedQueueItem(ep_obj.show, [ep_obj]) sickbeard.searchQueueScheduler.action.add_item(ep_queue_item) # @UndefinedVariable if ep_queue_item.success: