[gnome-music/wip/jfelder/3-38-fix-add-song-to-playlist: 1/2] grltrackerplaylists: Fix update playlist query when adding songs
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/3-38-fix-add-song-to-playlist: 1/2] grltrackerplaylists: Fix update playlist query when adding songs
- Date: Mon, 22 Mar 2021 13:51:38 +0000 (UTC)
commit dc09ad36418cb78e985e3b81387cd34f733af2ab
Author: Jean Felder <jfelder src gnome org>
Date: Wed Feb 24 16:29:04 2021 +0100
grltrackerplaylists: Fix update playlist query when adding songs
When songs are added to a user playlist, a query is performed to
update the playlist and display the new songs. However, this query
does not work because the url parameter is not correctly selected.
This commit fixes the query by adding the following elements:
- select url in the tracker:Audio graph
- move the filter of the song id in tracker:Audio graph selection to
ensure that the resource is available
- add a playlist id filter to prevent selection of the same song
several times if it is already part of an other playlist
Closes: https://gitlab.gnome.org/GNOME/gnome-music/-/issues/445
gnomemusic/grilowrappers/grltrackerplaylists.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerplaylists.py b/gnomemusic/grilowrappers/grltrackerplaylists.py
index 096da9d58..835d96852 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -605,6 +605,7 @@ class Playlist(GObject.GObject):
return
media_id = coresong.props.media.get_id()
+ pl_id = self.props.pl_id
miner_fs_busname = self._tracker_wrapper.props.miner_fs_busname
query = """
SELECT
@@ -632,10 +633,14 @@ class Playlist(GObject.GObject):
nmm:artistName(nmm:artist(?song)) AS ?artist
nie:title(nmm:musicAlbum(?song)) AS ?album
nfo:duration(?song) AS ?duration
+ ?url
WHERE {
?song a nmm:MusicPiece ;
nie:isStoredAs ?url .
%(location_filter)s
+ FILTER (
+ %(filter_clause_song)s
+ )
}
}
}
@@ -644,12 +649,13 @@ class Playlist(GObject.GObject):
FILTER( ?tag = nao:predefined-tag-favorite )
}
FILTER (
- %(filter_clause)s
+ %(filter_clause_pl)s
)
}
""".replace("\n", " ").strip() % {
"media_type": int(Grl.MediaType.AUDIO),
- "filter_clause": "tracker:id(?song) = " + media_id,
+ "filter_clause_song": "tracker:id(?song) = " + media_id,
+ "filter_clause_pl": "tracker:id(?playlist) = " + pl_id,
"location_filter": self._tracker_wrapper.location_filter(),
"miner_fs_busname": miner_fs_busname,
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]