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




commit da2f2384abb4fbc1be2203a3e036ac0b83471b8e
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 4f0bb0364..9326b2cb2 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -638,7 +638,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]