Code optimization

This commit is contained in:
tomkat83 2017-03-08 10:51:21 +01:00
parent fd7e30f84c
commit 2a48a71673

View file

@ -942,7 +942,7 @@ def browse_plex_folder(key):
def __build_folder(xml_element): def __build_folder(xml_element):
url = "plugin://plugin.video.plexkodiconnect/" url = "plugin://%s/" % v.ADDON_ID
params = { params = {
'mode': "browse_plex_folder", 'mode': "browse_plex_folder",
'id': xml_element.attrib.get('key') 'id': xml_element.attrib.get('key')
@ -950,15 +950,14 @@ def __build_folder(xml_element):
listitem = ListItem(xml_element.attrib.get('title')) listitem = ListItem(xml_element.attrib.get('title'))
listitem.setArt({'thumb': xml_element.attrib.get('thumb'), listitem.setArt({'thumb': xml_element.attrib.get('thumb'),
'poster': xml_element.attrib.get('art')}) 'poster': xml_element.attrib.get('art')})
xbmcplugin.addDirectoryItem( xbmcplugin.addDirectoryItem(handle=HANDLE,
handle=HANDLE, url="%s?%s" % (url, urlencode(params)),
url="%s?%s" % (url, urlencode(params)), isFolder=True,
isFolder=True, listitem=listitem)
listitem=listitem)
def __build_item(xml_element): def __build_item(xml_element):
url = "plugin://plugin.video.plexkodiconnect/" url = "plugin://%s/" % v.ADDON_ID
api = API(xml_element) api = API(xml_element)
listitem = api.CreateListItemFromPlexItem() listitem = api.CreateListItemFromPlexItem()
api.AddStreamInfo(listitem) api.AddStreamInfo(listitem)
@ -969,10 +968,9 @@ def __build_item(xml_element):
'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')
} }
xbmcplugin.addDirectoryItem( xbmcplugin.addDirectoryItem(handle=HANDLE,
handle=HANDLE, url="%s?%s" % (url, urlencode(params)),
url="%s?%s" % (url, urlencode(params)), listitem=listitem)
listitem=listitem)
def enterPMS(): def enterPMS():