Fixed potential backlog issues.

Fixed potential failed download item issues.
Added in more detailed logging for backlogs.
This commit is contained in:
echel0n 2014-05-15 21:55:56 -07:00
parent b0f1f2c91e
commit a6d30ac425
4 changed files with 29 additions and 20 deletions

View file

@ -75,12 +75,12 @@ class FailedProcessor(object):
logger.WARNING)
raise exceptions.FailedProcessingFailed()
episodes = []
segment = {parsed.season_number:[]}
for episode in parsed.episode_numbers:
epObj = self._show_obj.getEpisode(parsed.season_number, episode)
episodes.append(epObj)
segment[parsed.season_number].append(epObj)
cur_failed_queue_item = search_queue.FailedQueueItem(self._show_obj, episodes)
cur_failed_queue_item = search_queue.FailedQueueItem(self._show_obj, segment)
sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item)
return True

View file

@ -101,6 +101,9 @@ class BacklogSearcher:
if len(segments):
backlog_queue_item = search_queue.BacklogQueueItem(curShow, segments)
sickbeard.searchQueueScheduler.action.add_item(backlog_queue_item) #@UndefinedVariable
else:
logger.log(u"Nothing needs to be downloaded for " + str(curShow.name) + ", skipping this season",
logger.DEBUG)
# don't consider this an actual backlog search if we only did recent eps
# or if we only did certain shows
@ -132,6 +135,8 @@ class BacklogSearcher:
def _get_segments(self, show, fromDate):
anyQualities, bestQualities = common.Quality.splitQuality(show.quality) #@UnusedVariable
logger.log(u"Seeing if we need anything from " + show.name)
myDB = db.DBConnection()
if show.air_by_date:
sqlResults = myDB.select(

View file

@ -27,6 +27,7 @@ from sickbeard import db, logger, common, exceptions, helpers
from sickbeard import generic_queue, scheduler
from sickbeard import search, failed_history, history
from sickbeard import ui
from sickbeard import searchBacklog
search_queue_lock = threading.Lock()
@ -127,6 +128,8 @@ class BacklogQueueItem(generic_queue.QueueItem):
generic_queue.QueueItem.execute(self)
for season in self.segment:
searchBacklog.BacklogSearcher.currentSearchInfo = {'title': self.show.name + " Season " + str(season)}
wantedEps = self.segment[season]
# check if we want to search for season packs instead of just season/episode

View file

@ -3227,8 +3227,7 @@ class Home:
else:
return _genericMessage("Error", errMsg)
segments = {}
segment = {}
if eps is not None:
sql_l = []
@ -3245,10 +3244,10 @@ class Home:
if int(status) in [WANTED, FAILED]:
# figure out what episodes are wanted so we can backlog them
if epObj in segments:
segments[epObj.season].append(epObj)
if epObj.season in segment:
segment[epObj.season].append(epObj)
else:
segments[epObj.season] = [epObj]
segment[epObj.season] = [epObj]
with epObj.lock:
# don't let them mess up UNAIRED episodes
@ -3283,28 +3282,30 @@ class Home:
if int(status) == WANTED:
msg = "Backlog was automatically started for the following seasons of <b>" + showObj.name + "</b>:<br />"
for cur_segment in segments:
msg += "<li>Season " + str(cur_segment) + "</li>"
for season in segment:
msg += "<li>Season " + str(season) + "</li>"
logger.log(u"Sending backlog for " + showObj.name + " season " + str(
cur_segment) + " because some eps were set to wanted")
cur_backlog_queue_item = search_queue.BacklogQueueItem(showObj, cur_segment)
sickbeard.searchQueueScheduler.action.add_item(cur_backlog_queue_item) # @UndefinedVariable
season) + " because some eps were set to wanted")
msg += "</ul>"
if segments:
cur_backlog_queue_item = search_queue.BacklogQueueItem(showObj, segment)
sickbeard.searchQueueScheduler.action.add_item(cur_backlog_queue_item) # @UndefinedVariable
if segment:
ui.notifications.message("Backlog started", msg)
if int(status) == FAILED:
msg = "Retrying Search was automatically started for the following season of <b>" + showObj.name + "</b>:<br />"
for cur_segment in segments:
msg += "<li>Season " + str(cur_segment) + "</li>"
for season in segment:
msg += "<li>Season " + str(season) + "</li>"
logger.log(u"Retrying Search for " + showObj.name + " season " + str(
cur_segment) + " because some eps were set to failed")
cur_failed_queue_item = search_queue.FailedQueueItem(showObj, cur_segment)
sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item) # @UndefinedVariable
season) + " because some eps were set to failed")
msg += "</ul>"
if segments:
cur_failed_queue_item = search_queue.FailedQueueItem(showObj, segment)
sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item) # @UndefinedVariable
if segment:
ui.notifications.message("Retry Search started", msg)
if direct: