mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-16 06:15:09 -05:00
Fixed SearchFailedDownload when selecting multiple ep's as failed in displayShow
Searched for other occurrences for the search_queue.FailedQueueItem() call. Changed segment to [segment] The failedDownloadQueueItem always expects a single epObj in the segment. But when checking multiple episodes as "Failed" in displayShow, an array is provided. I've changed the queueItem to always iterate over it as an array. And i've made sure that when retry a single episode, it's also send to the queueItem as an array (with a single element). I've had to adapt the queuing functionality in webserve for this.
This commit is contained in:
parent
c65385da96
commit
a4c8c53c91
@ -67,7 +67,7 @@ class FailedProcessor(object):
|
|||||||
for episode in parsed.episode_numbers:
|
for episode in parsed.episode_numbers:
|
||||||
segment = parsed.show.getEpisode(parsed.season_number, episode)
|
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)
|
sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -245,21 +245,24 @@ class FailedQueueItem(generic_queue.QueueItem):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
generic_queue.QueueItem.run(self)
|
generic_queue.QueueItem.run(self)
|
||||||
|
self.started = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logger.log(u"Marking episode as bad: [" + self.segment.prettyName() + "]")
|
for epObj in self.segment:
|
||||||
self.started = True
|
|
||||||
failed_history.markFailed(self.segment)
|
|
||||||
|
|
||||||
(release, provider) = failed_history.findRelease(self.segment)
|
logger.log(u"Marking episode as bad: [" + epObj.prettyName() + "]")
|
||||||
if release:
|
|
||||||
failed_history.logFailed(release)
|
|
||||||
history.logFailed(self.segment, release, provider)
|
|
||||||
|
|
||||||
failed_history.revertEpisode(self.segment)
|
failed_history.markFailed(epObj)
|
||||||
logger.log("Beginning failed download search for: [" + self.segment.prettyName() + "]")
|
|
||||||
|
|
||||||
searchResult = search.searchProviders(self.show, [self.segment], True)
|
(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() + "]")
|
||||||
|
|
||||||
|
searchResult = search.searchProviders(self.show, self.segment, True)
|
||||||
|
|
||||||
if searchResult:
|
if searchResult:
|
||||||
for result in searchResult:
|
for result in searchResult:
|
||||||
@ -270,7 +273,8 @@ class FailedQueueItem(generic_queue.QueueItem):
|
|||||||
# give the CPU a break
|
# give the CPU a break
|
||||||
time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])
|
time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])
|
||||||
else:
|
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:
|
except Exception:
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||||
|
|
||||||
|
@ -4204,7 +4204,7 @@ class Home(MainHandler):
|
|||||||
msg = "Retrying Search was automatically started for the following season of <b>" + showObj.name + "</b>:<br />"
|
msg = "Retrying Search was automatically started for the following season of <b>" + showObj.name + "</b>:<br />"
|
||||||
|
|
||||||
for season, segment in segments.items():
|
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
|
sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item) # @UndefinedVariable
|
||||||
|
|
||||||
msg += "<li>Season " + str(season) + "</li>"
|
msg += "<li>Season " + str(season) + "</li>"
|
||||||
@ -4358,20 +4358,28 @@ class Home(MainHandler):
|
|||||||
if currentManualSearchThreadsQueued:
|
if currentManualSearchThreadsQueued:
|
||||||
for searchThread in currentManualSearchThreadsQueued:
|
for searchThread in currentManualSearchThreadsQueued:
|
||||||
searchstatus = 'queued'
|
searchstatus = 'queued'
|
||||||
|
if isinstance(searchThread, sickbeard.search_queue.ManualSearchQueueItem):
|
||||||
episodes.append({'episode': searchThread.segment.episode,
|
episodes.append({'episode': searchThread.segment.episode,
|
||||||
'episodeindexid': searchThread.segment.indexerid,
|
'episodeindexid': searchThread.segment.indexerid,
|
||||||
'season' : searchThread.segment.season,
|
'season' : searchThread.segment.season,
|
||||||
'searchstatus' : searchstatus,
|
'searchstatus' : searchstatus,
|
||||||
'status' : statusStrings[searchThread.segment.status],
|
'status' : statusStrings[searchThread.segment.status],
|
||||||
'quality': self.getQualityClass(searchThread.segment)})
|
'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:
|
if currentManualSearchThreadActive:
|
||||||
searchThread = currentManualSearchThreadActive
|
searchThread = currentManualSearchThreadActive
|
||||||
searchstatus = 'searching'
|
searchstatus = 'searching'
|
||||||
if searchThread.success:
|
if searchThread.success:
|
||||||
searchstatus = 'finished'
|
searchstatus = 'finished'
|
||||||
episodes.append({'episode': searchThread.segment.episode,
|
episodes.append({'episode': searchThread.segment.episode,
|
||||||
'episodeindexid': searchThread.segment.indexerid,
|
'episodeindexid': searchThread.segment.indexerid,
|
||||||
'season' : searchThread.segment.season,
|
'season' : searchThread.segment.season,
|
||||||
'searchstatus' : searchstatus,
|
'searchstatus' : searchstatus,
|
||||||
@ -4380,14 +4388,27 @@ class Home(MainHandler):
|
|||||||
|
|
||||||
if finishedManualSearchThreadItems:
|
if finishedManualSearchThreadItems:
|
||||||
for searchThread in finishedManualSearchThreadItems:
|
for searchThread in finishedManualSearchThreadItems:
|
||||||
if str(searchThread.show.indexerid) == show and not [x for x in episodes if x['episodeindexid'] == searchThread.segment.indexerid]:
|
if isinstance(searchThread, sickbeard.search_queue.ManualSearchQueueItem):
|
||||||
searchstatus = 'finished'
|
if str(searchThread.show.indexerid) == show and not [x for x in episodes if x['episodeindexid'] == searchThread.segment.indexerid]:
|
||||||
episodes.append({'episode': searchThread.segment.episode,
|
searchstatus = 'finished'
|
||||||
'episodeindexid': searchThread.segment.indexerid,
|
episodes.append({'episode': searchThread.segment.episode,
|
||||||
'season' : searchThread.segment.season,
|
'episodeindexid': searchThread.segment.indexerid,
|
||||||
'searchstatus' : searchstatus,
|
'season' : searchThread.segment.season,
|
||||||
'status' : statusStrings[searchThread.segment.status],
|
'searchstatus' : searchstatus,
|
||||||
'quality': self.getQualityClass(searchThread.segment)})
|
'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})
|
return json.dumps({'show': show, 'episodes' : episodes})
|
||||||
|
|
||||||
@ -4514,7 +4535,7 @@ class Home(MainHandler):
|
|||||||
return json.dumps({'result': 'failure'})
|
return json.dumps({'result': 'failure'})
|
||||||
|
|
||||||
# make a queue item for it and put it on the queue
|
# 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
|
sickbeard.searchQueueScheduler.action.add_item(ep_queue_item) # @UndefinedVariable
|
||||||
|
|
||||||
if ep_queue_item.success:
|
if ep_queue_item.success:
|
||||||
|
Loading…
Reference in New Issue
Block a user