comment out the mysql support --> not working for now.

This commit is contained in:
Marcel van der Veldt 2015-03-27 00:13:46 +01:00
parent 65c74ba014
commit 348bc353ae

View file

@ -95,32 +95,32 @@ def KodiSQL():
dbVersion = "90" dbVersion = "90"
#find out if we should use MySQL #find out if we should use MySQL
useMySQL = False # MySQL support not working! Todo for a (very) rainy day...
settingsFile = xbmc.translatePath( "special://profile/advancedsettings.xml" ) # useMySQL = False
if xbmcvfs.exists(settingsFile): # settingsFile = xbmc.translatePath( "special://profile/advancedsettings.xml" )
tree = ET.ElementTree(file=settingsFile) # if xbmcvfs.exists(settingsFile):
root = tree.getroot() # tree = ET.ElementTree(file=settingsFile)
video = root.find("videodatabase") # root = tree.getroot()
if video != None: # video = root.find("videodatabase")
mysql = video.find("type") # if video != None:
if mysql != None: # mysql = video.find("type")
useMySQL = True # if mysql != None:
db_port = video.find("port").text # useMySQL = True
db_host = video.find("host").text # db_host = video.find("host").text
db_user = video.find("user").text # db_user = video.find("user").text
db_pass = video.find("pass").text # db_pass = video.find("pass").text
if video.find("name") != None: # if video.find("name") != None:
db_name = video.find("name").text # db_name = video.find("name").text
else: # else:
db_name = "MyVideos" # db_name = "myvideos" + dbVersion
if useMySQL: # if useMySQL:
import local.mysql.connector as database # import mysql.connector as database
connection = database.connect(dbPath) # connection = database.connect(db = db_name, user = db_user, passwd = db_pass, host = db_host)
connection = database.connect(db = db_name, user = db_user, passwd = db_pass, host = db_host, port = db_port) # else:
connection.set_charset('utf8') # import sqlite3 as database
connection.set_unicode(True) # dbPath = xbmc.translatePath("special://userdata/Database/MyVideos" + dbVersion + ".db")
# connection = database.connect(dbPath)
else:
import sqlite3 as database import sqlite3 as database
dbPath = xbmc.translatePath("special://userdata/Database/MyVideos" + dbVersion + ".db") dbPath = xbmc.translatePath("special://userdata/Database/MyVideos" + dbVersion + ".db")
connection = database.connect(dbPath) connection = database.connect(dbPath)
@ -133,10 +133,6 @@ def addKodiSource(name, path, type):
#return boolean wether a manual reboot is required. #return boolean wether a manual reboot is required.
#todo: Do feature request with Kodi team to get support for adding a source by the json API #todo: Do feature request with Kodi team to get support for adding a source by the json API
error = False
if xbmcvfs.exists(dbPath):
try:
connection = KodiSQL() connection = KodiSQL()
cursor = connection.cursor( ) cursor = connection.cursor( )
cursor.execute("select coalesce(max(idPath),0) as pathId from path") cursor.execute("select coalesce(max(idPath),0) as pathId from path")
@ -146,10 +142,6 @@ def addKodiSource(name, path, type):
cursor.execute(pathsql, (pathId,path + os.sep,type,"metadata.local",None,2147483647)) cursor.execute(pathsql, (pathId,path + os.sep,type,"metadata.local",None,2147483647))
connection.commit() connection.commit()
cursor.close() cursor.close()
except:
error = True
else:
error = True
# add it to sources.xml # add it to sources.xml
sourcesFile = xbmc.translatePath( "special://profile/sources.xml" ) sourcesFile = xbmc.translatePath( "special://profile/sources.xml" )