[gnome-music] grilo: Blacklist sources not usable in Search



commit 01306d8b70d959cba87a1d29edbe57cc82e6a8b1
Author: Arnel Borja <arnelborja src gnome org>
Date:   Wed May 7 23:13:32 2014 +0800

    grilo: Blacklist sources not usable in Search

 gnomemusic/grilo.py     |    6 ++++--
 gnomemusic/searchbar.py |    3 +--
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 97bef9e..679765f 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -70,6 +70,7 @@ class Grilo(GObject.GObject):
                                     Grl.ResolutionFlags.IDLE_RELAY)
 
         self.sources = {}
+        self.blacklist = ['grl-filesystem', 'grl-bookmarks', 'grl-metadata-store', 'grl-podcasts']
         self.tracker = None
         self.changed_media_ids = []
         self.pending_event_id = 0
@@ -138,7 +139,8 @@ class Grilo(GObject.GObject):
                         self.tracker.notify_change_start()
                         self.tracker.connect('content-changed', self._on_content_changed)
             elif (mediaSource.supported_operations() & Grl.SupportedOps.SEARCH)\
-             and (mediaSource.get_supported_media() & Grl.MediaType.AUDIO):
+             and (mediaSource.get_supported_media() & Grl.MediaType.AUDIO)\
+             and id not in self.blacklist:
                 logger.debug("source is searchable")
                 self.sources[id] = mediaSource
         except Exception as e:
@@ -191,7 +193,7 @@ class Grilo(GObject.GObject):
                                       _search_callback, data)
         else:
             Grl.multiple_search([self.sources[key] for key in self.sources
-                                 if key != 'grl-filesystem' and key != 'grl-tracker-source'],
+                                 if key != 'grl-tracker-source'],
                                 q, self.METADATA_KEYS, options,
                                 _search_callback, data)
 
diff --git a/gnomemusic/searchbar.py b/gnomemusic/searchbar.py
index 0a89250..76a3590 100644
--- a/gnomemusic/searchbar.py
+++ b/gnomemusic/searchbar.py
@@ -75,8 +75,7 @@ class SourceManager(BaseManager):
             self.values.append(['grl-tracker-source', _("Local"), ''])
             for key in grilo.sources:
                 source = grilo.sources[key]
-                if source.get_id() == 'grl-filesystem' or \
-                   source.get_id() == 'grl-tracker-source':
+                if source.get_id() == 'grl-tracker-source':
                     continue
                 self.values.append([source.get_id(), source.get_name(), ""])
         super(SourceManager, self).fill_in_values(model)


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