Early compatibility with Kodi 18 Leia

This commit is contained in:
tomkat83 2017-01-29 13:40:34 +01:00
parent e1bb74c341
commit 289690813a
3 changed files with 48 additions and 45 deletions

View file

@ -14,9 +14,8 @@ import xbmcvfs
from utils import window, settings, getUnixTimestamp, sourcesXML,\
ThreadMethods, ThreadMethodsAdditionalStop, LogTime, getScreensaver,\
setScreensaver, playlistXSP, language as lang, DateToKodi, reset,\
advancedSettingsXML, getKodiVideoDBPath, tryDecode, deletePlaylists,\
deleteNodes, ThreadMethodsAdditionalSuspend, create_actor_db_index, \
tryEncode
advancedSettingsXML, tryDecode, deletePlaylists, deleteNodes, \
ThreadMethodsAdditionalSuspend, create_actor_db_index, tryEncode
import downloadutils
import itemtypes
import plexdb_functions as plexdb
@ -1782,7 +1781,7 @@ class LibrarySync(Thread):
if not startupComplete:
# Also runs when first installed
# Verify the video database can be found
videoDb = getKodiVideoDBPath()
videoDb = v.DB_VIDEO_PATH
if not xbmcvfs.exists(videoDb):
# Database does not exists
log.error("The current Kodi version is incompatible "

View file

@ -20,6 +20,9 @@ import xbmcaddon
import xbmcgui
import xbmcvfs
from variables import DB_VIDEO_PATH, DB_MUSIC_PATH, DB_TEXTURE_PATH, \
DB_PLEX_PATH
###############################################################################
log = logging.getLogger("PLEX."+__name__)
@ -244,35 +247,15 @@ def getUnixTimestamp(secondsIntoTheFuture=None):
def kodiSQL(media_type="video"):
if media_type == "plex":
dbPath = tryDecode(xbmc.translatePath("special://database/plex.db"))
dbPath = DB_PLEX_PATH
elif media_type == "music":
dbPath = getKodiMusicDBPath()
dbPath = DB_MUSIC_PATH
elif media_type == "texture":
dbPath = tryDecode(xbmc.translatePath(
"special://database/Textures13.db"))
dbPath = DB_TEXTURE_PATH
else:
dbPath = getKodiVideoDBPath()
connection = sqlite3.connect(dbPath, timeout=60.0)
return connection
def getKodiVideoDBPath():
dbVersion = {
"13": 78, # Gotham
"14": 90, # Helix
"15": 93, # Isengard
"16": 99, # Jarvis
"17": 107 # Krypton
}
dbPath = tryDecode(xbmc.translatePath(
"special://database/MyVideos%s.db"
% dbVersion.get(xbmc.getInfoLabel('System.BuildVersion')[:2], "")))
return dbPath
dbPath = DB_VIDEO_PATH
return sqlite3.connect(dbPath, timeout=60.0)
def create_actor_db_index():
@ -293,22 +276,6 @@ def create_actor_db_index():
conn.close()
def getKodiMusicDBPath():
dbVersion = {
"13": 46, # Gotham
"14": 48, # Helix
"15": 52, # Isengard
"16": 56, # Jarvis
"17": 60 # Krypton
}
dbPath = tryDecode(xbmc.translatePath(
"special://database/MyMusic%s.db"
% dbVersion.get(xbmc.getInfoLabel('System.BuildVersion')[:2], "")))
return dbPath
def getScreensaver():
# Get the current screensaver value
query = {

View file

@ -37,6 +37,43 @@ else:
DEVICENAME = DEVICENAME.replace("\"", "_")
DEVICENAME = DEVICENAME.replace("/", "_")
# Database paths
_DB_VIDEO_VERSION = {
"13": 78, # Gotham
"14": 90, # Helix
"15": 93, # Isengard
"16": 99, # Jarvis
"17": 107, # Krypton
"18": 107 # Leia
}
DB_VIDEO_PATH = tryDecode(xbmc.translatePath(
"special://database/MyVideos%s.db" % _DB_VIDEO_VERSION.get(KODIVERSION)))
_DB_MUSIC_VERSION = {
"13": 46, # Gotham
"14": 48, # Helix
"15": 52, # Isengard
"16": 56, # Jarvis
"17": 60, # Krypton
"18": 60 # Leia
}
DB_MUSIC_PATH = tryDecode(xbmc.translatePath(
"special://database/MyMusic%s.db" % _DB_MUSIC_VERSION.get(KODIVERSION)))
_DB_TEXTURE_VERSION = {
"13": 13, # Gotham
"14": 13, # Helix
"15": 13, # Isengard
"16": 13, # Jarvis
"17": 13, # Krypton
"18": 13 # Leia
}
DB_TEXTURE_PATH = tryDecode(xbmc.translatePath(
"special://database/Textures%s.db" % _DB_TEXTURE_VERSION.get(KODIVERSION)))
DB_PLEX_PATH = tryDecode(xbmc.translatePath("special://database/plex.db"))
# Multiply Plex time by this factor to receive Kodi time
PLEX_TO_KODI_TIMEFACTOR = 1.0 / 1000.0