mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
Merge branch 'develop' of https://github.com/MediaBrowser/plugin.video.emby into develop
This commit is contained in:
commit
828abd807e
3 changed files with 39 additions and 4 deletions
|
@ -20,6 +20,21 @@ class Embydb_Functions():
|
||||||
self.embycursor = embycursor
|
self.embycursor = embycursor
|
||||||
|
|
||||||
|
|
||||||
|
def get_version(self, version=None):
|
||||||
|
|
||||||
|
if version is not None:
|
||||||
|
query = "INSERT INTO version(idVersion) VALUES (?)"
|
||||||
|
self.embycursor.execute(query, (version,))
|
||||||
|
else:
|
||||||
|
query = "SELECT idVersion FROM version"
|
||||||
|
self.embycursor.execute(query)
|
||||||
|
try:
|
||||||
|
version = self.embycursor.fetchone()[0]
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return version
|
||||||
|
|
||||||
def getViews(self):
|
def getViews(self):
|
||||||
|
|
||||||
views = []
|
views = []
|
||||||
|
|
|
@ -311,10 +311,14 @@ class LibrarySync(threading.Thread):
|
||||||
if pDialog:
|
if pDialog:
|
||||||
pDialog.close()
|
pDialog.close()
|
||||||
|
|
||||||
|
emby_db = embydb.Embydb_Functions(embycursor)
|
||||||
|
current_version = emby_db.get_version(self.clientInfo.get_version())
|
||||||
|
window('emby_version', current_version)
|
||||||
|
embyconn.commit()
|
||||||
embycursor.close()
|
embycursor.close()
|
||||||
|
|
||||||
settings('SyncInstallRunDone', value="true")
|
settings('SyncInstallRunDone', value="true")
|
||||||
settings("dbCreatedWithVersion", self.clientInfo.get_version())
|
|
||||||
self.saveLastSync()
|
self.saveLastSync()
|
||||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||||
elapsedtotal = datetime.now() - starttotal
|
elapsedtotal = datetime.now() - starttotal
|
||||||
|
@ -890,6 +894,7 @@ class LibrarySync(threading.Thread):
|
||||||
def compareDBVersion(self, current, minimum):
|
def compareDBVersion(self, current, minimum):
|
||||||
# It returns True is database is up to date. False otherwise.
|
# It returns True is database is up to date. False otherwise.
|
||||||
log.info("current: %s minimum: %s" % (current, minimum))
|
log.info("current: %s minimum: %s" % (current, minimum))
|
||||||
|
|
||||||
currMajor, currMinor, currPatch = current.split(".")
|
currMajor, currMinor, currPatch = current.split(".")
|
||||||
minMajor, minMinor, minPatch = minimum.split(".")
|
minMajor, minMinor, minPatch = minimum.split(".")
|
||||||
|
|
||||||
|
@ -940,7 +945,20 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
if (window('emby_dbCheck') != "true" and settings('SyncInstallRunDone') == "true"):
|
if (window('emby_dbCheck') != "true" and settings('SyncInstallRunDone') == "true"):
|
||||||
# Verify the validity of the database
|
# Verify the validity of the database
|
||||||
currentVersion = settings('dbCreatedWithVersion')
|
|
||||||
|
embyconn = utils.kodiSQL('emby')
|
||||||
|
embycursor = embyconn.cursor()
|
||||||
|
emby_db = embydb.Embydb_Functions(embycursor)
|
||||||
|
currentVersion = emby_db.get_version()
|
||||||
|
###$ Begin migration $###
|
||||||
|
if currentVersion is None:
|
||||||
|
currentVersion = emby_db.get_version(settings('dbCreatedWithVersion'))
|
||||||
|
embyconn.commit()
|
||||||
|
log.info("Migration of database version completed")
|
||||||
|
###$ End migration $###
|
||||||
|
embycursor.close()
|
||||||
|
window('emby_version', value=currentVersion)
|
||||||
|
|
||||||
minVersion = window('emby_minDBVersion')
|
minVersion = window('emby_minDBVersion')
|
||||||
uptoDate = self.compareDBVersion(currentVersion, minVersion)
|
uptoDate = self.compareDBVersion(currentVersion, minVersion)
|
||||||
|
|
||||||
|
@ -976,8 +994,9 @@ class LibrarySync(threading.Thread):
|
||||||
line1=lang(33024))
|
line1=lang(33024))
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
# Run start up sync
|
# Run start up sync
|
||||||
log.warn("Database version: %s" % settings('dbCreatedWithVersion'))
|
log.warn("Database version: %s", window('emby_version'))
|
||||||
log.info("SyncDatabase (started)")
|
log.info("SyncDatabase (started)")
|
||||||
startTime = datetime.now()
|
startTime = datetime.now()
|
||||||
librarySync = self.startSync()
|
librarySync = self.startSync()
|
||||||
|
|
|
@ -392,6 +392,7 @@ def reset():
|
||||||
cursor.execute("DELETE FROM " + tablename)
|
cursor.execute("DELETE FROM " + tablename)
|
||||||
cursor.execute('DROP table IF EXISTS emby')
|
cursor.execute('DROP table IF EXISTS emby')
|
||||||
cursor.execute('DROP table IF EXISTS view')
|
cursor.execute('DROP table IF EXISTS view')
|
||||||
|
cursor.execute("DELETE FROM version")
|
||||||
connection.commit()
|
connection.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue