Use proper DB path

without guessing.
This commit is contained in:
angelblue05 2015-06-16 19:32:42 -05:00
parent 0dc19eb87f
commit 3c1ce16da0

View file

@ -63,49 +63,31 @@ def KodiSQL(type="video"):
def getKodiVideoDBPath(): def getKodiVideoDBPath():
kodibuild = xbmc.getInfoLabel("System.BuildVersion") dirs, files = xbmcvfs.listdir("special://database")
dbVersion = ""
if kodibuild.startswith("13"):
# Gotham
dbVersion = "78"
elif kodibuild.startswith("14"):
# Helix
dbVersion = "90"
elif kodibuild.startswith("15"):
# Isengard
dbVersion = "93"
else:
# Not a compatible build
xbmc.log("This Kodi version is incompatible. Current version: %s" % kodibuild)
dbPath = xbmc.translatePath("special://profile/Database/MyVideos" + dbVersion + ".db")
return dbPath for database in files:
if "MyVideos" in database:
dbVersion = database
dbPath = xbmc.translatePath("special://database/%s" % dbVersion)
logMsg("Utils", "Path to Video database: %s" % dbPath, 0)
return dbPath
def getKodiMusicDBPath(): def getKodiMusicDBPath():
if xbmc.getInfoLabel("System.BuildVersion").startswith("13"):
#gotham dirs, files = xbmcvfs.listdir("special://database")
dbVersion = "46" dbVersion = ""
elif xbmc.getInfoLabel("System.BuildVersion").startswith("15"):
#isengard for database in files:
dbVersion = "52" if "MyMusic" in database:
else: dbVersion = database
#helix
dbVersion = "48" dbPath = xbmc.translatePath("special://database/%s" % dbVersion)
logMsg("Utils", "Path to Music database: %s" % dbPath, 0)
dbPath = xbmc.translatePath("special://profile/Database/MyMusic" + dbVersion + ".db")
return dbPath
return dbPath
def checkAuthentication():
#check authentication
if addonSettings.getSetting('username') != "" and addonSettings.getSetting('ipaddress') != "":
try:
downloadUtils.authenticate()
except Exception, e:
logMsg("Emby authentication failed",e)
pass
def prettifyXml(elem): def prettifyXml(elem):
rough_string = etree.tostring(elem, "utf-8") rough_string = etree.tostring(elem, "utf-8")