[gnome-music] query: rework playlists query
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] query: rework playlists query
- Date: Sun, 3 Jan 2016 18:26:28 +0000 (UTC)
commit 120b275c4e5b601d3c97dd940f64358eebd6de3c
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Dec 30 12:07:18 2015 +0100
query: rework playlists query
No need to deep nest filters and optionals, it can all be done in
the main query.
https://bugzilla.gnome.org/show_bug.cgi?id=759587
gnomemusic/query.py | 21 ++++++---------------
1 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 3a7fc58..a3a6aa4 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -252,24 +252,15 @@ class Query():
nfo:entryCounter(?playlist) AS childcount
{
%(where_clause)s
+ ?playlist a nmm:Playlist .
OPTIONAL {
- ?playlist a nfo:FileDataObject .
- FILTER (
- EXISTS {
- ?playlist tracker:available 'true'
- FILTER (
- tracker:uri-is-descendant(
- '%(music_dir)s', nie:url(?playlist)
- ) ||
- tracker:uri-is-descendant(
- '%(download_dir)s', nie:url(?playlist)
- )
- )
- }
- )
+ ?playlist nie:url ?url ;
+ tracker:available true .
+ FILTER (STRSTARTS (?url, '%(download_dir)s/') ||
+ STRSTARTS (?url, '%(music_dir)s/'))
}
}
- ORDER BY fn:lower-case(?title)
+ ORDER BY LCASE(?title)
'''.replace('\n', ' ').strip() % {
'where_clause': where_clause.replace('\n', ' ').strip(),
'music_dir': Query.MUSIC_URI,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]