[gnome-music/wip/mschraal/tageditor: 12/21] coregrilo: Watch resolve and browse sources



commit f58b608e9f5525e2276580529e31d212dc77884f
Author: Sumaid Syed <sumaidsyed gmail com>
Date:   Sun Aug 4 23:21:32 2019 +0530

    coregrilo: Watch resolve and browse sources
    
    Introduce a new signal "new-resolve-source-found" when a RESOLVE
    source has been found.
    Introduce a new signal "new-browse-source-found" when a BROWSE source has been found.
    Search for resolve and source operations.
    
    Based on the patches by Jean Felder.
    
    https://gitlab.gnome.org/GNOME/gnome-music/issues/293

 gnomemusic/coregrilo.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index ed2c9993..f232ca55 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -34,6 +34,13 @@ from gnomemusic.trackerwrapper import TrackerState, TrackerWrapper
 
 class CoreGrilo(GObject.GObject):
 
+    __gsignals__ = {
+        "new-resolve-source-found": (
+            GObject.SignalFlags.RUN_FIRST, None, (Grl.Source, )),
+        "new-query-source-found": (
+            GObject.SignalFlags.RUN_FIRST, None, (Grl.Source, )),
+    }
+
     _blacklist = [
         'grl-bookmarks',
         'grl-filesystem',
@@ -152,6 +159,14 @@ class CoreGrilo(GObject.GObject):
                 source, self._coremodel, self._coreselection, self)
             print("search source", source)
 
+        elif (source.supported_operations() & Grl.SupportedOps.RESOLVE
+                and source.get_supported_media() & Grl.MediaType.AUDIO):
+            self.emit("new-resolve-source-found", source)
+
+        elif (source.supported_operations() & Grl.SupportedOps.QUERY
+                and source.get_supported_media() & Grl.MediaType.AUDIO):
+            self.emit("new-query-source-found", source)
+
     def _on_source_removed(self, registry, source):
         # FIXME: Handle removing sources.
         print("removed,", source.props.source_id)


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