commit
58b15e69a9
2 changed files with 19 additions and 12 deletions
|
@ -84,7 +84,7 @@ def show_main_menu(content_type=None):
|
||||||
# Get nodes from the window props
|
# Get nodes from the window props
|
||||||
totalnodes = int(utils.window('Plex.nodes.total') or 0)
|
totalnodes = int(utils.window('Plex.nodes.total') or 0)
|
||||||
for i in range(totalnodes):
|
for i in range(totalnodes):
|
||||||
path = utils.window('Plex.nodes.%s.content' % i)
|
path = utils.window('Plex.nodes.%s.index' % i)
|
||||||
if not path:
|
if not path:
|
||||||
continue
|
continue
|
||||||
label = utils.window('Plex.nodes.%s.title' % i)
|
label = utils.window('Plex.nodes.%s.title' % i)
|
||||||
|
@ -114,9 +114,9 @@ def show_main_menu(content_type=None):
|
||||||
continue
|
continue
|
||||||
# Add ANOTHER menu item that uses add-on paths instead of direct
|
# Add ANOTHER menu item that uses add-on paths instead of direct
|
||||||
# paths in order to let the user navigate into all submenus
|
# paths in order to let the user navigate into all submenus
|
||||||
addon_path = utils.window('Plex.nodes.%s.addon_path' % i)
|
addon_index = utils.window('Plex.nodes.%s.addon_index' % i)
|
||||||
# Append "(More...)" to the label
|
# Append "(More...)" to the label
|
||||||
directory_item('%s (%s)' % (label, utils.lang(22082)), addon_path)
|
directory_item('%s (%s)' % (label, utils.lang(22082)), addon_index)
|
||||||
# Playlists
|
# Playlists
|
||||||
if content_type != 'image':
|
if content_type != 'image':
|
||||||
path = 'plugin://%s?mode=playlists' % v.ADDON_ID
|
path = 'plugin://%s?mode=playlists' % v.ADDON_ID
|
||||||
|
|
|
@ -246,20 +246,27 @@ class Section(object):
|
||||||
}
|
}
|
||||||
if not self.sync_to_kodi:
|
if not self.sync_to_kodi:
|
||||||
args['synched'] = 'false'
|
args['synched'] = 'false'
|
||||||
addon_path = self.addon_path(args)
|
addon_index = self.addon_path(args)
|
||||||
if self.sync_to_kodi and self.section_type in v.PLEX_VIDEOTYPES:
|
if self.sync_to_kodi and self.section_type in v.PLEX_VIDEOTYPES:
|
||||||
path = 'library://video/Plex-%s' % self.section_id
|
path = 'library://video/Plex-{0}/{0}_all.xml'
|
||||||
|
path = path.format(self.section_id)
|
||||||
|
index = 'library://video/Plex-%s' % self.section_id
|
||||||
else:
|
else:
|
||||||
# No xmls to link to - let's show the listings on the fly
|
# No xmls to link to - let's show the listings on the fly
|
||||||
path = addon_path
|
index = addon_index
|
||||||
|
args['key'] = '/library/sections/%s/all' % self.section_id
|
||||||
|
path = self.addon_path(args)
|
||||||
|
# .index will list all possible nodes for this library
|
||||||
|
utils.window('%s.index' % self.node, value=index)
|
||||||
utils.window('%s.title' % self.node, value=self.name)
|
utils.window('%s.title' % self.node, value=self.name)
|
||||||
utils.window('%s.type' % self.node, value=self.content)
|
utils.window('%s.type' % self.node, value=self.content)
|
||||||
utils.window('%s.content' % self.node, value=path)
|
utils.window('%s.content' % self.node, value=path)
|
||||||
|
# .path leads to all elements of this library
|
||||||
utils.window('%s.path' % self.node,
|
utils.window('%s.path' % self.node,
|
||||||
value='ActivateWindow(Videos,%s,return)' % path)
|
value='ActivateWindow(Videos,%s,return)' % path)
|
||||||
utils.window('%s.id' % self.node, value=str(self.section_id))
|
utils.window('%s.id' % self.node, value=str(self.section_id))
|
||||||
# To let the user navigate into this node when selecting widgets
|
# To let the user navigate into this node when selecting widgets
|
||||||
utils.window('%s.addon_path' % self.node, value=addon_path)
|
utils.window('%s.addon_index' % self.node, value=addon_index)
|
||||||
if not self.sync_to_kodi:
|
if not self.sync_to_kodi:
|
||||||
self.remove_files_from_kodi()
|
self.remove_files_from_kodi()
|
||||||
return
|
return
|
||||||
|
@ -307,7 +314,7 @@ class Section(object):
|
||||||
xml = getattr(nodes, 'node_%s' % node_type)(self, node_name)
|
xml = getattr(nodes, 'node_%s' % node_type)(self, node_name)
|
||||||
self._write_xml(xml, xml_name)
|
self._write_xml(xml, xml_name)
|
||||||
self.order += 1
|
self.order += 1
|
||||||
self._window_node(path, node_name, node_type)
|
self._window_node(path, node_name, node_type, pms_node)
|
||||||
|
|
||||||
def _write_xml(self, xml, xml_name):
|
def _write_xml(self, xml, xml_name):
|
||||||
LOG.debug('Creating xml for section %s: %s', self.name, xml_name)
|
LOG.debug('Creating xml for section %s: %s', self.name, xml_name)
|
||||||
|
@ -329,17 +336,17 @@ class Section(object):
|
||||||
utils.indent(xml)
|
utils.indent(xml)
|
||||||
etree.ElementTree(xml).write(self.playlist_path, encoding='utf-8')
|
etree.ElementTree(xml).write(self.playlist_path, encoding='utf-8')
|
||||||
|
|
||||||
def _window_node(self, path, node_name, node_type):
|
def _window_node(self, path, node_name, node_type, pms_node):
|
||||||
"""
|
"""
|
||||||
Will save this section's node to the Kodi window variables
|
Will save this section's node to the Kodi window variables
|
||||||
|
|
||||||
Uses the same conventions/logic as Emby for Kodi does
|
Uses the same conventions/logic as Emby for Kodi does
|
||||||
"""
|
"""
|
||||||
if self.section_type == v.PLEX_TYPE_ARTIST:
|
if pms_node or not self.sync_to_kodi:
|
||||||
window_path = 'ActivateWindow(Music,%s,return)' % path
|
|
||||||
elif self.section_type == v.PLEX_TYPE_PHOTO:
|
|
||||||
# Check: elif node_type in ('browse', 'homevideos', 'photos'):
|
# Check: elif node_type in ('browse', 'homevideos', 'photos'):
|
||||||
window_path = path
|
window_path = path
|
||||||
|
elif self.section_type == v.PLEX_TYPE_ARTIST:
|
||||||
|
window_path = 'ActivateWindow(Music,%s,return)' % path
|
||||||
else:
|
else:
|
||||||
window_path = 'ActivateWindow(Videos,%s,return)' % path
|
window_path = 'ActivateWindow(Videos,%s,return)' % path
|
||||||
# if node_type == 'all':
|
# if node_type == 'all':
|
||||||
|
|
Loading…
Reference in a new issue