Merge pull request #1730 from croneter/py3-reuselanguageinvoker
Use addon.xml `reuselanguageinvoker` to turn add-on snappier
This commit is contained in:
commit
665ebbc655
2 changed files with 8 additions and 13 deletions
|
@ -3,8 +3,8 @@
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="3.0.0"/>
|
<import addon="xbmc.python" version="3.0.0"/>
|
||||||
<import addon="script.module.requests" version="2.22.0+matrix.1" />
|
<import addon="script.module.requests" version="2.22.0+matrix.1" />
|
||||||
<import addon="plugin.video.plexkodiconnect.movies" version="3.0.1" />
|
<import addon="plugin.video.plexkodiconnect.movies" version="3.0.2" />
|
||||||
<import addon="plugin.video.plexkodiconnect.tvshows" version="3.0.1" />
|
<import addon="plugin.video.plexkodiconnect.tvshows" version="3.0.2" />
|
||||||
<import addon="metadata.themoviedb.org.python" version="1.3.1+matrix.1" />
|
<import addon="metadata.themoviedb.org.python" version="1.3.1+matrix.1" />
|
||||||
</requires>
|
</requires>
|
||||||
<extension point="xbmc.python.pluginsource" library="default.py">
|
<extension point="xbmc.python.pluginsource" library="default.py">
|
||||||
|
@ -20,6 +20,8 @@
|
||||||
</item>
|
</item>
|
||||||
</extension>
|
</extension>
|
||||||
<extension point="xbmc.addon.metadata">
|
<extension point="xbmc.addon.metadata">
|
||||||
|
<!-- see e.g. https://github.com/xbmc/xbmc/pull/14136 -->
|
||||||
|
<reuselanguageinvoker>true</reuselanguageinvoker>
|
||||||
<assets>
|
<assets>
|
||||||
<icon>icon.png</icon>
|
<icon>icon.png</icon>
|
||||||
<fanart>fanart.jpg</fanart>
|
<fanart>fanart.jpg</fanart>
|
||||||
|
|
15
default.py
15
default.py
|
@ -1,6 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
from builtins import object
|
from builtins import object
|
||||||
import logging
|
import logging
|
||||||
from sys import argv
|
from sys import argv
|
||||||
|
@ -12,15 +10,10 @@ import xbmcplugin
|
||||||
|
|
||||||
from resources.lib import entrypoint, utils, transfer, variables as v, loghandler
|
from resources.lib import entrypoint, utils, transfer, variables as v, loghandler
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
loghandler.config()
|
loghandler.config()
|
||||||
LOG = logging.getLogger('PLEX.default')
|
LOG = logging.getLogger('PLEX.default')
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
HANDLE = int(argv[1])
|
|
||||||
|
|
||||||
|
|
||||||
class Main(object):
|
class Main(object):
|
||||||
# MAIN ENTRY POINT
|
# MAIN ENTRY POINT
|
||||||
|
@ -158,21 +151,21 @@ class Main(object):
|
||||||
"""
|
"""
|
||||||
Start up playback_starter in main Python thread
|
Start up playback_starter in main Python thread
|
||||||
"""
|
"""
|
||||||
request = '%s&handle=%s' % (argv[2], HANDLE)
|
request = '%s&handle=%s' % (argv[2], int(argv[1]))
|
||||||
# Put the request into the 'queue'
|
# Put the request into the 'queue'
|
||||||
transfer.plex_command('PLAY-%s' % request)
|
transfer.plex_command('PLAY-%s' % request)
|
||||||
if HANDLE == -1:
|
if int(argv[1]) == -1:
|
||||||
# Handle -1 received, not waiting for main thread
|
# Handle -1 received, not waiting for main thread
|
||||||
return
|
return
|
||||||
# Wait for the result from the main PKC thread
|
# Wait for the result from the main PKC thread
|
||||||
result = transfer.wait_for_transfer(source='main')
|
result = transfer.wait_for_transfer(source='main')
|
||||||
if result is True:
|
if result is True:
|
||||||
xbmcplugin.setResolvedUrl(HANDLE, False, xbmcgui.ListItem())
|
xbmcplugin.setResolvedUrl(int(argv[1]), False, xbmcgui.ListItem())
|
||||||
# Tell main thread that we're done
|
# Tell main thread that we're done
|
||||||
transfer.send(True, target='main')
|
transfer.send(True, target='main')
|
||||||
else:
|
else:
|
||||||
# Received a xbmcgui.ListItem()
|
# Received a xbmcgui.ListItem()
|
||||||
xbmcplugin.setResolvedUrl(HANDLE, True, result)
|
xbmcplugin.setResolvedUrl(int(argv[1]), True, result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue