Skip to content

Commit

Permalink
better, test only one time, use label for podcasts
Browse files Browse the repository at this point in the history
  • Loading branch information
lusum committed Mar 3, 2021
1 parent aa17b87 commit a3864cb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions resources/lib/ampache_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ def addPlayLinks(elem, object_type , object_subtype=None):

elem_type = ut.otype_to_type(object_type,object_subtype)

#we don't use sort method for track cause songs are already sorted
#by the server and it make a mess in random playlists
if elem_type == "video":
xbmcplugin.addSortMethod(int(sys.argv[1]),xbmcplugin.SORT_METHOD_TITLE)
elif elem_type == "podcast_episode":
xbmcplugin.addSortMethod(int(sys.argv[1]),xbmcplugin.SORT_METHOD_LABEL)

for node in elem.iter(elem_type):
object_id = node.attrib["id"]
if object_id is None or object_id == "":
Expand Down Expand Up @@ -291,14 +298,9 @@ def addPlayLinks(elem, object_type , object_subtype=None):

if cm != []:
liz.addContextMenuItems(cm)
#we don't use sort method for track cause songs are already sorted
#by the server and it make a mess in random playlists
elif elem_type == "video":
liz.setInfo( type="video", infoLabels=get_infolabels("videos", node) )
liz.setMimeType(node.findtext("mime"))
xbmcplugin.addSortMethod(int(sys.argv[1]),xbmcplugin.SORT_METHOD_TITLE)
elif elem_type == "podcast_episode":
xbmcplugin.addSortMethod(int(sys.argv[1]),xbmcplugin.SORT_METHOD_TITLE)

track_parameters = { "mode": 200, "play_url" : play_url}
url = sys.argv[0] + '?' + urllib.parse.urlencode(track_parameters)
Expand Down

0 comments on commit a3864cb

Please sign in to comment.