diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 4b0c1364..61d29d93 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -267,7 +267,7 @@ class GenericProvider: # remove duplicate items searchItems[epObj] = itemList - #if we have cached results return them. + # if we have cached results return them. if len(results): return results @@ -321,11 +321,11 @@ class GenericProvider: logger.DEBUG) continue + airdate = parse_result.air_date.toordinal() if parse_result.air_date else parse_result.sports_event_date.toordinal() myDB = db.DBConnection() sql_results = myDB.select( "SELECT season, episode FROM tv_episodes WHERE showid = ? AND airdate = ?", - [show.indexerid, - parse_result.air_date.toordinal() or parse_result.sports_event_date.toordinal()]) + [show.indexerid, airdate]) if len(sql_results) != 1: logger.log( diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 8221df84..1cf9e35f 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -634,7 +634,7 @@ class TVShow(object): logger.log( u"Looks like this is an air-by-date or sports show, attempting to convert the date to season/episode", 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() sql_result = myDB.select( "SELECT season, episode FROM tv_episodes WHERE showid = ? and indexer = ? and airdate = ?", diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index d71dc9c7..adc82694 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -52,7 +52,8 @@ class CacheDBConnection(db.DBConnection): # Create the table if it's not already there try: 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: if str(e) != "table [" + providerName + "] already exists": raise @@ -241,7 +242,7 @@ class TVCache(): def shouldUpdate(self): # 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( # datetime.timedelta(minutes=self.minTime)), logger.DEBUG) # return False @@ -275,7 +276,7 @@ class TVCache(): season = episodes = None 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() sql_results = myDB.select(