parent
7bc5f3ad16
commit
8a08d85cce
2 changed files with 22 additions and 3 deletions
|
@ -3,8 +3,8 @@
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
<import addon="script.module.requests" version="2.9.1" />
|
<import addon="script.module.requests" version="2.9.1" />
|
||||||
<import addon="plugin.video.plexkodiconnect.movies" version="2.0.2" />
|
<import addon="plugin.video.plexkodiconnect.movies" version="2.0.4" />
|
||||||
<import addon="plugin.video.plexkodiconnect.tvshows" version="2.0.3" />
|
<import addon="plugin.video.plexkodiconnect.tvshows" version="2.0.4" />
|
||||||
</requires>
|
</requires>
|
||||||
<extension point="xbmc.python.pluginsource" library="default.py">
|
<extension point="xbmc.python.pluginsource" library="default.py">
|
||||||
<provides>video audio image</provides>
|
<provides>video audio image</provides>
|
||||||
|
|
|
@ -4,12 +4,31 @@ from cPickle import dumps, loads
|
||||||
|
|
||||||
from xbmcgui import Window
|
from xbmcgui import Window
|
||||||
from xbmc import log, LOGDEBUG
|
from xbmc import log, LOGDEBUG
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
WINDOW = Window(10000)
|
WINDOW = Window(10000)
|
||||||
PREFIX = 'PLEX.%s: ' % __name__
|
PREFIX = 'PLEX.%s: ' % __name__
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
def try_encode(input_str, encoding='utf-8'):
|
||||||
|
"""
|
||||||
|
Will try to encode input_str (in unicode) to encoding. This possibly
|
||||||
|
fails with e.g. Android TV's Python, which does not accept arguments for
|
||||||
|
string.encode()
|
||||||
|
|
||||||
|
COPY to avoid importing utils on calling default.py
|
||||||
|
"""
|
||||||
|
if isinstance(input_str, str):
|
||||||
|
# already encoded
|
||||||
|
return input_str
|
||||||
|
try:
|
||||||
|
input_str = input_str.encode(encoding, "ignore")
|
||||||
|
except TypeError:
|
||||||
|
input_str = input_str.encode()
|
||||||
|
return input_str
|
||||||
|
|
||||||
|
|
||||||
def pickl_window(property, value=None, clear=False):
|
def pickl_window(property, value=None, clear=False):
|
||||||
"""
|
"""
|
||||||
Get or set window property - thread safe! For use with Pickle
|
Get or set window property - thread safe! For use with Pickle
|
||||||
|
@ -20,7 +39,7 @@ def pickl_window(property, value=None, clear=False):
|
||||||
elif value is not None:
|
elif value is not None:
|
||||||
WINDOW.setProperty(property, value)
|
WINDOW.setProperty(property, value)
|
||||||
else:
|
else:
|
||||||
return WINDOW.getProperty(property)
|
return try_encode(WINDOW.getProperty(property))
|
||||||
|
|
||||||
|
|
||||||
def pickle_me(obj, window_var='plex_result'):
|
def pickle_me(obj, window_var='plex_result'):
|
||||||
|
|
Loading…
Reference in a new issue