[gnome-music/wip/mschraal/core: 8/177] coresong: Add favorite



commit 215f1f3617d1915f59efbadac1d398d8047e5c78
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed May 8 17:51:58 2019 +0200

    coresong: Add favorite

 gnomemusic/coregrilo.py | 8 +++++++-
 gnomemusic/coresong.py  | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index 003a5acc..e520bcb0 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -72,7 +72,13 @@ class CoreGrilo(GObject.GObject):
                 nie:title(nmm:musicAlbum(?song)) AS ?album
                 nfo:duration(?song) AS ?duration
                 nie:usageCounter(?song) AS ?play_count
-            WHERE { ?song a nmm:MusicPiece . }
+            WHERE {
+                ?song a nmm:MusicPiece .
+                OPTIONAL {
+                    ?song nao:hasTag ?tag .
+                    FILTER (?tag = nao:predefined-tag-favorite)
+                }
+            }
         """.replace('\n', ' ').strip()
 
         print(query)
diff --git a/gnomemusic/coresong.py b/gnomemusic/coresong.py
index 2a2f637d..a071fd6d 100644
--- a/gnomemusic/coresong.py
+++ b/gnomemusic/coresong.py
@@ -28,6 +28,7 @@ class CoreSong(GObject.GObject):
 
         self.props.album = utils.get_album_title(media)
         self.props.artist = utils.get_artist_name(media)
+        self.props.favorite = self._media.get_favourite()
         self.props.play_count = self._media.get_play_count()
         self.props.title = utils.get_media_title(self._media)
         self.props.url = self._media.get_url()


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