From 95a5665ad0dc83885a1450326fb03b4ff147e0ff Mon Sep 17 00:00:00 2001 From: shaun Date: Fri, 27 Mar 2015 11:15:22 +1100 Subject: [PATCH] few small fixes for bugs in test mysql code --- resources/lib/Utils.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index 20d2907e..99dd5595 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -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,20 +142,18 @@ def addKodiSource(name, path, type): error = False - 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: + + 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 # add it to sources.xml