Greatly speed up displaying context menu
This commit is contained in:
parent
cb39dbd19d
commit
47675bc60f
3 changed files with 28 additions and 30 deletions
|
@ -1,52 +1,44 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
from logging import getLogger
|
||||||
|
from os import path as os_path
|
||||||
|
from sys import path as sys_path
|
||||||
|
|
||||||
import logging
|
from xbmcaddon import Addon
|
||||||
import os
|
from xbmc import translatePath, sleep
|
||||||
import sys
|
from xbmcgui import Window
|
||||||
|
|
||||||
import xbmc
|
_addon = Addon(id='plugin.video.plexkodiconnect')
|
||||||
import xbmcaddon
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
_addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
|
|
||||||
try:
|
try:
|
||||||
_addon_path = _addon.getAddonInfo('path').decode('utf-8')
|
_addon_path = _addon.getAddonInfo('path').decode('utf-8')
|
||||||
except TypeError:
|
except TypeError:
|
||||||
_addon_path = _addon.getAddonInfo('path').decode()
|
_addon_path = _addon.getAddonInfo('path').decode()
|
||||||
try:
|
try:
|
||||||
_base_resource = xbmc.translatePath(os.path.join(
|
_base_resource = translatePath(os_path.join(
|
||||||
_addon_path,
|
_addon_path,
|
||||||
'resources',
|
'resources',
|
||||||
'lib')).decode('utf-8')
|
'lib')).decode('utf-8')
|
||||||
except TypeError:
|
except TypeError:
|
||||||
_base_resource = xbmc.translatePath(os.path.join(
|
_base_resource = translatePath(os_path.join(
|
||||||
_addon_path,
|
_addon_path,
|
||||||
'resources',
|
'resources',
|
||||||
'lib')).decode()
|
'lib')).decode()
|
||||||
sys.path.append(_base_resource)
|
sys_path.append(_base_resource)
|
||||||
|
|
||||||
|
from pickler import unpickle_me, pickl_window
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
log = getLogger("PLEX."+__name__)
|
||||||
import loghandler
|
|
||||||
from context_entry import ContextMenu
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
loghandler.config()
|
|
||||||
log = logging.getLogger("PLEX.contextmenu")
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
win = Window(10000)
|
||||||
try:
|
while win.getProperty('plex_command'):
|
||||||
# Start the context menu
|
sleep(20)
|
||||||
ContextMenu()
|
win.setProperty('plex_command', 'CONTEXT_menu')
|
||||||
except Exception as error:
|
while not pickl_window('plex_result'):
|
||||||
log.error(error)
|
sleep(50)
|
||||||
import traceback
|
result = unpickle_me()
|
||||||
log.error("Traceback:\n%s" % traceback.format_exc())
|
if result is None:
|
||||||
raise
|
log.error('Error encountered, aborting')
|
||||||
|
|
|
@ -62,6 +62,8 @@ class Monitor_Window(Thread):
|
||||||
value.replace('PLEX_USERNAME-', '') or None
|
value.replace('PLEX_USERNAME-', '') or None
|
||||||
elif value.startswith('RUN_LIB_SCAN-'):
|
elif value.startswith('RUN_LIB_SCAN-'):
|
||||||
state.RUN_LIB_SCAN = value.replace('RUN_LIB_SCAN-', '')
|
state.RUN_LIB_SCAN = value.replace('RUN_LIB_SCAN-', '')
|
||||||
|
elif value == 'CONTEXT_menu':
|
||||||
|
queue.put('dummy?mode=context_menu')
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('%s not implemented' % value)
|
raise NotImplementedError('%s not implemented' % value)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -17,6 +17,7 @@ import variables as v
|
||||||
from downloadutils import DownloadUtils
|
from downloadutils import DownloadUtils
|
||||||
from PKC_listitem import convert_PKC_to_listitem
|
from PKC_listitem import convert_PKC_to_listitem
|
||||||
import plexdb_functions as plexdb
|
import plexdb_functions as plexdb
|
||||||
|
from context_entry import ContextMenu
|
||||||
import state
|
import state
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -142,6 +143,9 @@ class Playback_Starter(Thread):
|
||||||
params.get('view_offset'),
|
params.get('view_offset'),
|
||||||
directplay=True if params.get('play_directly') else False,
|
directplay=True if params.get('play_directly') else False,
|
||||||
node=False if params.get('node') == 'false' else True)
|
node=False if params.get('node') == 'false' else True)
|
||||||
|
elif mode == 'context_menu':
|
||||||
|
ContextMenu()
|
||||||
|
result = Playback_Successful()
|
||||||
except:
|
except:
|
||||||
log.error('Error encountered for mode %s, params %s'
|
log.error('Error encountered for mode %s, params %s'
|
||||||
% (mode, params))
|
% (mode, params))
|
||||||
|
|
Loading…
Reference in a new issue