[gnome-music/wip/jfelder/mpris-cleanup: 44/67] mpris: Use song favourite status to describe userRating
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-cleanup: 44/67] mpris: Use song favourite status to describe userRating
- Date: Fri, 5 Apr 2019 20:09:39 +0000 (UTC)
commit 3a855f095fd36ad9c4e2bc1b3ac21fe682cfec28
Author: Jean Felder <jfelder src gnome org>
Date: Tue Sep 4 18:32:35 2018 +0200
mpris: Use song favourite status to describe userRating
Music does not handle user ratings but the favourite status can be
used instead.
Set userRating to 1.0 is song is favourite, 0.0 otherwise.
gnomemusic/mpris.py | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 5998037a..fe9c9649 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -327,12 +327,8 @@ class MPRIS(DBusInterface):
except:
pass
- try:
- userRating = media.get_rating()
- assert userRating is not None
- metadata['xesam:userRating'] = GLib.Variant('d', userRating)
- except:
- pass
+ user_rating = 1.0 if media.get_favourite() else 0.0
+ metadata['xesam:userRating'] = GLib.Variant('d', user_rating)
try:
title = utils.get_media_title(media)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]