Some string encoding fixes

This commit is contained in:
croneter 2020-12-19 08:46:57 +01:00
parent 6904494e31
commit ae949c45ae
2 changed files with 13 additions and 25 deletions

View file

@ -12,9 +12,9 @@ import xbmcgui
LOG = getLogger('PLEX.transfer') LOG = getLogger('PLEX.transfer')
WINDOW = xbmcgui.Window(10000) WINDOW = xbmcgui.Window(10000)
WINDOW_UPSTREAM = 'plexkodiconnect.result.upstream'.encode('utf-8') WINDOW_UPSTREAM = 'plexkodiconnect.result.upstream'
WINDOW_DOWNSTREAM = 'plexkodiconnect.result.downstream'.encode('utf-8') WINDOW_DOWNSTREAM = 'plexkodiconnect.result.downstream'
WINDOW_COMMAND = 'plexkodiconnect.command'.encode('utf-8') WINDOW_COMMAND = 'plexkodiconnect.command'
KODIVERSION = int(xbmc.getInfoLabel("System.BuildVersion")[:2]) KODIVERSION = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
@ -145,15 +145,10 @@ def convert_pkc_to_listitem(pkc_listitem):
Insert a PKCListItem() and you will receive a valid XBMC listitem Insert a PKCListItem() and you will receive a valid XBMC listitem
""" """
data = pkc_listitem.data data = pkc_listitem.data
if KODIVERSION >= 18: listitem = xbmcgui.ListItem(label=data.get('label'),
listitem = xbmcgui.ListItem(label=data.get('label'), label2=data.get('label2'),
label2=data.get('label2'), path=data.get('path'),
path=data.get('path'), offscreen=True)
offscreen=True)
else:
listitem = xbmcgui.ListItem(label=data.get('label'),
label2=data.get('label2'),
path=data.get('path'))
if data['info']: if data['info']:
listitem.setInfo(**data['info']) listitem.setInfo(**data['info'])
for stream in data['stream_info']: for stream in data['stream_info']:
@ -163,7 +158,7 @@ def convert_pkc_to_listitem(pkc_listitem):
if data['art']: if data['art']:
listitem.setArt(data['art']) listitem.setArt(data['art'])
for key, value in data['property'].items(): for key, value in data['property'].items():
listitem.setProperty(key, cast(str, value)) listitem.setProperty(key, value)
if data['subtitles']: if data['subtitles']:
listitem.setSubtitles(data['subtitles']) listitem.setSubtitles(data['subtitles'])
if data['contextmenu']: if data['contextmenu']:

View file

@ -447,18 +447,11 @@ def create_listitem(item, as_tuple=True, offscreen=True,
Code from script.module.metadatautils, kodidb.py Code from script.module.metadatautils, kodidb.py
""" """
try: try:
if v.KODIVERSION > 17: liz = listitem(
liz = listitem( label=item.get("label", ""),
label=item.get("label", ""), label2=item.get("label2", ""),
label2=item.get("label2", ""), path=item['file'],
path=item['file'], offscreen=offscreen)
offscreen=offscreen)
else:
liz = listitem(
label=item.get("label", ""),
label2=item.get("label2", ""),
path=item['file'])
# only set isPlayable prop if really needed # only set isPlayable prop if really needed
if item.get("isFolder", False): if item.get("isFolder", False):
liz.setProperty('IsPlayable', 'false') liz.setProperty('IsPlayable', 'false')