mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-12 21:26:10 +00:00
Merge pull request #180 from sualfred/develop
added "playlists" to wnodes
This commit is contained in:
commit
65b71b5885
1 changed files with 18 additions and 18 deletions
|
@ -176,7 +176,7 @@ class Views(object):
|
||||||
return libraries
|
return libraries
|
||||||
|
|
||||||
def get_views(self):
|
def get_views(self):
|
||||||
|
|
||||||
''' Get the media folders. Add or remove them. Do not proceed if issue getting libraries.
|
''' Get the media folders. Add or remove them. Do not proceed if issue getting libraries.
|
||||||
'''
|
'''
|
||||||
media = {
|
media = {
|
||||||
|
@ -212,14 +212,14 @@ class Views(object):
|
||||||
|
|
||||||
if view[0] not in self.sync['SortedViews']:
|
if view[0] not in self.sync['SortedViews']:
|
||||||
removed.append(view[0])
|
removed.append(view[0])
|
||||||
|
|
||||||
if removed:
|
if removed:
|
||||||
event('RemoveLibrary', {'Id': ','.join(removed)})
|
event('RemoveLibrary', {'Id': ','.join(removed)})
|
||||||
|
|
||||||
save_sync(self.sync)
|
save_sync(self.sync)
|
||||||
|
|
||||||
def get_nodes(self):
|
def get_nodes(self):
|
||||||
|
|
||||||
''' Set up playlists, video nodes, window prop.
|
''' Set up playlists, video nodes, window prop.
|
||||||
'''
|
'''
|
||||||
node_path = xbmc.translatePath("special://profile/library/video").decode('utf-8')
|
node_path = xbmc.translatePath("special://profile/library/video").decode('utf-8')
|
||||||
|
@ -258,18 +258,18 @@ class Views(object):
|
||||||
for single in [{'Name': _('fav_movies'), 'Tag': "Favorite movies", 'Media': "movies"},
|
for single in [{'Name': _('fav_movies'), 'Tag': "Favorite movies", 'Media': "movies"},
|
||||||
{'Name': _('fav_tvshows'), 'Tag': "Favorite tvshows", 'Media': "tvshows"},
|
{'Name': _('fav_tvshows'), 'Tag': "Favorite tvshows", 'Media': "tvshows"},
|
||||||
{'Name': _('fav_episodes'), 'Tag': "Favorite episodes", 'Media': "episodes"}]:
|
{'Name': _('fav_episodes'), 'Tag': "Favorite episodes", 'Media': "episodes"}]:
|
||||||
|
|
||||||
self.add_single_node(node_path, index, "favorites", single)
|
self.add_single_node(node_path, index, "favorites", single)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
self.window_nodes()
|
self.window_nodes()
|
||||||
|
|
||||||
def add_playlist(self, path, view, mixed=False):
|
def add_playlist(self, path, view, mixed=False):
|
||||||
|
|
||||||
''' Create or update the xps file.
|
''' Create or update the xps file.
|
||||||
'''
|
'''
|
||||||
file = os.path.join(path, "emby%s%s.xsp" % (view['Media'], view['Id']))
|
file = os.path.join(path, "emby%s%s.xsp" % (view['Media'], view['Id']))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
xml = etree.parse(file).getroot()
|
xml = etree.parse(file).getroot()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -523,7 +523,7 @@ class Views(object):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
etree.SubElement(root, 'group').text = "genres"
|
etree.SubElement(root, 'group').text = "genres"
|
||||||
|
|
||||||
def node_unwatched(self, root):
|
def node_unwatched(self, root):
|
||||||
|
|
||||||
for rule in root.findall('.//order'):
|
for rule in root.findall('.//order'):
|
||||||
|
@ -581,7 +581,7 @@ class Views(object):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
etree.SubElement(root, 'limit').text = str(self.limit)
|
etree.SubElement(root, 'limit').text = str(self.limit)
|
||||||
|
|
||||||
for rule in root.findall('.//rule'):
|
for rule in root.findall('.//rule'):
|
||||||
if rule.attrib['field'] == 'playcount':
|
if rule.attrib['field'] == 'playcount':
|
||||||
rule.find('value').text = "0"
|
rule.find('value').text = "0"
|
||||||
|
@ -630,7 +630,7 @@ class Views(object):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
etree.SubElement(root, 'limit').text = str(self.limit)
|
etree.SubElement(root, 'limit').text = str(self.limit)
|
||||||
|
|
||||||
for rule in root.findall('.//rule'):
|
for rule in root.findall('.//rule'):
|
||||||
if rule.attrib['field'] == 'inprogress':
|
if rule.attrib['field'] == 'inprogress':
|
||||||
break
|
break
|
||||||
|
@ -721,14 +721,14 @@ class Views(object):
|
||||||
|
|
||||||
if view['Media'] in ('movies', 'tvshows'):
|
if view['Media'] in ('movies', 'tvshows'):
|
||||||
self.window_wnode(windex, view, *node)
|
self.window_wnode(windex, view, *node)
|
||||||
|
|
||||||
if view['Media'] in ('movies', 'tvshows'):
|
if view['Media'] in ('movies', 'tvshows'):
|
||||||
windex += 1
|
windex += 1
|
||||||
|
|
||||||
elif view['Media'] == 'music':
|
elif view['Media'] == 'music':
|
||||||
self.window_node(index, view, 'music')
|
self.window_node(index, view, 'music')
|
||||||
else: # Dynamic entry
|
else: # Dynamic entry
|
||||||
if view['Media'] in ('homevideos', 'books', 'audiobooks'):
|
if view['Media'] in ('homevideos', 'books', 'audiobooks', 'playlists'):
|
||||||
self.window_wnode(windex, view, 'browse')
|
self.window_wnode(windex, view, 'browse')
|
||||||
windex += 1
|
windex += 1
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ class Views(object):
|
||||||
for single in [{'Name': _('fav_movies'), 'Tag': "Favorite movies", 'Media': "movies"},
|
for single in [{'Name': _('fav_movies'), 'Tag': "Favorite movies", 'Media': "movies"},
|
||||||
{'Name': _('fav_tvshows'), 'Tag': "Favorite tvshows", 'Media': "tvshows"},
|
{'Name': _('fav_tvshows'), 'Tag': "Favorite tvshows", 'Media': "tvshows"},
|
||||||
{'Name': _('fav_episodes'), 'Tag': "Favorite episodes", 'Media': "episodes"}]:
|
{'Name': _('fav_episodes'), 'Tag': "Favorite episodes", 'Media': "episodes"}]:
|
||||||
|
|
||||||
self.window_single_node(index, "favorites", single)
|
self.window_single_node(index, "favorites", single)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
|
@ -806,16 +806,16 @@ class Views(object):
|
||||||
window('%s.type' % window_prop, item_type)
|
window('%s.type' % window_prop, item_type)
|
||||||
|
|
||||||
def window_wnode(self, index, view, node=None, node_label=None):
|
def window_wnode(self, index, view, node=None, node_label=None):
|
||||||
|
|
||||||
''' Similar to window_node, but does not contain music, musicvideos.
|
''' Similar to window_node, but does not contain music, musicvideos.
|
||||||
Contains books, audiobooks.
|
Contains books, audiobooks.
|
||||||
'''
|
'''
|
||||||
if view['Media'] in ('homevideos', 'photos', 'books', 'audiobooks'):
|
if view['Media'] in ('homevideos', 'photos', 'books', 'audiobooks', 'playlists'):
|
||||||
path = self.window_browse(view, None if node in ('all', 'browse') else node)
|
path = self.window_browse(view, None if node in ('all', 'browse') else node)
|
||||||
else:
|
else:
|
||||||
path = self.window_path(view, node)
|
path = self.window_path(view, node)
|
||||||
|
|
||||||
if node in ('browse', 'homevideos', 'photos', 'books', 'audiobooks'):
|
if node in ('browse', 'homevideos', 'photos', 'books', 'audiobooks', 'playlists'):
|
||||||
window_path = path
|
window_path = path
|
||||||
else:
|
else:
|
||||||
window_path = "ActivateWindow(Videos,%s,return)" % path
|
window_path = "ActivateWindow(Videos,%s,return)" % path
|
||||||
|
@ -900,7 +900,7 @@ class Views(object):
|
||||||
'''
|
'''
|
||||||
total = int(window((name or 'Emby.nodes') + '.total') or 0)
|
total = int(window((name or 'Emby.nodes') + '.total') or 0)
|
||||||
props = [
|
props = [
|
||||||
|
|
||||||
"index","id","path","artwork","title","content","type"
|
"index","id","path","artwork","title","content","type"
|
||||||
"inprogress.content","inprogress.title",
|
"inprogress.content","inprogress.title",
|
||||||
"inprogress.content","inprogress.path",
|
"inprogress.content","inprogress.path",
|
||||||
|
@ -925,7 +925,7 @@ class Views(object):
|
||||||
LOG.info("DELETE playlist %s", path)
|
LOG.info("DELETE playlist %s", path)
|
||||||
|
|
||||||
def delete_playlists(self):
|
def delete_playlists(self):
|
||||||
|
|
||||||
''' Remove all emby playlists.
|
''' Remove all emby playlists.
|
||||||
'''
|
'''
|
||||||
path = xbmc.translatePath("special://profile/playlists/video/").decode('utf-8')
|
path = xbmc.translatePath("special://profile/playlists/video/").decode('utf-8')
|
||||||
|
|
Loading…
Reference in a new issue