mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Update patch process
Add extra verification
This commit is contained in:
parent
a0aa9530d4
commit
1832a54ee9
5 changed files with 50 additions and 5 deletions
|
@ -777,3 +777,11 @@ msgstr ""
|
|||
msgctxt "#33159"
|
||||
msgid "Enable audio/subtitles selection"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#33160"
|
||||
msgid "To avoid errors, please update Emby for Kodi to version: "
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#33161"
|
||||
msgid "Check for updates"
|
||||
msgstr ""
|
||||
|
|
|
@ -19,7 +19,7 @@ import setup
|
|||
import monitor
|
||||
from libraries import requests
|
||||
from views import Views, verify_kodi_defaults
|
||||
from helper import _, window, settings, event, dialog, find
|
||||
from helper import _, window, settings, event, dialog, find, compare_version
|
||||
from downloader import get_objects
|
||||
from emby import Emby
|
||||
|
||||
|
@ -42,6 +42,7 @@ class Service(xbmc.Monitor):
|
|||
|
||||
def __init__(self):
|
||||
|
||||
self.settings['addon_version'] = client.get_version()
|
||||
self.settings['profile'] = xbmc.translatePath('special://profile')
|
||||
self.settings['mode'] = settings('useDirectPaths')
|
||||
self.settings['log_level'] = settings('logLevel') or "1"
|
||||
|
@ -157,6 +158,12 @@ class Service(xbmc.Monitor):
|
|||
else:
|
||||
dialog("notification", heading="{emby}", message=_(33156), icon="{emby}")
|
||||
|
||||
try:
|
||||
if compare_version(self.settings['addon_version'], objects.embyversion) < 0:
|
||||
dialog("ok", heading="{emby}", line1="%s %s" % (_(33160), objects.embyversion))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
except Exception as error:
|
||||
LOG.exception(error)
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ from utils import values
|
|||
from utils import JSONRPC
|
||||
from utils import indent
|
||||
from utils import write_xml
|
||||
from utils import compare_version
|
||||
|
||||
from wrapper import progress
|
||||
from wrapper import catch
|
||||
|
|
|
@ -86,6 +86,34 @@ def settings(setting, value=None):
|
|||
def create_id():
|
||||
return uuid4()
|
||||
|
||||
def compare_version(a, b):
|
||||
|
||||
''' -1 a is smaller
|
||||
1 a is larger
|
||||
0 equal
|
||||
'''
|
||||
a = a.split('.')
|
||||
b = b.split('.')
|
||||
|
||||
for i in range(0, max(len(a), len(b)), 1):
|
||||
try:
|
||||
aVal = a[i]
|
||||
except IndexError:
|
||||
aVal = 0
|
||||
|
||||
try:
|
||||
bVal = b[i]
|
||||
except IndexError:
|
||||
bVal = 0
|
||||
|
||||
if aVal < bVal:
|
||||
return -1
|
||||
|
||||
if aVal > bVal:
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
def find(dict, item):
|
||||
|
||||
''' Find value in dictionary.
|
||||
|
@ -231,7 +259,7 @@ def delete_folder(path=None):
|
|||
''' Delete objects from kodi cache
|
||||
'''
|
||||
LOG.debug("--[ delete folder ]")
|
||||
|
||||
delete_path = path is not None
|
||||
path = path or xbmc.translatePath('special://temp/emby').decode('utf-8')
|
||||
dirs, files = xbmcvfs.listdir(path)
|
||||
|
||||
|
@ -240,8 +268,9 @@ def delete_folder(path=None):
|
|||
for file in files:
|
||||
xbmcvfs.delete(os.path.join(path, file.decode('utf-8')))
|
||||
|
||||
if delete_path:
|
||||
xbmcvfs.delete(path)
|
||||
LOG.info("deleted %s", path)
|
||||
LOG.info("DELETE %s", path)
|
||||
|
||||
def delete_recursive(path, dirs):
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
<setting label="30529" id="startupDelay" type="number" default="0" option="int" />
|
||||
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=reset)" option="close" />
|
||||
<setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=deviceid)" option="close" />
|
||||
<setting label="24034" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=checkupdate)" option="close" />
|
||||
<setting label="33161" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=checkupdate)" option="close" />
|
||||
|
||||
<setting type="sep"/>
|
||||
<setting label="33104" type="lsep"/>
|
||||
|
|
Loading…
Reference in a new issue