[gnome-music] query: Filter out songs that are videos or playlists
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] query: Filter out songs that are videos or playlists
- Date: Fri, 2 May 2014 18:58:24 +0000 (UTC)
commit e82bec4c15815afb7733cd9bc83facd9b729bd25
Author: Arnel Borja <arnelborja src gnome org>
Date: Fri May 2 21:29:32 2014 +0800
query: Filter out songs that are videos or playlists
Some nmm:MusicPiece are also a nmm:Video, and all nmm:Playlist are also
nmm:MusicPiece objects. We should filter them out because videos don't
have artist and other important fields in grilo, and playlists should
be shown in the Playlists view instead.
https://bugzilla.gnome.org/show_bug.cgi?id=726459
https://bugzilla.gnome.org/show_bug.cgi?id=728255
gnomemusic/query.py | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 96 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 5aef7db..7e98e29 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -79,6 +79,14 @@ class Query():
WHERE {
?_1 nmm:musicAlbum ?album ;
tracker:available 'true'
+ FILTER (
+ NOT EXISTS {
+ ?_1 a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?_1 a nmm:Playlist
+ }
+ )
}
)
)
@@ -90,6 +98,14 @@ class Query():
?_2 nmm:musicAlbum ?album ;
nie:contentCreated ?c ;
tracker:available 'true'
+ FILTER (
+ NOT EXISTS {
+ ?song a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?song a nmm:Playlist
+ }
+ )
}
LIMIT 1
) AS creation-date
@@ -99,6 +115,14 @@ class Query():
EXISTS {
?_3 nmm:musicAlbum ?album ;
tracker:available 'true'
+ FILTER (
+ NOT EXISTS {
+ ?_3 a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?_3 a nmm:Playlist
+ }
+ )
}
)
}
@@ -138,6 +162,14 @@ class Query():
nmm:artistName(nmm:performer(?_12)) AS perf
WHERE {
?_12 nmm:musicAlbum ?album
+ FILTER (
+ NOT EXISTS {
+ ?_12 a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?_12 a nmm:Playlist
+ }
+ )
}
GROUP BY ?perf
),
@@ -156,6 +188,14 @@ class Query():
WHERE {
?_1 nmm:musicAlbum ?album ;
tracker:available 'true'
+ FILTER (
+ NOT EXISTS {
+ ?_1 a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?_1 a nmm:Playlist
+ }
+ )
}
)
)
@@ -167,6 +207,14 @@ class Query():
?_2 nmm:musicAlbum ?album ;
nie:contentCreated ?c ;
tracker:available 'true'
+ FILTER (
+ NOT EXISTS {
+ ?_2 a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?_2 a nmm:Playlist
+ }
+ )
}
LIMIT 1
) AS creation-date
@@ -176,6 +224,14 @@ class Query():
EXISTS {
?_3 nmm:musicAlbum ?album ;
tracker:available 'true'
+ FILTER (
+ NOT EXISTS {
+ ?_3 a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?_3 a nmm:Playlist
+ }
+ )
}
)
}
@@ -194,6 +250,14 @@ class Query():
{
?song a nmm:MusicPiece ;
a nfo:FileDataObject
+ FILTER (
+ NOT EXISTS {
+ ?song a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?song a nmm:Playlist
+ }
+ )
}
ORDER BY tracker:added(?song)
'''.replace('\n', ' ').strip()
@@ -204,6 +268,14 @@ class Query():
WHERE {
?song a nmm:MusicPiece ;
a nfo:FileDataObject
+ FILTER (
+ NOT EXISTS {
+ ?song a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?song a nmm:Playlist
+ }
+ )
}
'''.replace('\n', ' ').strip()
@@ -225,6 +297,14 @@ class Query():
FILTER (
tracker:id(?album) = %(album_id)s
)
+ FILTER (
+ NOT EXISTS {
+ ?song a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?song a nmm:Playlist
+ }
+ )
}
ORDER BY
nmm:setNumber(nmm:musicAlbumDisc(?song))
@@ -281,6 +361,14 @@ class Query():
FILTER (
tracker:id(?song) = %(song_id)s
)
+ FILTER (
+ NOT EXISTS {
+ ?song a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?song a nmm:Playlist
+ }
+ )
}
""".replace("\n", " ").strip() % {'song_id': song_id}
return query
@@ -301,6 +389,14 @@ class Query():
FILTER (
nie:url(?song) = "%(url)s"
)
+ FILTER (
+ NOT EXISTS {
+ ?song a nmm:Video
+ } &&
+ NOT EXISTS {
+ ?song a nmm:Playlist
+ }
+ )
}
'''.replace('\n', ' ').strip() % {'url': url}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]