Don't use hardcoded database version number

This commit is contained in:
im85288 2015-03-23 11:30:03 +00:00
parent 944b04b89a
commit cf03ca9f4f
2 changed files with 7 additions and 5 deletions

View file

@ -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):

View file

@ -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()