[gnome-music/wip/jfelder/3-38-fix-add-song-to-playlist: 2/2] grltrackerplaylists: Do not add the same song several times




commit 787d13e9b835ad76a5710c2ef5c771db123c29b9
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Feb 24 16:42:30 2021 +0100

    grltrackerplaylists: Do not add the same song several times
    
    When songs are added to a user playlist, a query is performed to
    update the playlist and display the new songs. However, this query
    inserts a new song several times if it was already part of the
    playlist because it only filters the song id.
    
    This issue is fixed by adding a limit of one to the query.

 gnomemusic/grilowrappers/grltrackerplaylists.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerplaylists.py b/gnomemusic/grilowrappers/grltrackerplaylists.py
index 835d96852..5d2f5ed30 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -651,7 +651,7 @@ class Playlist(GObject.GObject):
                 FILTER (
                     %(filter_clause_pl)s
                 )
-            }
+            } LIMIT 1
             """.replace("\n", " ").strip() % {
                 "media_type": int(Grl.MediaType.AUDIO),
                 "filter_clause_song": "tracker:id(?song) = " + media_id,


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