[gnome-music/wip/mschraal/mpris-object-path] mpris: Fix object path for track ids



commit 02ad7bcd2bd5fcb4aadf5faacda46e19ed536fd9
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri Jan 12 00:42:13 2018 +0100

    mpris: Fix object path for track ids
    
    Follow the MPRIS2 spec regarding TrackList track id's.
    
    Closes #100

 gnomemusic/mpris.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 87317ce..5d4a1e5 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -336,8 +336,13 @@ class MediaPlayer2Service(Server):
 
     @log
     def _get_media_id(self, media):
-        return '/org/mpris/MediaPlayer2/TrackList/%s' % \
-            (media.get_id() if media else 'NoTrack')
+        if media:
+            trackid = "/org/gnome/GnomeMusic/Tracklist/{}".format(
+                media.get_id())
+        else:
+            trackid = "/org/mpris/MediaPlayer2/TrackList/NoTrack"
+
+        return trackid
 
     @log
     def _get_media_from_id(self, track_id):


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