[gnome-music/wip/jfelder/playlist-add-songs-fix: 1/3] 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/playlist-add-songs-fix: 1/3] grltrackerplaylists: Fix update playlist query when adding songs
- Date: Wed, 24 Feb 2021 15:53:32 +0000 (UTC)
commit 5bb0c15b25362a717521aad8e8bdfdd048429c1c
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 720c541ca..4f0bb0364 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -592,6 +592,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
@@ -619,10 +620,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
+ )
}
}
}
@@ -631,12 +636,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]