Emby API Key

Corrected the use of spaces rather than tabs. Add the option to use an
Emby API key to authenticate rather than a password
This commit is contained in:
Rob McGhee 2016-07-07 22:46:33 +01:00
parent 3710c139fb
commit 2dad86291e
2 changed files with 18 additions and 13 deletions

View file

@ -104,26 +104,26 @@ class EmbyUpdate(BeetsPlugin):
port = config['emby']['port'].get()
username = config['emby']['username'].get()
password = config['emby']['password'].get()
token = config['emby']['apikey'].get()
token = config['emby']['apikey'].get()
# Get user information from the Emby API.
user = get_user(host, port, username)
if not user:
self._log.warning(u'User {0} could not be found.'.format(username))
return
if not token:
# Create Authentication data and headers.
auth_data = password_data(username, password)
headers = create_headers(user[0]['Id'])
# Get authentication token.
token = get_token(host, port, headers, auth_data)
if not token:
self._log.warning(
u'Could not get token for user {0}', username
)
return
if not token:
# Create Authentication data and headers.
auth_data = password_data(username, password)
headers = create_headers(user[0]['Id'])
# Get authentication token.
token = get_token(host, port, headers, auth_data)
if not token:
self._log.warning(
u'Could not get token for user {0}', username
)
return
# Recreate headers with a token.
headers = create_headers(user[0]['Id'], token=token)

View file

@ -1,6 +1,11 @@
Changelog
=========
* :doc:`/plugins/embyupdate`: Use the option of Emby's API Key's rather than
a password. Add an apikey to your config file for this to work. Does not
break the use of password as an authentication method
1.4.0 (in development)
----------------------