[gnome-music/wip/jfelder/musicbrainz-tageditordialog: 1/6] grilo: Watch resolve sources



commit 1ec424f395bb682ca6ba42c10a8a45900d8ec44d
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Aug 17 10:27:33 2018 +0200

    grilo: Watch resolve sources
    
    Introduce a new signal "new-resolve-source-found" when a RESOLVE
    source has been found.

 gnomemusic/grilo.py | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 65d0373f..0951f690 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -48,6 +48,8 @@ class Grilo(GObject.GObject):
     __gsignals__ = {
         'ready': (GObject.SignalFlags.RUN_FIRST, None, ()),
         'changes-pending': (GObject.SignalFlags.RUN_FIRST, None, ()),
+        'new-resolve-source-found': (
+            GObject.SignalFlags.RUN_FIRST, None, (Grl.Source, )),
         'new-source-added': (GObject.SignalFlags.RUN_FIRST, None, (Grl.Source, ))
     }
 
@@ -262,6 +264,11 @@ class Grilo(GObject.GObject):
                 self.props.sources[id] = mediaSource
                 self.emit('new-source-added', mediaSource)
 
+            elif (ops & Grl.SupportedOps.RESOLVE
+                  and mediaSource.get_supported_media() & Grl.MediaType.AUDIO):
+                logger.debug("source %s can be resolved", id)
+                self.emit('new-resolve-source-found', mediaSource)
+
         except Exception as e:
             logger.debug("Source {}: exception {}".format(id, e))
 


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