embyupdate: fix bug that config for password and api is needed

even if it only used api key it needed the password key. this is fixed
now.
This commit is contained in:
Marvin Steadfast 2017-01-06 11:44:32 +01:00
parent d389ac15e1
commit efbd58cd55
2 changed files with 10 additions and 1 deletions

View file

@ -6,6 +6,7 @@
host: localhost
port: 8096
username: user
apikey: apikey
password: password
"""
from __future__ import division, absolute_import, print_function
@ -150,7 +151,9 @@ class EmbyUpdate(BeetsPlugin):
# Adding defaults.
config['emby'].add({
u'host': u'http://localhost',
u'port': 8096
u'port': 8096,
u'apikey': None,
u'password': None
})
self.register_listener('database_change', self.listen_for_db_change)
@ -171,6 +174,11 @@ class EmbyUpdate(BeetsPlugin):
password = config['emby']['password'].get()
token = config['emby']['apikey'].get()
# Check if at least a apikey or password is given.
if not any([password, token]):
self._log.warning(u'Provide at least Emby password or apikey.')
return
# Get user information from the Emby API.
user = get_user(host, port, username)
if not user:

View file

@ -44,6 +44,7 @@ Fixes:
:bug:`2302`
* :doc:`/plugins/lyrics`: The plugin now reports a beets-specific User-Agent
header when requesting lyrics. :bug:`2357`
* :doc:`/plugins/embyupdate`: Fix a bug that apikey and password is needed in config.
For plugin developers: new importer prompt choices (see :ref:`append_prompt_choices`), you can now provide new candidates for the user to consider.