Rewire playback start when browsing by folder

This commit is contained in:
tomkat83 2017-03-09 11:12:46 +01:00
parent 0fc9f31aca
commit 3534a9b8f0

View file

@ -964,17 +964,24 @@ def __build_item(xml_element):
listitem = api.CreateListItemFromPlexItem() listitem = api.CreateListItemFromPlexItem()
api.AddStreamInfo(listitem) api.AddStreamInfo(listitem)
api.set_listitem_artwork(listitem) api.set_listitem_artwork(listitem)
if api.getType() != v.PLEX_TYPE_PHOTO: if api.getType() == v.PLEX_TYPE_PHOTO:
url = "plugin://%s/" % v.ADDON_ID url = listitem.getProperty('path')
elif api.getType() == v.PLEX_TYPE_CLIP:
params = { params = {
'mode': "Plex_Node", 'mode': "Plex_Node",
'id': xml_element.attrib.get('key'), 'id': xml_element.attrib.get('key'),
'viewOffset': xml_element.attrib.get('viewOffset', '0'), 'viewOffset': xml_element.attrib.get('viewOffset', '0'),
'plex_type': xml_element.attrib.get('type') 'plex_type': xml_element.attrib.get('type')
} }
url = '%s?%s' % (url, urlencode(params)) url = 'plugin://%s?%s' % (v.ADDON_ID, urlencode(params))
else: else:
url = listitem.getProperty('path') params = {
'filename': api.getKey(),
'id': api.getRatingKey(),
'dbid': listitem.getProperty('dbid') or None,
'mode': "play"
}
url = "plugin://%s?%s" % (v.ADDON_ID, urlencode(params))
xbmcplugin.addDirectoryItem(handle=HANDLE, xbmcplugin.addDirectoryItem(handle=HANDLE,
url=url, url=url,
listitem=listitem) listitem=listitem)