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"?>
<addon id="plugin.video.emby"
name="Emby"
version="1.1.38"
version="1.1.39"
provider-name="Emby.media">
<requires>
<import addon="xbmc.python" version="2.1.0"/>

View File

@ -12,7 +12,6 @@ import inspect
import threading
import urllib
from datetime import datetime, timedelta, time
from distutils.version import LooseVersion, StrictVersion
from itertools import chain
import urllib2
import os
@ -1018,7 +1017,19 @@ class LibrarySync(threading.Thread):
return True
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):
clientInfo = ClientInformation()
self.logMsg("--- Starting Library Sync Thread ---", 0)
@ -1040,16 +1051,21 @@ class LibrarySync(threading.Thread):
# START TEMPORARY CODE
# Only get in here for a while, can be removed later
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') + "?")
if return_value == 0:
utils.settings("dbCreatedWithVersion","0.0.0")
self.logMsg("DB version out of date according to user", 0)
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
if (utils.settings("SyncInstallRunDone") == "true" and LooseVersion(utils.settings("dbCreatedWithVersion")) < LooseVersion(WINDOW.getProperty('minDBVersion'))) and WINDOW.getProperty('minDBVersionCheck') != "true":
self.logMsg("DB Version: " + utils.settings("dbCreatedWithVersion"), 0)
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?")
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")
WINDOW.setProperty('minDBVersionCheck', "true")
else: