From cf03ca9f4f4cfd7d7f4cb541d8afc41775dc297c Mon Sep 17 00:00:00 2001 From: im85288 Date: Mon, 23 Mar 2015 11:30:03 +0000 Subject: [PATCH] Don't use hardcoded database version number --- resources/lib/Utils.py | 5 +++-- resources/lib/WriteKodiDB.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index 5f92f3e4..fc2a9964 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -23,7 +23,8 @@ from PlayUtils import PlayUtils from DownloadUtils import DownloadUtils downloadUtils = DownloadUtils() addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync') -language = addonSettings.getLocalizedString +language = addonSettings.getLocalizedString +DATABASE_VERSION_HELIX = "90" def logMsg(title, msg, level = 1): logLevel = int(addonSettings.getSetting("logLevel")) @@ -88,7 +89,7 @@ def addKodiSource(name, path, type): #add new source to database, common way is to add it directly to the Kodi DB. Fallback to adding it to the sources.xml #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 - dbPath = xbmc.translatePath("special://userdata/Database/MyVideos90.db") + dbPath = xbmc.translatePath("special://userdata/Database/MyVideos%s.db" % DATABASE_VERSION_HELIX) error = False if xbmcvfs.exists(dbPath): diff --git a/resources/lib/WriteKodiDB.py b/resources/lib/WriteKodiDB.py index f03a161f..a59b8e85 100644 --- a/resources/lib/WriteKodiDB.py +++ b/resources/lib/WriteKodiDB.py @@ -791,7 +791,7 @@ class WriteKodiDB(): #if wanted this feature can be extended to also update the other artwork tvshowid = KodiItem["tvshowid"] - dbPath = xbmc.translatePath("special://userdata/Database/MyVideos90.db") + dbPath = xbmc.translatePath("special://userdata/Database/MyVideos%s.db" % utils.DATABASE_VERSION_HELIX) connection = sqlite3.connect(dbPath) cursor = connection.cursor( ) @@ -820,7 +820,7 @@ class WriteKodiDB(): utils.logMsg("MB3 Sync","setting resume point in kodi db..." + fileType + ": " + str(id)) xbmc.sleep(sleepVal) - dbPath = xbmc.translatePath("special://userdata/Database/MyVideos90.db") + dbPath = xbmc.translatePath("special://userdata/Database/MyVideos%s.db" % utils.DATABASE_VERSION_HELIX) connection = sqlite3.connect(dbPath) cursor = connection.cursor( ) @@ -874,7 +874,8 @@ class WriteKodiDB(): xbmc.sleep(sleepVal) - dbPath = xbmc.translatePath("special://userdata/Database/MyVideos90.db") + dbPath = xbmc.translatePath("special://userdata/Database/MyVideos%s.db" % utils.DATABASE_VERSION_HELIX) + connection = sqlite3.connect(dbPath) cursor = connection.cursor()