Commit b9654fd8 authored by Jean Felder's avatar Jean Felder

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

Closes: #294
parent 156f5dde
Pipeline #85040 passed with stages
in 9 minutes and 2 seconds
......@@ -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:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment