Correctly sets episodes past current date to UNAIRED if episode status is set to SKIPPED or WANTED so that manually snatched pre-release episodes do not get effected.

This commit is contained in:
echel0n 2014-05-20 12:24:20 -07:00
parent 3517952536
commit 9914523f64

View file

@ -130,16 +130,15 @@ class MainSanityCheck(db.DBSanityCheck):
curDate = datetime.date.today()
sqlResults = self.connection.select(
"SELECT episode_id, showid FROM tv_episodes WHERE airdate > ? AND status not in (?,?,?,?,?)",
[curDate.toordinal(), common.UNAIRED, common.DOWNLOADED, common.SNATCHED, common.SNATCHED_PROPER,
common.SNATCHED_BEST])
"SELECT episode_id, showid FROM tv_episodes WHERE airdate > ? AND status in (?,?)",
[curDate.toordinal(), common.SKIPPED, common.WANTED])
for cur_orphan in sqlResults:
logger.log(u"UNAIRED episode detected! episode_id: " + str(cur_orphan["episode_id"]) + " showid: " + str(
cur_orphan["showid"]), logger.DEBUG)
logger.log(u"Fixing unaired episode status with episode_id: " + str(cur_orphan["episode_id"]))
for cur_unaired in sqlResults:
logger.log(u"UNAIRED episode detected! episode_id: " + str(cur_unaired["episode_id"]) + " showid: " + str(
cur_unaired["showid"]), logger.DEBUG)
logger.log(u"Fixing unaired episode status with episode_id: " + str(cur_unaired["episode_id"]))
self.connection.action("UPDATE tv_episodes SET status = ? WHERE episode_id = ?",
[common.UNAIRED, cur_orphan["episode_id"]])
[common.UNAIRED, cur_unaired["episode_id"]])
else:
logger.log(u"No UNAIRED episodes, check passed")