[gnome-music] playlists: add songs to static playlists with one query



commit 70c10366f847c605c403be950a0fc1f45a2cf010
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon Feb 16 14:49:49 2015 +0100

    playlists: add songs to static playlists with one query

 gnomemusic/playlists.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index c787ca2..7b169b3 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -149,6 +149,8 @@ class Playlists(GObject.GObject):
         # Clear the playlist
         self.clear_playlist_with_id(playlist.ID)
 
+        final_query = ''
+
         # Get a list of matching songs
         cursor = self.tracker.query(playlist.QUERY, None)
         if not cursor:
@@ -157,11 +159,10 @@ class Playlists(GObject.GObject):
         # For each song run 'add song to playlist'
         while cursor.next():
             uri = cursor.get_string(0)[0]
-            self.tracker.update_blank_async(
-                Query.add_song_to_playlist(playlist.ID, uri),
-                GLib.PRIORITY_DEFAULT,
-                None, None, None
-            )
+            final_query += Query.add_song_to_playlist(playlist.ID, uri)
+
+        self.tracker.update_blank_async(final_query, GLib.PRIORITY_DEFAULT,
+                                        None, None, None)
 
         # tell system we updated the playlist so playlist is reloaded
         self.emit('playlist-updated', playlist.ID)


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