mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-17 06:45:05 -05:00
Fix for ABD and Sports shows issue with toordinal function.
This commit is contained in:
parent
39f32b3b7c
commit
e0eea79ec5
@ -267,7 +267,7 @@ class GenericProvider:
|
|||||||
# remove duplicate items
|
# remove duplicate items
|
||||||
searchItems[epObj] = itemList
|
searchItems[epObj] = itemList
|
||||||
|
|
||||||
#if we have cached results return them.
|
# if we have cached results return them.
|
||||||
if len(results):
|
if len(results):
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@ -321,11 +321,11 @@ class GenericProvider:
|
|||||||
logger.DEBUG)
|
logger.DEBUG)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
airdate = parse_result.air_date.toordinal() if parse_result.air_date else parse_result.sports_event_date.toordinal()
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
sql_results = myDB.select(
|
sql_results = myDB.select(
|
||||||
"SELECT season, episode FROM tv_episodes WHERE showid = ? AND airdate = ?",
|
"SELECT season, episode FROM tv_episodes WHERE showid = ? AND airdate = ?",
|
||||||
[show.indexerid,
|
[show.indexerid, airdate])
|
||||||
parse_result.air_date.toordinal() or parse_result.sports_event_date.toordinal()])
|
|
||||||
|
|
||||||
if len(sql_results) != 1:
|
if len(sql_results) != 1:
|
||||||
logger.log(
|
logger.log(
|
||||||
|
@ -634,7 +634,7 @@ class TVShow(object):
|
|||||||
logger.log(
|
logger.log(
|
||||||
u"Looks like this is an air-by-date or sports show, attempting to convert the date to season/episode",
|
u"Looks like this is an air-by-date or sports show, attempting to convert the date to season/episode",
|
||||||
logger.DEBUG)
|
logger.DEBUG)
|
||||||
airdate = parse_result.air_date.toordinal() or parse_result.sports_event_date.toordinal()
|
airdate = parse_result.air_date.toordinal() if parse_result.air_date else parse_result.sports_event_date.toordinal()
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
sql_result = myDB.select(
|
sql_result = myDB.select(
|
||||||
"SELECT season, episode FROM tv_episodes WHERE showid = ? and indexer = ? and airdate = ?",
|
"SELECT season, episode FROM tv_episodes WHERE showid = ? and indexer = ? and airdate = ?",
|
||||||
|
@ -52,7 +52,8 @@ class CacheDBConnection(db.DBConnection):
|
|||||||
# Create the table if it's not already there
|
# Create the table if it's not already there
|
||||||
try:
|
try:
|
||||||
if not self.hasTable(providerName):
|
if not self.hasTable(providerName):
|
||||||
self.action("CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT)")
|
self.action(
|
||||||
|
"CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT)")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
if str(e) != "table [" + providerName + "] already exists":
|
if str(e) != "table [" + providerName + "] already exists":
|
||||||
raise
|
raise
|
||||||
@ -241,7 +242,7 @@ class TVCache():
|
|||||||
|
|
||||||
def shouldUpdate(self):
|
def shouldUpdate(self):
|
||||||
# if we've updated recently then skip the update
|
# if we've updated recently then skip the update
|
||||||
#if datetime.datetime.today() - self.lastUpdate < datetime.timedelta(minutes=self.minTime):
|
# if datetime.datetime.today() - self.lastUpdate < datetime.timedelta(minutes=self.minTime):
|
||||||
# logger.log(u"Last update was too soon, using old cache: today()-" + str(self.lastUpdate) + "<" + str(
|
# logger.log(u"Last update was too soon, using old cache: today()-" + str(self.lastUpdate) + "<" + str(
|
||||||
# datetime.timedelta(minutes=self.minTime)), logger.DEBUG)
|
# datetime.timedelta(minutes=self.minTime)), logger.DEBUG)
|
||||||
# return False
|
# return False
|
||||||
@ -275,7 +276,7 @@ class TVCache():
|
|||||||
|
|
||||||
season = episodes = None
|
season = episodes = None
|
||||||
if parse_result.air_by_date or parse_result.sports:
|
if parse_result.air_by_date or parse_result.sports:
|
||||||
airdate = parse_result.air_date.toordinal() or parse_result.sports_event_date.toordinal()
|
airdate = parse_result.air_date.toordinal() if parse_result.air_date else parse_result.sports_event_date.toordinal()
|
||||||
|
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
sql_results = myDB.select(
|
sql_results = myDB.select(
|
||||||
|
Loading…
Reference in New Issue
Block a user