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"
#find out if we should use MySQL
useMySQL = False
settingsFile = xbmc.translatePath( "special://profile/advancedsettings.xml" )
if xbmcvfs.exists(settingsFile):
tree = ET.ElementTree(file=settingsFile)
root = tree.getroot()
video = root.find("videodatabase")
if video != None:
mysql = video.find("type")
if mysql != None:
useMySQL = True
db_port = video.find("port").text
db_host = video.find("host").text
db_user = video.find("user").text
db_pass = video.find("pass").text
if video.find("name") != None:
db_name = video.find("name").text
else:
db_name = "MyVideos"
if useMySQL:
import local.mysql.connector as database
connection = database.connect(dbPath)
connection = database.connect(db = db_name, user = db_user, passwd = db_pass, host = db_host, port = db_port)
connection.set_charset('utf8')
connection.set_unicode(True)
# MySQL support not working! Todo for a (very) rainy day...
# useMySQL = False
# settingsFile = xbmc.translatePath( "special://profile/advancedsettings.xml" )
# if xbmcvfs.exists(settingsFile):
# tree = ET.ElementTree(file=settingsFile)
# root = tree.getroot()
# video = root.find("videodatabase")
# if video != None:
# mysql = video.find("type")
# if mysql != None:
# useMySQL = True
# db_host = video.find("host").text
# db_user = video.find("user").text
# db_pass = video.find("pass").text
# if video.find("name") != None:
# db_name = video.find("name").text
# else:
# db_name = "myvideos" + dbVersion
# if useMySQL:
# import mysql.connector as database
# connection = database.connect(db = db_name, user = db_user, passwd = db_pass, host = db_host)
# else:
# import sqlite3 as database
# dbPath = xbmc.translatePath("special://userdata/Database/MyVideos" + dbVersion + ".db")
# connection = database.connect(dbPath)
else:
import sqlite3 as database
dbPath = xbmc.translatePath("special://userdata/Database/MyVideos" + dbVersion + ".db")
connection = database.connect(dbPath)
@ -133,10 +133,6 @@ def addKodiSource(name, path, type):
#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
error = False
if xbmcvfs.exists(dbPath):
try:
connection = KodiSQL()
cursor = connection.cursor( )
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))
connection.commit()
cursor.close()
except:
error = True
else:
error = True
# add it to sources.xml
sourcesFile = xbmc.translatePath( "special://profile/sources.xml" )