Switch to local code for version check

This commit is contained in:
xnappo 2015-09-10 21:27:36 -05:00
parent 37cef2cf26
commit 5496cb0667
2 changed files with 22 additions and 6 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby" <addon id="plugin.video.emby"
name="Emby" name="Emby"
version="1.1.38" version="1.1.39"
provider-name="Emby.media"> provider-name="Emby.media">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>

View file

@ -12,7 +12,6 @@ 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
@ -1018,7 +1017,19 @@ class LibrarySync(threading.Thread):
return True return True
return False return False
def checkDBVersion(self, currVersion, minVersion):
currMajor, currMinor, currPatch = currVersion.split(".")
minMajor, minMinor, minPatch = minVersion.split(".")
if currMajor > minMajor:
return True
elif currMajor == minMajor and currMinor > minMinor:
return True
elif currMajor == minMajor and currMinor == minMinor and currPatch >= minPatch:
return True
else:
return False
def run(self): def run(self):
clientInfo = ClientInformation() clientInfo = ClientInformation()
self.logMsg("--- Starting Library Sync Thread ---", 0) self.logMsg("--- Starting Library Sync Thread ---", 0)
@ -1040,16 +1051,21 @@ class LibrarySync(threading.Thread):
# START TEMPORARY CODE # START TEMPORARY CODE
# Only get in here for a while, can be removed later # Only get in here for a while, can be removed later
if utils.settings("dbCreatedWithVersion")=="" and utils.settings("SyncInstallRunDone") == "true": if utils.settings("dbCreatedWithVersion")=="" and utils.settings("SyncInstallRunDone") == "true":
self.logMsg("Unknown DB version", 0)
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') + "?") 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: if return_value == 0:
utils.settings("dbCreatedWithVersion","0.0.0") utils.settings("dbCreatedWithVersion","0.0.0")
self.logMsg("DB version out of date according to user", 0)
else: else:
utils.settings("dbCreatedWithVersion",WINDOW.getProperty('minDBVersion')) utils.settings("dbCreatedWithVersion",WINDOW.getProperty('minDBVersion'))
self.logMsg("DB version okay according to user", 0)
# END TEMPORARY CODE # END TEMPORARY CODE
self.logMsg("DB Version: " + utils.settings("dbCreatedWithVersion"), 0)
if (utils.settings("SyncInstallRunDone") == "true" and LooseVersion(utils.settings("dbCreatedWithVersion")) < LooseVersion(WINDOW.getProperty('minDBVersion'))) and WINDOW.getProperty('minDBVersionCheck') != "true": if (utils.settings("SyncInstallRunDone") == "true" and self.checkDBVersion(utils.settings("dbCreatedWithVersion"), WINDOW.getProperty('minDBVersion'))==False and WINDOW.getProperty('minDBVersionCheck') != "true"):
self.logMsg("DB version out of date according to check", 0)
return_value = xbmcgui.Dialog().yesno("DB Version", "Detected the DB needs to be recreated for\nthis version of Emby for Kodi.\nProceed?") 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: if return_value == 0:
self.logMsg("DB version out of date !!! USER IGNORED !!!", 0)
xbmcgui.Dialog().ok("Emby for Kodi","Emby for Kodi may not work\ncorrectly until the database is reset.\n") xbmcgui.Dialog().ok("Emby for Kodi","Emby for Kodi may not work\ncorrectly until the database is reset.\n")
WINDOW.setProperty('minDBVersionCheck', "true") WINDOW.setProperty('minDBVersionCheck', "true")
else: else: