[gnome-music/wip/jfelder/grilo-theaudiodb: 4/5] grilo: Add theaudiodb support



commit f899aa56cd5b60cad7b608a230478a93f7faaddf
Author: Jean Felder <jfelder src gnome org>
Date:   Sun Sep 2 11:57:42 2018 +0200

    grilo: Add theaudiodb support
    
    theaudiodb-cover is a grilo plugin to download cover art from the
    artist and album name keys.
    
    Add an api key to be able to use it.
    Set its rank to 1.

 gnomemusic/grilo.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index c989e2d5..890918be 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -35,7 +35,8 @@ import os
 os.environ['GRL_PLUGIN_RANKS'] = ("grl-local-metadata:5,"
                                   "grl-filesystem:4,"
                                   "grl-tracker-source:3,"
-                                  "grl-lastfm-cover:2")
+                                  "grl-lastfm-cover:2,"
+                                  "grl-theaudiodb-cover:1")
 from gi.repository import Grl
 logger = logging.getLogger(__name__)
 
@@ -76,6 +77,8 @@ class Grilo(GObject.GObject):
     CHANGED_MEDIA_MAX_ITEMS = 500
     CHANGED_MEDIA_SIGNAL_TIMEOUT = 2000
 
+    _theaudiodb_api_key = "195003"
+
     sources = GObject.Property()
 
     def __repr__(self):
@@ -122,6 +125,10 @@ class Grilo(GObject.GObject):
 
     @log
     def _find_sources(self):
+        config = Grl.Config.new('grl-lua-factory', 'grl-theaudiodb-cover')
+        config.set_api_key(self._theaudiodb_api_key)
+        self.registry.add_config(config)
+
         self.registry.connect('source_added', self._on_source_added)
         self.registry.connect('source_removed', self._on_source_removed)
 


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