mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-15 17:17:43 +00:00
Fixes issues with episodes that have been set to a WANTED status but have a airdate in the future past current date.
Fixes issues with daily search so it only searches for shows between 1 week ago and current date.
This commit is contained in:
parent
1f55b11b7d
commit
1195e07f7b
2 changed files with 19 additions and 1 deletions
|
@ -58,7 +58,7 @@ class DailySearcher():
|
||||||
toDate = datetime.date.today()
|
toDate = datetime.date.today()
|
||||||
|
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
sqlResults = myDB.select("SELECT * FROM tv_episodes WHERE status in (?,?) AND airdate >= ? AND airdate < ?",
|
sqlResults = myDB.select("SELECT * FROM tv_episodes WHERE status in (?,?) AND airdate >= ? AND airdate =< ?",
|
||||||
[common.UNAIRED, common.WANTED, fromDate.toordinal(), toDate.toordinal()])
|
[common.UNAIRED, common.WANTED, fromDate.toordinal(), toDate.toordinal()])
|
||||||
|
|
||||||
todaysEps = {}
|
todaysEps = {}
|
||||||
|
|
|
@ -35,6 +35,7 @@ class MainSanityCheck(db.DBSanityCheck):
|
||||||
self.fix_duplicate_shows()
|
self.fix_duplicate_shows()
|
||||||
self.fix_duplicate_episodes()
|
self.fix_duplicate_episodes()
|
||||||
self.fix_orphan_episodes()
|
self.fix_orphan_episodes()
|
||||||
|
self.fix_unaired_episodes()
|
||||||
|
|
||||||
def fix_duplicate_shows(self, column='indexer_id'):
|
def fix_duplicate_shows(self, column='indexer_id'):
|
||||||
|
|
||||||
|
@ -123,6 +124,23 @@ class MainSanityCheck(db.DBSanityCheck):
|
||||||
logger.log(u"Missing idx_sta_epi_sta_air for TV Episodes table detected!, fixing...")
|
logger.log(u"Missing idx_sta_epi_sta_air for TV Episodes table detected!, fixing...")
|
||||||
self.connection.action("CREATE INDEX idx_sta_epi_sta_air ON tv_episodes (season,episode, status, airdate)")
|
self.connection.action("CREATE INDEX idx_sta_epi_sta_air ON tv_episodes (season,episode, status, airdate)")
|
||||||
|
|
||||||
|
def fix_unaired_episodes(self):
|
||||||
|
|
||||||
|
curDate = datetime.date.today()
|
||||||
|
|
||||||
|
sqlResults = self.connection.select(
|
||||||
|
"SELECT episode_id, showid FROM tv_episodes WHERE airdate > ? ", [curDate.toordinal()])
|
||||||
|
|
||||||
|
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"]))
|
||||||
|
self.connection.action("UPDATE tv_episodes SET status = ? WHERE episode_id = ?", [common.UNAIRED, cur_orphan["episode_id"]])
|
||||||
|
|
||||||
|
else:
|
||||||
|
logger.log(u"No UNAIRED episodes, check passed")
|
||||||
|
|
||||||
|
|
||||||
def backupDatabase(version):
|
def backupDatabase(version):
|
||||||
logger.log(u"Backing up database before upgrade")
|
logger.log(u"Backing up database before upgrade")
|
||||||
if not helpers.backupVersionedFile(db.dbFilename(), version):
|
if not helpers.backupVersionedFile(db.dbFilename(), version):
|
||||||
|
|
Loading…
Reference in a new issue