[gnome-music/wip/jfelder/tracker3: 10/34] mpris: Generate a playlist d-bus path compatible with tracker3 ids




commit 6c28208a65ff4aedbf0dbc9ba0ae3e3ba15a51e0
Author: Jean Felder <jfelder src gnome org>
Date:   Mon Aug 24 18:01:01 2020 +0200

    mpris: Generate a playlist d-bus path compatible with tracker3 ids
    
    With tracker 2, a playlist id is an integer. With tracker 3, a
    playlist id is a string similar to
    "urn:bnode:d87b381e-686a-4157-b353-e2f260c97068". This id cannot be
    directly used to generate a compatible d-bus path because it contains
    ":" and "-" characters. In that case, the string is split to keep only
    the last part of the id and the "-" characters are removed.
    
    Closes: #409

 gnomemusic/mpris.py | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index ca30028d..8a8b90c9 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -434,6 +434,7 @@ class MPRIS(DBusInterface):
 
         # Smart Playlists do not have an id
         pl_id = playlist.props.pl_id or playlist.props.tag_text
+        pl_id = pl_id.rsplit(":")[-1].replace("-", "")
         return "/org/gnome/GnomeMusic/Playlist/{}".format(pl_id)
 
     def _get_mpris_playlist_from_playlist(self, playlist):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]