1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 03:22:22 -05:00

Bugfix in failed handler

This commit is contained in:
echel0n 2014-03-19 01:34:46 -07:00
parent c0dedd080f
commit 31a63d41aa

View File

@ -23,9 +23,10 @@ import datetime
from sickbeard import db from sickbeard import db
from sickbeard import logger from sickbeard import logger
from sickbeard import common
from sickbeard import exceptions from sickbeard import exceptions
from sickbeard.history import dateFormat from sickbeard.history import dateFormat
from sickbeard.common import Quality
from sickbeard.common import WANTED, FAILED
def _log_helper(message, level=logger.MESSAGE): def _log_helper(message, level=logger.MESSAGE):
@ -133,7 +134,7 @@ def revertEpisodes(show_obj, season, episodes):
ep_obj.status = history_eps[cur_episode]['old_status'] ep_obj.status = history_eps[cur_episode]['old_status']
else: else:
log_str += _log_helper(u"WARNING: Episode not found in history. Setting it back to WANTED", logger.WARNING) log_str += _log_helper(u"WARNING: Episode not found in history. Setting it back to WANTED", logger.WARNING)
ep_obj.status = common.WANTED ep_obj.status = WANTED
ep_obj.saveToDB() ep_obj.saveToDB()
else: else:
@ -147,7 +148,7 @@ def revertEpisodes(show_obj, season, episodes):
ep_obj.status = history_eps[ep_obj]['old_status'] ep_obj.status = history_eps[ep_obj]['old_status']
else: else:
log_str += _log_helper(u"WARNING: Episode not found in history. Setting it back to WANTED", logger.WARNING) log_str += _log_helper(u"WARNING: Episode not found in history. Setting it back to WANTED", logger.WARNING)
ep_obj.status = common.WANTED ep_obj.status = WANTED
ep_obj.saveToDB() ep_obj.saveToDB()
@ -163,13 +164,15 @@ def markFailed(show_obj, season, episodes):
continue continue
with ep_obj.lock: with ep_obj.lock:
ep_obj.status = common.FAILED quality = Quality.splitCompositeStatus(ep_obj.status)[1]
ep_obj.status = Quality.compositeStatus(FAILED, quality)
ep_obj.saveToDB() ep_obj.saveToDB()
else: else:
# Whole season # Whole season
for ep_obj in show_obj.getAllEpisodes(season): for ep_obj in show_obj.getAllEpisodes(season):
with ep_obj.lock: with ep_obj.lock:
ep_obj.status = common.FAILED quality = Quality.splitCompositeStatus(ep_obj.status)[1]
ep_obj.status = Quality.compositeStatus(FAILED, quality)
ep_obj.saveToDB() ep_obj.saveToDB()
return log_str return log_str