comment out the mysql support --> not working for now.
This commit is contained in:
parent
65c74ba014
commit
348bc353ae
1 changed files with 41 additions and 49 deletions
|
@ -95,35 +95,35 @@ 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)
|
|
||||||
|
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
|
@ -133,23 +133,15 @@ 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
|
||||||
|
|
||||||
|
connection = KodiSQL()
|
||||||
error = False
|
cursor = connection.cursor( )
|
||||||
if xbmcvfs.exists(dbPath):
|
cursor.execute("select coalesce(max(idPath),0) as pathId from path")
|
||||||
try:
|
pathId = cursor.fetchone()[0]
|
||||||
connection = KodiSQL()
|
pathId = pathId + 1
|
||||||
cursor = connection.cursor( )
|
pathsql="insert into path(idPath, strPath, strContent, strScraper, strHash, scanRecursive) values(?, ?, ?, ?, ?, ?)"
|
||||||
cursor.execute("select coalesce(max(idPath),0) as pathId from path")
|
cursor.execute(pathsql, (pathId,path + os.sep,type,"metadata.local",None,2147483647))
|
||||||
pathId = cursor.fetchone()[0]
|
connection.commit()
|
||||||
pathId = pathId + 1
|
cursor.close()
|
||||||
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
|
# add it to sources.xml
|
||||||
sourcesFile = xbmc.translatePath( "special://profile/sources.xml" )
|
sourcesFile = xbmc.translatePath( "special://profile/sources.xml" )
|
||||||
|
|
Loading…
Reference in a new issue