From 0f155ce3b913ca49e5f23063706501fe8d004769 Mon Sep 17 00:00:00 2001 From: Josh Brown Date: Fri, 5 Feb 2016 23:50:24 -0600 Subject: [PATCH 1/3] Use beets API key for lastimport plugin. --- beetsplug/lastimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beetsplug/lastimport.py b/beetsplug/lastimport.py index 38b5bfc10..1151622ba 100644 --- a/beetsplug/lastimport.py +++ b/beetsplug/lastimport.py @@ -171,7 +171,7 @@ def fetch_tracks(user, page, limit): } ] """ - network = pylast.LastFMNetwork(api_key=config['lastfm']['api_key']) + network = pylast.LastFMNetwork(api_key=plugins.LASTFM_KEY) user_obj = CustomUser(user, network) results, total_pages =\ user_obj.get_top_tracks_by_page(limit=limit, page=page) From ea36c5a8256bc43a0627014ade8535630188ebba Mon Sep 17 00:00:00 2001 From: Josh Brown Date: Sat, 6 Feb 2016 00:41:59 -0600 Subject: [PATCH 2/3] Allow default lastfm key to be overridden in config --- beetsplug/lastimport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/lastimport.py b/beetsplug/lastimport.py index 1151622ba..29560b7f2 100644 --- a/beetsplug/lastimport.py +++ b/beetsplug/lastimport.py @@ -32,7 +32,7 @@ class LastImportPlugin(plugins.BeetsPlugin): super(LastImportPlugin, self).__init__() config['lastfm'].add({ 'user': '', - 'api_key': '', + 'api_key': plugins.LASTFM_KEY, }) config['lastfm']['api_key'].redact = True self.config.add({ @@ -171,7 +171,7 @@ def fetch_tracks(user, page, limit): } ] """ - network = pylast.LastFMNetwork(api_key=plugins.LASTFM_KEY) + network = pylast.LastFMNetwork(api_key=config['lastfm']['api_key']) user_obj = CustomUser(user, network) results, total_pages =\ user_obj.get_top_tracks_by_page(limit=limit, page=page) From 94b9d786b591128c7a972c3eab267c27f2ee8194 Mon Sep 17 00:00:00 2001 From: Josh Brown Date: Sat, 6 Feb 2016 00:42:23 -0600 Subject: [PATCH 3/3] add to changelog --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index c23597285..99ed6d99b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -62,6 +62,8 @@ Fixes: * :doc:`/plugins/lyrics`: In a continuing saga, the Genius API we use is down again, so it's been disabled by default *again*. We'll probably leave it disabled this time. +* :doc:`/plugins/lastimport`: The plugin now works with the beets api key by + default. This can be overridden in the plugin config. .. _beets.io: http://beets.io/ .. _Beetbox: https://github.com/beetbox