[gnome-music/wip/jfelder/tracker3: 6/22] grltrackerwrapper: Port album discs query to new Tracker/Grilo expectatives
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/tracker3: 6/22] grltrackerwrapper: Port album discs query to new Tracker/Grilo expectatives
- Date: Mon, 24 Aug 2020 16:14:17 +0000 (UTC)
commit 52b75baeca62219d8544551a5ec9a9a8a2f1ab0b
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun May 31 15:17:52 2020 +0200
grltrackerwrapper: Port album discs query to new Tracker/Grilo expectatives
For Tracker 3, the miner service must be queried specifically, and it is better
to specify here that we are querying from the tracker:Audio graph.
For Grilo, the variable names are slightly different, and IDs are now URNs, not
tracker:id()s.
gnomemusic/grilowrappers/grltrackerwrapper.py | 30 ++++++++++++++++++---------
1 file changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index ce50bd3e..f7e25e73 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -633,19 +633,29 @@ class GrlTrackerWrapper(GObject.GObject):
album_id = media.get_id()
query = """
- SELECT DISTINCT
- rdf:type(?song)
- tracker:id(?album) AS ?id
- nmm:setNumber(nmm:musicAlbumDisc(?song)) as ?album_disc_number
+ SELECT
+ ?type ?id ?albumDiscNumber
WHERE {
- ?song a nmm:MusicPiece;
- nmm:musicAlbum ?album .
- FILTER ( tracker:id(?album) = %(album_id)s )
- %(location_filter)s
+ SERVICE <dbus:org.freedesktop.Tracker3.Miner.Files> {
+ GRAPH tracker:Audio {
+ SELECT DISTINCT
+ %(media_type)s AS ?type
+ ?album AS ?id
+ nmm:setNumber(nmm:musicAlbumDisc(?song))
+ AS ?albumDiscNumber
+ WHERE {
+ ?song a nmm:MusicPiece;
+ nmm:musicAlbum ?album .
+ FILTER ( ?album = <%(album_id)s> )
+ %(location_filter)s
+ }
+ ORDER BY ?albumDiscNumber
+ }
+ }
}
- ORDER BY ?album_disc_number
""".replace('\n', ' ').strip() % {
- 'album_id': int(album_id),
+ "media_type": int(Grl.MediaType.CONTAINER),
+ "album_id": album_id,
'location_filter': self._tracker_wrapper.location_filter()
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]