[gnome-music/wip/jfelder/tag-test: 16/22] acoustid query operation for metadata retrieval



commit 4e06f9cf13f5b43caef77a86463f7ae21adf17bf
Author: Sumaid Syed <sumaidsyed gmail com>
Date:   Fri Jul 26 19:45:35 2019 +0530

    acoustid query operation for metadata retrieval

 data/ui/TagEditorDialog.ui | 26 --------------------------
 gnomemusic/grilo.py        |  6 +++---
 gnomemusic/musicbrainz.py  |  9 ++++++---
 3 files changed, 9 insertions(+), 32 deletions(-)
---
diff --git a/data/ui/TagEditorDialog.ui b/data/ui/TagEditorDialog.ui
index 1b0ee11f..a5423f11 100644
--- a/data/ui/TagEditorDialog.ui
+++ b/data/ui/TagEditorDialog.ui
@@ -73,8 +73,6 @@
                   <packing>
                     <property name="width">1</property>
                     <property name="height">4</property>
-                    <property name="left-attach">0</property>
-                    <property name="top-attach">0</property>
                   </packing>
                 </child>
                 <child>
@@ -204,10 +202,6 @@
                           </packing>
                         </child>
                       </object>
-                      <packing>
-                        <property name="left-attach">1</property>
-                        <property name="top-attach">0</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkBox">
@@ -270,10 +264,6 @@
                           </packing>
                         </child>
                       </object>
-                      <packing>
-                        <property name="left-attach">1</property>
-                        <property name="top-attach">1</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkBox">
@@ -336,10 +326,6 @@
                           </packing>
                         </child>
                       </object>
-                      <packing>
-                        <property name="left-attach">1</property>
-                        <property name="top-attach">2</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkBox">
@@ -537,10 +523,6 @@
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="left-attach">1</property>
-                        <property name="top-attach">3</property>
-                      </packing>
                     </child>
                   </object>
                 </child>
@@ -585,10 +567,6 @@
                   </object>
                 </child>
               </object>
-              <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">5</property>
-              </packing>
             </child>
             <child>
               <object class="GtkBox">
@@ -741,10 +719,6 @@
               </object>
             </child>
           </object>
-          <packing>
-            <property name="left-attach">1</property>
-            <property name="top-attach">5</property>
-          </packing>
           </child>
       </object>
     </child>
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index a2a8dcad..3f036af5 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -53,7 +53,7 @@ class Grilo(GObject.GObject):
         'new-source-added': (GObject.SignalFlags.RUN_FIRST, None, (Grl.Source, )),
         'new-resolve-source-found': (
             GObject.SignalFlags.RUN_FIRST, None, (Grl.Source, )),
-        'new-browse-source-found': (
+        'new-query-source-found': (
             GObject.SignalFlags.RUN_FIRST, None, (Grl.Source, )),
     }
 
@@ -282,10 +282,10 @@ class Grilo(GObject.GObject):
                 logger.debug("source %s can be resolved", id)
                 self.emit('new-resolve-source-found', mediaSource)
 
-            elif (ops & Grl.SupportedOps.BROWSE
+            elif (ops & Grl.SupportedOps.QUERY
                   and mediaSource.get_supported_media() & Grl.MediaType.AUDIO):
                 logger.debug("source %s can be resolved", id)
-                self.emit('new-browse-source-found', mediaSource)
+                self.emit('new-query-source-found', mediaSource)
 
         except Exception as e:
             logger.debug("Source {}: exception {}".format(id, e))
diff --git a/gnomemusic/musicbrainz.py b/gnomemusic/musicbrainz.py
index 22c2f98c..94db94e6 100644
--- a/gnomemusic/musicbrainz.py
+++ b/gnomemusic/musicbrainz.py
@@ -59,7 +59,7 @@ class MusicBrainz(GObject.GObject):
 
         self._grilo = grilo
         self._grilo.connect('new-resolve-source-found', self._add_new_source)
-        self._grilo.connect('new-browse-source-found', self._add_new_source)
+        self._grilo.connect('new-query-source-found', self._add_new_source)
 
         config = Grl.Config.new('grl-lua-factory', 'grl-acoustid')
         config.set_api_key(self._acoustid_api_key)
@@ -110,8 +110,11 @@ class MusicBrainz(GObject.GObject):
         options.set_resolution_flags(Grl.ResolutionFlags.NORMAL)
 
         error = None
-        self._sources['grl-acoustid'].browse(
-            media, self.ACOUSTID_METADATA_KEYS, options,
+        query = 'duration=' + str(media.get_duration())
+        query += '&fingerprint=' + media.get_string(self._fingerprint_key)
+
+        self._sources['grl-acoustid'].query(
+            query, self.ACOUSTID_METADATA_KEYS, options,
             self._acoustid_resolved, callback)
 
     def _chromaprint_resolved(


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