[gnome-music] query: Rework "songs for album" query



commit 5a81196b8a494f6538d66f99c12cb58a2ac1c8ae
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 30 11:45:45 2015 +0100

    query: Rework "songs for album" query
    
    No large functional changes, the path matching is performed using
    pure string operations though. The filters for the music pieces
    not being videos or playlists has been removed too. If that happens,
    it is plainly a Tracker bug, no need to tap over it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759587

 gnomemusic/query.py |   28 +++++-----------------------
 1 files changed, 5 insertions(+), 23 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index c338da1..3a7fc58 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -294,29 +294,11 @@ class Query():
         ?song a nmm:MusicPiece ;
               a nfo:FileDataObject ;
               nmm:musicAlbum ?album .
-        OPTIONAL {
-            ?song nao:hasTag ?tag .
-            FILTER( ?tag = nao:predefined-tag-favorite )
-        }
-        FILTER (
-            tracker:id(?album) = %(album_id)s
-        )
-        FILTER (
-            tracker:uri-is-descendant(
-                '%(music_dir)s', nie:url(?song)
-            ) ||
-            tracker:uri-is-descendant(
-                '%(download_dir)s', nie:url(?song)
-            )
-        )
-        FILTER (
-            NOT EXISTS {
-                ?song a nmm:Video
-            } &&
-            NOT EXISTS {
-                ?song a nmm:Playlist
-            }
-        )
+        OPTIONAL { ?song nao:hasTag ?tag .
+                   FILTER( ?tag = nao:predefined-tag-favorite ) } .
+        FILTER (tracker:id(?album) = %(album_id)s &&
+                (STRSTARTS(nie:url(?song), '%(music_dir)s/') ||
+                 STRSTARTS(nie:url(?song), '%(download_dir)s/')))
     }
     ORDER BY
          nmm:setNumber(nmm:musicAlbumDisc(?song))


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