[gnome-music] query: Rework song count query
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] query: Rework song count query
- Date: Sun, 3 Jan 2016 18:26:13 +0000 (UTC)
commit 04fbd8a6705546eb0fa5b481a69f407cb041d403
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Dec 29 23:36:47 2015 +0100
query: Rework song count 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 | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 8182dbf..0d75d96 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -114,25 +114,12 @@ class Query():
query = '''
SELECT
COUNT(?song) AS childcount
- WHERE {
+ {
?song a nmm:MusicPiece ;
- a nfo:FileDataObject
- 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
- }
- )
+ a nfo:FileDataObject ;
+ nie:url ?url .
+ FILTER(STRSTARTS(?url, '%(music_dir)s/') ||
+ STRSTARTS(?url, '%(download_dir)s/'))
}
'''.replace('\n', ' ').strip() % {
'music_dir': Query.MUSIC_URI,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]