[gnome-music/wip/jfelder/mpris-fix-lastused] mpris: Fix lastUsed metadata
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-fix-lastused] mpris: Fix lastUsed metadata
- Date: Wed, 29 May 2019 19:42:30 +0000 (UTC)
commit b9654fd80674f0e72ed94de1f4416f08d1b09593
Author: Jean Felder <jfelder src gnome org>
Date: Wed May 29 20:34:34 2019 +0200
mpris: Fix lastUsed metadata
Commit 39608d44 highlighted a bug which was never triggered before:
the lastUsed metadata is badly formatted. Indeed, the last_played
method of Grl.Media returns a GLib.DateTime. This date needs to be
formatted into a string in order to be used by MPRIS.
This bug had never been encountered because of the presence of a
try/except block.
Fix the issue by formatting the date into a string in ISO 8601
format.
Closes: #294
gnomemusic/mpris.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 8dcdbecc..8a94cd62 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -292,7 +292,8 @@ class MediaPlayer2Service(Server):
last_played = media.get_last_played()
if last_played is not None:
- metadata['xesam:lastUsed'] = GLib.Variant('s', last_played)
+ last_played_str = last_played.format("%FT%T")
+ metadata['xesam:lastUsed'] = GLib.Variant('s', last_played_str)
art_url = media.get_thumbnail()
if art_url is not None:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]