[gnome-music/gnome-3-12] query: Filter out songs that are videos or playlists



commit 60ff5f3a5037d9655089e84fe1a48872b29a84fb
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 |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 88 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index fc8b8f3..efe8f73 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
+                        }
+                    )
                 }
             )
         }
@@ -146,6 +170,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
                         ),
@@ -164,6 +196,14 @@ class Query():
                     WHERE {
                         ?_1 nmm:musicAlbum ?album ;
                         tracker:available 'true'
+                        FILTER (
+                            NOT EXISTS {
+                                ?_1 a nmm:Video
+                            } &&
+                            NOT EXISTS {
+                                ?_1 a nmm:Playlist
+                            }
+                        )
                     }
                 )
             )
@@ -175,6 +215,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
@@ -184,6 +232,14 @@ class Query():
                 EXISTS {
                     ?_3 nmm:musicAlbum ?album ;
                         tracker:available 'true'
+                FILTER (
+                    NOT EXISTS {
+                        ?_3 a nmm:Video
+                    } &&
+                    NOT EXISTS {
+                        ?_3 a nmm:Playlist
+                    }
+                )
                 }
             )
         }
@@ -211,6 +267,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()
@@ -221,6 +285,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()
 
@@ -242,6 +314,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))
@@ -292,6 +372,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]