mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Fix for closing cache connection early when needed.
This commit is contained in:
parent
ecad67be06
commit
1f180a5a05
1 changed files with 14 additions and 15 deletions
|
@ -49,22 +49,21 @@ class CacheDBConnection(db.DBConnection):
|
||||||
def __init__(self, providerName):
|
def __init__(self, providerName):
|
||||||
db.DBConnection.__init__(self, "cache.db")
|
db.DBConnection.__init__(self, "cache.db")
|
||||||
|
|
||||||
with self as myDB:
|
# 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 myDB.hasTable(providerName):
|
self.action("CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT)")
|
||||||
myDB.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
|
|
||||||
|
|
||||||
# Create the table if it's not already there
|
# Create the table if it's not already there
|
||||||
try:
|
try:
|
||||||
if not myDB.hasTable('lastUpdate'):
|
if not self.hasTable('lastUpdate'):
|
||||||
myDB.action("CREATE TABLE lastUpdate (provider TEXT, time NUMERIC)")
|
self.action("CREATE TABLE lastUpdate (provider TEXT, time NUMERIC)")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
if str(e) != "table lastUpdate already exists":
|
if str(e) != "table lastUpdate already exists":
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
class TVCache():
|
class TVCache():
|
||||||
|
|
Loading…
Reference in a new issue