1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

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) logger.WARNING)
raise exceptions.FailedProcessingFailed() raise exceptions.FailedProcessingFailed()
episodes = [] segment = {parsed.season_number:[]}
for episode in parsed.episode_numbers: for episode in parsed.episode_numbers:
epObj = self._show_obj.getEpisode(parsed.season_number, episode) 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) sickbeard.searchQueueScheduler.action.add_item(cur_failed_queue_item)
return True return True

View File

@ -101,6 +101,9 @@ class BacklogSearcher:
if len(segments): if len(segments):
backlog_queue_item = search_queue.BacklogQueueItem(curShow, segments) backlog_queue_item = search_queue.BacklogQueueItem(curShow, segments)
sickbeard.searchQueueScheduler.action.add_item(backlog_queue_item) #@UndefinedVariable 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 # don't consider this an actual backlog search if we only did recent eps
# or if we only did certain shows # or if we only did certain shows
@ -132,6 +135,8 @@ class BacklogSearcher:
def _get_segments(self, show, fromDate): def _get_segments(self, show, fromDate):
anyQualities, bestQualities = common.Quality.splitQuality(show.quality) #@UnusedVariable anyQualities, bestQualities = common.Quality.splitQuality(show.quality) #@UnusedVariable
logger.log(u"Seeing if we need anything from " + show.name)
myDB = db.DBConnection() myDB = db.DBConnection()
if show.air_by_date: if show.air_by_date:
sqlResults = myDB.select( 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 generic_queue, scheduler
from sickbeard import search, failed_history, history from sickbeard import search, failed_history, history
from sickbeard import ui from sickbeard import ui
from sickbeard import searchBacklog
search_queue_lock = threading.Lock() search_queue_lock = threading.Lock()
@ -127,6 +128,8 @@ class BacklogQueueItem(generic_queue.QueueItem):
generic_queue.QueueItem.execute(self) generic_queue.QueueItem.execute(self)
for season in self.segment: for season in self.segment:
searchBacklog.BacklogSearcher.currentSearchInfo = {'title': self.show.name + " Season " + str(season)}
wantedEps = self.segment[season] wantedEps = self.segment[season]
# check if we want to search for season packs instead of just season/episode # check if we want to search for season packs instead of just season/episode

View File

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