Code optimization
This commit is contained in:
parent
3534a9b8f0
commit
762bb872f3
1 changed files with 4 additions and 8 deletions
|
@ -117,8 +117,7 @@ def Plex_Node(url, viewOffset, playdirectly=False, node=True):
|
||||||
return
|
return
|
||||||
if viewOffset != '0':
|
if viewOffset != '0':
|
||||||
try:
|
try:
|
||||||
viewOffset = int(v.PLEX_TO_KODI_TIMEFACTOR *
|
viewOffset = int(v.PLEX_TO_KODI_TIMEFACTOR * float(viewOffset))
|
||||||
float(viewOffset))
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
@ -964,24 +963,21 @@ 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_CLIP:
|
||||||
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 = 'plugin://%s?%s' % (v.ADDON_ID, urlencode(params))
|
|
||||||
else:
|
else:
|
||||||
params = {
|
params = {
|
||||||
'filename': api.getKey(),
|
'filename': api.getKey(),
|
||||||
'id': api.getRatingKey(),
|
'id': api.getRatingKey(),
|
||||||
'dbid': listitem.getProperty('dbid') or None,
|
'dbid': listitem.getProperty('dbid') or '',
|
||||||
'mode': "play"
|
'mode': "play"
|
||||||
}
|
}
|
||||||
url = "plugin://%s?%s" % (v.ADDON_ID, urlencode(params))
|
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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue