Add library version tracking

This commit is contained in:
xnappo 2015-09-06 12:28:00 -05:00
parent 2b9e352d72
commit 76bec3e846
2 changed files with 24 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import inspect
import threading import threading
import urllib import urllib
from datetime import datetime, timedelta, time from datetime import datetime, timedelta, time
from distutils.version import LooseVersion, StrictVersion
from itertools import chain from itertools import chain
import urllib2 import urllib2
import os import os
@ -1003,7 +1004,7 @@ class LibrarySync(threading.Thread):
return False return False
def run(self): def run(self):
clientInfo = ClientInformation()
self.logMsg("--- Starting Library Sync Thread ---", 0) self.logMsg("--- Starting Library Sync Thread ---", 0)
WINDOW = xbmcgui.Window(10000) WINDOW = xbmcgui.Window(10000)
startupComplete = False startupComplete = False
@ -1018,6 +1019,25 @@ class LibrarySync(threading.Thread):
# Abort was requested while waiting. We should exit # Abort was requested while waiting. We should exit
break break
# Check if the version of Emby for Kodi the DB was created with is recent enough - controled by Window property set at top of service _INIT_
# START TEMPORARY CODE
# Only get in here for a while, can be removed later
if utils.settings("dbCreatedWithVersion")=="" and utils.settings("SyncInstallRunDone") == "true":
return_value = xbmcgui.Dialog().yesno("DB Version", "Can't detect version of Emby for Kodi the DB was created with.\nWas it at least version " + WINDOW.getProperty('minDBVersion') + "?")
if return_value == 0:
utils.settings("dbCreatedWithVersion","0.0.0")
else:
utils.settings("dbCreatedWithVersion",WINDOW.getProperty('minDBVersion'))
# END TEMPORARY CODE
if (utils.settings("SyncInstallRunDone") == "true" and LooseVersion(utils.settings("dbCreatedWithVersion")) < LooseVersion(WINDOW.getProperty('minDBVersion'))):
return_value = xbmcgui.Dialog().yesno("DB Version", "Detected the DB needs to be recreated for\nthis version of Emby for Kodi.\nProceed?")
if return_value == 0:
xbmcgui.Dialog().ok("Emby for Kodi","Emby for Kodi may not work\ncorrectly until the database is reset.\n")
else:
utils.reset()
# Library sync # Library sync
if not startupComplete: if not startupComplete:
# Run full sync # Run full sync

View File

@ -60,6 +60,9 @@ class Service():
WINDOW.clearProperty('Server_status') WINDOW.clearProperty('Server_status')
WINDOW.clearProperty('startup') WINDOW.clearProperty('startup')
WINDOW.clearProperty('OnWakeSync') WINDOW.clearProperty('OnWakeSync')
#Set min DB version
WINDOW.setProperty('minDBVersion','1.1.33')
embyProperty = WINDOW.getProperty('Emby.nodes.total') embyProperty = WINDOW.getProperty('Emby.nodes.total')
propNames = [ propNames = [