[gnome-music/wip/jfelder/simplify-playlistdialog: 28/28] grilo: Remove unused method playlists_available
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/simplify-playlistdialog: 28/28] grilo: Remove unused method playlists_available
- Date: Mon, 26 Mar 2018 08:35:28 +0000 (UTC)
commit b54b130113bd7571718cc5320444a50bbe865d62
Author: Jean Felder <jfelder src gnome org>
Date: Tue Mar 13 17:32:53 2018 +0100
grilo: Remove unused method playlists_available
gnomemusic/grilo.py | 40 ----------------------------------------
gnomemusic/query.py | 14 --------------
2 files changed, 54 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index d77a6938..5d907c88 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -487,45 +487,5 @@ class Grilo(GObject.GObject):
self.sparqltracker.query_async(Query.all_songs_count(), None,
songs_query_cb, None)
- @log
- def playlists_available(self, callback):
- """Checks if there are any non-static playlists available
-
- Calls a callback function with True or False depending on the
- availability of playlists.
- :param callback: Function to call on result
- """
- def cursor_next_cb(conn, res, data):
- try:
- has_next = conn.next_finish(res)
- except GLib.Error as err:
- logger.warning("Error: {},{}".format(err.__class__, err))
- callback(False)
- return
-
- if has_next:
- count = conn.get_integer(0)
-
- if count > 0:
- callback(True)
- return
-
- callback(False)
-
- def playlists_query_cb(conn, res, data):
- try:
- cursor = conn.query_finish(res)
- except GLib.Error as err:
- logger.warning("Error: {}, {}".format(err.__class__, err))
- callback(False)
- return
-
- cursor.next_async(None, cursor_next_cb, None)
-
- # TODO: currently just checks tracker, should work with any
- # queryable supported Grilo source.
- self.sparqltracker.query_async(
- Query.all_non_static_playlists_count(),
- None, playlists_query_cb, None)
grilo = Grilo()
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index c7554378..a059929c 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -115,20 +115,6 @@ class Query():
return query
- @staticmethod
- def all_non_static_playlists_count():
- query = """
- SELECT
- COUNT (?pl)
- { ?pl a nmm:Playlist .
- OPTIONAL { ?pl nao:hasTag ?tag } .
- FILTER (!BOUND(nfo:belongsToContainer(?pl)))
- FILTER (!BOUND(?tag))
- }
- """.replace('\n', ' ').strip()
-
- return query
-
@staticmethod
def albums(where_clause):
query = """
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]