mirror of
https://github.com/beetbox/beets.git
synced 2026-01-05 23:43:31 +01:00
Emby API Key
Add the option to read an API Key from the config file and submit that instead of needing a password. Doesn't remove the use of password so is backwards compatible with users current config file
This commit is contained in:
parent
b5d22ec7b8
commit
3710c139fb
1 changed files with 13 additions and 11 deletions
|
|
@ -104,24 +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()
|
||||
|
||||
# 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'])
|
||||
|
||||
# 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
|
||||
# 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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue