mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-13 21:56:11 +00:00
Database follow up
When upgrading Kodi, it will leave the old database in the folder. As to not conflict, use the higher database version number.
This commit is contained in:
parent
fc7916c69b
commit
9c1f8476aa
1 changed files with 13 additions and 7 deletions
|
@ -64,13 +64,16 @@ def KodiSQL(type="video"):
|
||||||
def getKodiVideoDBPath():
|
def getKodiVideoDBPath():
|
||||||
|
|
||||||
dirs, files = xbmcvfs.listdir("special://database")
|
dirs, files = xbmcvfs.listdir("special://database")
|
||||||
dbVersion = ""
|
dbVersions = {}
|
||||||
|
|
||||||
for database in files:
|
for database in files:
|
||||||
if "MyVideos" in database and database.endswith("db"):
|
if "MyVideos" in database and database.endswith("db"):
|
||||||
dbVersion = database
|
version = database[len("MyVideos"):-len(".db")]
|
||||||
|
dbVersions[int(version)] = database
|
||||||
|
# Sort by highest version number
|
||||||
|
versions = sorted(dbVersions.keys(), reverse=True)
|
||||||
|
|
||||||
dbPath = xbmc.translatePath("special://database/%s" % dbVersion)
|
dbPath = xbmc.translatePath("special://database/%s" % dbVersions[versions[0]])
|
||||||
logMsg("Utils", "Path to Video database: %s" % dbPath, 0)
|
logMsg("Utils", "Path to Video database: %s" % dbPath, 0)
|
||||||
|
|
||||||
return dbPath
|
return dbPath
|
||||||
|
@ -78,13 +81,16 @@ def getKodiVideoDBPath():
|
||||||
def getKodiMusicDBPath():
|
def getKodiMusicDBPath():
|
||||||
|
|
||||||
dirs, files = xbmcvfs.listdir("special://database")
|
dirs, files = xbmcvfs.listdir("special://database")
|
||||||
dbVersion = ""
|
dbVersions = {}
|
||||||
|
|
||||||
for database in files:
|
for database in files:
|
||||||
if "MyMusic" in database and database.endswith("db"):
|
if "MyMusic" in database and database.endswith("db"):
|
||||||
dbVersion = database
|
version = database[len("MyMusic"):-len(".db")]
|
||||||
|
dbVersions[int(version)] = database
|
||||||
|
# Sort by highest version number
|
||||||
|
versions = sorted(dbVersions.keys(), reverse=True)
|
||||||
|
|
||||||
dbPath = xbmc.translatePath("special://database/%s" % dbVersion)
|
dbPath = xbmc.translatePath("special://database/%s" % dbVersions[versions[0]])
|
||||||
logMsg("Utils", "Path to Music database: %s" % dbPath, 0)
|
logMsg("Utils", "Path to Music database: %s" % dbPath, 0)
|
||||||
|
|
||||||
return dbPath
|
return dbPath
|
||||||
|
|
Loading…
Reference in a new issue