From 9914523f643813e5ca62553804245b0fc2862757 Mon Sep 17 00:00:00 2001 From: echel0n Date: Tue, 20 May 2014 12:24:20 -0700 Subject: [PATCH] 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. --- sickbeard/databases/mainDB.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sickbeard/databases/mainDB.py b/sickbeard/databases/mainDB.py index 5daf5026..6b5a5952 100644 --- a/sickbeard/databases/mainDB.py +++ b/sickbeard/databases/mainDB.py @@ -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")