Use proper DB path

without guessing.
This commit is contained in:
angelblue05 2015-06-16 19:32:42 -05:00
parent 0dc19eb87f
commit 3c1ce16da0
1 changed files with 22 additions and 40 deletions

View File

@ -63,50 +63,32 @@ def KodiSQL(type="video"):
def getKodiVideoDBPath(): def getKodiVideoDBPath():
kodibuild = xbmc.getInfoLabel("System.BuildVersion") dirs, files = xbmcvfs.listdir("special://database")
dbVersion = ""
if kodibuild.startswith("13"): for database in files:
# Gotham if "MyVideos" in database:
dbVersion = "78" dbVersion = database
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") dbPath = xbmc.translatePath("special://database/%s" % dbVersion)
logMsg("Utils", "Path to Video database: %s" % dbPath, 0)
return dbPath return dbPath
def getKodiMusicDBPath(): def getKodiMusicDBPath():
if xbmc.getInfoLabel("System.BuildVersion").startswith("13"):
#gotham
dbVersion = "46"
elif xbmc.getInfoLabel("System.BuildVersion").startswith("15"):
#isengard
dbVersion = "52"
else:
#helix
dbVersion = "48"
dbPath = xbmc.translatePath("special://profile/Database/MyMusic" + dbVersion + ".db") dirs, files = xbmcvfs.listdir("special://database")
dbVersion = ""
for database in files:
if "MyMusic" in database:
dbVersion = database
dbPath = xbmc.translatePath("special://database/%s" % dbVersion)
logMsg("Utils", "Path to Music database: %s" % dbPath, 0)
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")
reparsed = minidom.parseString(rough_string) reparsed = minidom.parseString(rough_string)