[gnome-music/wip/gbsneto/contained-playlists: 16/29] grilo: Only query user-defined playlists
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/gbsneto/contained-playlists: 16/29] grilo: Only query user-defined playlists
- Date: Thu, 1 Dec 2016 23:26:55 +0000 (UTC)
commit bdd76b9bae52524a8784eac15679aeab6d20dba2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Dec 1 11:15:20 2016 -0200
grilo: Only query user-defined playlists
Since the Grilo backend queries all the playlists,
including the static ones, we end up with double
entries in the playlists view.
Fix that by querying only the user playlists with
grilo, and letting the Playlists class query the
static playlists manually.
gnomemusic/grilo.py | 4 ++--
gnomemusic/query.py | 9 +++++++--
2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 2f39022..7849889 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -251,8 +251,8 @@ class Grilo(GObject.GObject):
@log
def populate_playlists(self, offset, callback, count=-1):
if self.tracker:
- GLib.idle_add(self.populate_items, Query.all_playlists(), offset,
- callback, count)
+ GLib.idle_add(self.populate_items, Query.all_user_playlists(),
+ offset, callback, count)
@log
def populate_album_songs(self, album, callback, count=-1):
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 22d4245..cf31db6 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -111,8 +111,13 @@ class Query():
return Query.songs('?song a nmm:MusicPiece ; a nfo:FileDataObject .')
@staticmethod
- def all_playlists():
- return Query.playlists('?playlist a nmm:Playlist .')
+ def all_user_playlists():
+ query = """
+ ?playlist a nmm:Playlist .
+ FILTER (NOT EXISTS { ?playlist nao:hasTag ?tag })
+ """
+
+ return Query.playlists(query)
@staticmethod
def all_songs_count():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]