Revert "few small fixes for bugs in test mysql code"

This reverts commit 95a5665ad0.
This commit is contained in:
shaun 2015-03-27 11:17:55 +11:00
commit e2e847db29
1 changed files with 16 additions and 14 deletions

View File

@ -84,10 +84,10 @@ def checkKodiSources():
return True
def KodiSQL():
if xbmc.getInfoLabel("System.BuildVersion").startswith("13"):
if xbmc.getinfolabel("System.BuildVersion").startswith("13"):
#gotham
dbVersion = "78"
if xbmc.getInfoLabel("System.BuildVersion").startswith("15"):
if xbmc.getinfolabel("System.BuildVersion").startswith("15"):
#isengard
dbVersion = "91"
else:
@ -142,18 +142,20 @@ def addKodiSource(name, path, type):
error = False
try:
connection = KodiSQL()
cursor = connection.cursor( )
cursor.execute("select coalesce(max(idPath),0) as pathId from path")
pathId = cursor.fetchone()[0]
pathId = pathId + 1
pathsql="insert into path(idPath, strPath, strContent, strScraper, strHash, scanRecursive) values(?, ?, ?, ?, ?, ?)"
cursor.execute(pathsql, (pathId,path + os.sep,type,"metadata.local",None,2147483647))
connection.commit()
cursor.close()
except:
if xbmcvfs.exists(dbPath):
try:
connection = KodiSQL()
cursor = connection.cursor( )
cursor.execute("select coalesce(max(idPath),0) as pathId from path")
pathId = cursor.fetchone()[0]
pathId = pathId + 1
pathsql="insert into path(idPath, strPath, strContent, strScraper, strHash, scanRecursive) values(?, ?, ?, ?, ?, ?)"
cursor.execute(pathsql, (pathId,path + os.sep,type,"metadata.local",None,2147483647))
connection.commit()
cursor.close()
except:
error = True
else:
error = True
# add it to sources.xml