Merge pull request #899 from croneter/fix-listitem

Fix for Kodi 17 Krypton TypeError on playback start: 'offscreen' is an invalid keyword argument for this function
This commit is contained in:
croneter 2019-06-16 14:16:35 +02:00 committed by GitHub
commit f506b971ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,6 +16,7 @@ WINDOW = xbmcgui.Window(10000)
WINDOW_UPSTREAM = 'plexkodiconnect.result.upstream'.encode('utf-8') WINDOW_UPSTREAM = 'plexkodiconnect.result.upstream'.encode('utf-8')
WINDOW_DOWNSTREAM = 'plexkodiconnect.result.downstream'.encode('utf-8') WINDOW_DOWNSTREAM = 'plexkodiconnect.result.downstream'.encode('utf-8')
WINDOW_COMMAND = 'plexkodiconnect.command'.encode('utf-8') WINDOW_COMMAND = 'plexkodiconnect.command'.encode('utf-8')
KODIVERSION = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
def cast(func, value): def cast(func, value):
@ -145,10 +146,15 @@ 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
listitem = xbmcgui.ListItem(label=data.get('label'), if KODIVERSION >= 18:
label2=data.get('label2'), listitem = xbmcgui.ListItem(label=data.get('label'),
path=data.get('path'), label2=data.get('label2'),
offscreen=True) path=data.get('path'),
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']: