[gnome-music] query: Add query for deleting playlists



commit 896a0581708f65e95ec63cd7038c2e06f93cc561
Author: Arnel Borja <arnelborja src gnome org>
Date:   Tue Jun 3 21:49:58 2014 +0800

    query: Add query for deleting playlists

 gnomemusic/query.py |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 7540794..9eb45cf 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -620,6 +620,32 @@ class Query():
         return query
 
     @staticmethod
+    def delete_playlist(playlist_id):
+        query = """
+    DELETE {
+        ?playlist
+            a rdfs:Resource .
+        ?entry
+            a rdfs:Resource .
+    }
+    WHERE {
+        ?playlist
+            a nmm:Playlist ;
+            a nfo:MediaList .
+        OPTIONAL {
+            ?playlist
+                nfo:hasMediaFileListEntry ?entry .
+        }
+        FILTER (
+            tracker:id(?playlist) = %(playlist_id)s
+        )
+    }
+    """.replace("\n", " ").strip() % {
+            'playlist_id': playlist_id
+        }
+        return query
+
+    @staticmethod
     def get_playlist_with_id(playlist_id):
         query = """
     ?playlist a nmm:Playlist .


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