mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Update patch
Move patch from cache to addon_data. No longer need to restart Kodi to apply the first patch.
This commit is contained in:
parent
7df7e5d4a8
commit
403e5834e0
8 changed files with 55 additions and 34 deletions
11
context.py
11
context.py
|
@ -11,10 +11,13 @@ import xbmcaddon
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
cache = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
__addon__ = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
sys.path.insert(0, cache)
|
__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')).decode('utf-8')
|
||||||
__addon__ = xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('path').decode('utf-8')
|
__pcache__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('profile'), 'emby')).decode('utf-8')
|
||||||
__base__ = xbmc.translatePath(os.path.join(__addon__, 'resources', 'lib')).decode('utf-8')
|
__cache__ = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
||||||
|
|
||||||
|
sys.path.insert(0, __cache__)
|
||||||
|
sys.path.insert(0, __pcache__)
|
||||||
sys.path.append(__base__)
|
sys.path.append(__base__)
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
|
@ -11,10 +11,13 @@ import xbmcaddon
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
cache = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
__addon__ = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
sys.path.insert(0, cache)
|
__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')).decode('utf-8')
|
||||||
__addon__ = xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('path').decode('utf-8')
|
__pcache__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('profile'), 'emby')).decode('utf-8')
|
||||||
__base__ = xbmc.translatePath(os.path.join(__addon__, 'resources', 'lib')).decode('utf-8')
|
__cache__ = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
||||||
|
|
||||||
|
sys.path.insert(0, __cache__)
|
||||||
|
sys.path.insert(0, __pcache__)
|
||||||
sys.path.append(__base__)
|
sys.path.append(__base__)
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
11
default.py
11
default.py
|
@ -11,10 +11,13 @@ import xbmcaddon
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
cache = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
__addon__ = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
sys.path.insert(0, cache)
|
__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')).decode('utf-8')
|
||||||
__addon__ = xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('path').decode('utf-8')
|
__pcache__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('profile'), 'emby')).decode('utf-8')
|
||||||
__base__ = xbmc.translatePath(os.path.join(__addon__, 'resources', 'lib')).decode('utf-8')
|
__cache__ = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
||||||
|
|
||||||
|
sys.path.insert(0, __cache__)
|
||||||
|
sys.path.insert(0, __pcache__)
|
||||||
sys.path.append(__base__)
|
sys.path.append(__base__)
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
|
@ -11,6 +11,7 @@ from datetime import datetime
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
|
import xbmcaddon
|
||||||
|
|
||||||
from libraries import requests
|
from libraries import requests
|
||||||
from helper.utils import should_stop, delete_folder
|
from helper.utils import should_stop, delete_folder
|
||||||
|
@ -23,6 +24,7 @@ from emby.core.exceptions import HTTPException
|
||||||
|
|
||||||
LOG = logging.getLogger("EMBY."+__name__)
|
LOG = logging.getLogger("EMBY."+__name__)
|
||||||
LIMIT = min(int(settings('limitIndex') or 50), 50)
|
LIMIT = min(int(settings('limitIndex') or 50), 50)
|
||||||
|
CACHE = xbmc.translatePath(os.path.join(xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('profile').decode('utf-8'), 'emby')).decode('utf-8')
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
|
@ -352,7 +354,7 @@ def get_objects(src, filename):
|
||||||
|
|
||||||
''' Download objects dependency to temp cache folder.
|
''' Download objects dependency to temp cache folder.
|
||||||
'''
|
'''
|
||||||
temp = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
temp = CACHE
|
||||||
restart = not xbmcvfs.exists(os.path.join(temp, "objects") + '/')
|
restart = not xbmcvfs.exists(os.path.join(temp, "objects") + '/')
|
||||||
path = os.path.join(temp, filename).encode('utf-8')
|
path = os.path.join(temp, filename).encode('utf-8')
|
||||||
|
|
||||||
|
@ -362,7 +364,7 @@ def get_objects(src, filename):
|
||||||
restart = False
|
restart = False
|
||||||
|
|
||||||
if not xbmcvfs.exists(path):
|
if not xbmcvfs.exists(path):
|
||||||
delete_folder()
|
delete_folder(CACHE)
|
||||||
|
|
||||||
LOG.info("From %s to %s", src, path.decode('utf-8'))
|
LOG.info("From %s to %s", src, path.decode('utf-8'))
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -745,10 +745,10 @@ def get_themes():
|
||||||
from helper.playutils import PlayUtils
|
from helper.playutils import PlayUtils
|
||||||
from helper.xmls import tvtunes_nfo
|
from helper.xmls import tvtunes_nfo
|
||||||
|
|
||||||
library = xbmc.translatePath("special://profile/addon_data/plugin.video.emby/library/").decode('utf-8')
|
library = xbmc.translatePath("special://profile/addon_data/plugin.video.emby/library").decode('utf-8')
|
||||||
play = settings('useDirectPaths') == "1"
|
play = settings('useDirectPaths') == "1"
|
||||||
|
|
||||||
if not xbmcvfs.exists(library):
|
if not xbmcvfs.exists(library + '/'):
|
||||||
xbmcvfs.mkdir(library)
|
xbmcvfs.mkdir(library)
|
||||||
|
|
||||||
if xbmc.getCondVisibility('System.HasAddon(script.tvtunes)'):
|
if xbmc.getCondVisibility('System.HasAddon(script.tvtunes)'):
|
||||||
|
|
|
@ -182,24 +182,24 @@ class Service(xbmc.Monitor):
|
||||||
if label == objects.version:
|
if label == objects.version:
|
||||||
LOG.info("--[ objects/%s ]", objects.version)
|
LOG.info("--[ objects/%s ]", objects.version)
|
||||||
|
|
||||||
return
|
return False
|
||||||
|
|
||||||
if get_objects(zipfile, label + '.zip'):
|
get_objects(zipfile, label + '.zip')
|
||||||
|
reload(objects) # to apply latest changes
|
||||||
|
|
||||||
LOG.info("No previous patch found.")
|
dialog("notification", heading="{emby}", message=_(33156), icon="{emby}")
|
||||||
dialog("ok", heading="{emby}", line1=_(33135))
|
LOG.info("--[ new objects/%s ]", objects.version)
|
||||||
xbmc.executebuiltin('RestartApp')
|
|
||||||
else:
|
|
||||||
dialog("notification", heading="{emby}", message=_(33156), icon="{emby}")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if compare_version(self.settings['addon_version'], objects.embyversion) < 0:
|
if compare_version(self.settings['addon_version'], objects.embyversion) < 0:
|
||||||
dialog("ok", heading="{emby}", line1="%s %s" % (_(33160), objects.embyversion))
|
dialog("ok", heading="{emby}", line1="%s %s" % (_(33160), objects.embyversion))
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
LOG.exception(error)
|
LOG.exception(error)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def onNotification(self, sender, method, data):
|
def onNotification(self, sender, method, data):
|
||||||
|
|
||||||
|
|
|
@ -373,6 +373,9 @@ def copytree(path, dest):
|
||||||
'''
|
'''
|
||||||
dirs, files = xbmcvfs.listdir(path)
|
dirs, files = xbmcvfs.listdir(path)
|
||||||
|
|
||||||
|
if not xbmcvfs.exists(dest):
|
||||||
|
xbmcvfs.mkdirs(dest)
|
||||||
|
|
||||||
if dirs:
|
if dirs:
|
||||||
copy_recursive(path, dirs, dest)
|
copy_recursive(path, dirs, dest)
|
||||||
|
|
||||||
|
@ -401,6 +404,9 @@ def copy_file(path, dest):
|
||||||
|
|
||||||
''' Copy specific file.
|
''' Copy specific file.
|
||||||
'''
|
'''
|
||||||
|
if path.endswith('.pyo'):
|
||||||
|
return
|
||||||
|
|
||||||
xbmcvfs.copy(path, dest)
|
xbmcvfs.copy(path, dest)
|
||||||
LOG.debug("copy: %s to %s", path, dest)
|
LOG.debug("copy: %s to %s", path, dest)
|
||||||
|
|
||||||
|
|
16
service.py
16
service.py
|
@ -12,14 +12,18 @@ import xbmcaddon
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
cache = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
__addon__ = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')).decode('utf-8')
|
||||||
|
__pcache__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('profile'), 'emby')).decode('utf-8')
|
||||||
|
__cache__ = xbmc.translatePath('special://temp/emby').decode('utf-8')
|
||||||
|
|
||||||
if not xbmcvfs.exists(cache):
|
if not xbmcvfs.exists(__pcache__ + '/'):
|
||||||
xbmcvfs.mkdir(cache)
|
from resources.lib.helper.utils import copytree
|
||||||
|
|
||||||
sys.path.insert(0, cache)
|
copytree(os.path.join(__base__, 'objects').decode('utf-8'), os.path.join(__pcache__, 'objects').decode('utf-8'))
|
||||||
__addon__ = xbmcaddon.Addon(id='plugin.video.emby').getAddonInfo('path').decode('utf-8')
|
|
||||||
__base__ = xbmc.translatePath(os.path.join(__addon__, 'resources', 'lib')).decode('utf-8')
|
sys.path.insert(0, __cache__)
|
||||||
|
sys.path.insert(0, __pcache__)
|
||||||
sys.path.append(__base__)
|
sys.path.append(__base__)
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
Loading…
Reference in a new issue