mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 18:13:17 +01:00
commit
d0c2bb1d76
3 changed files with 20 additions and 11 deletions
|
|
@ -104,6 +104,7 @@ 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)
|
||||
|
|
@ -111,17 +112,18 @@ class EmbyUpdate(BeetsPlugin):
|
|||
self._log.warning(u'User {0} could not be found.'.format(username))
|
||||
return
|
||||
|
||||
# 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
|
||||
# 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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
----------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ To use ``embyupdate`` plugin, enable it in your configuration (see :ref:`using-p
|
|||
host: localhost
|
||||
port: 8096
|
||||
username: user
|
||||
apikey: apikey
|
||||
password: password
|
||||
|
||||
To use the ``embyupdate`` plugin you need to install the `requests`_ library with::
|
||||
|
|
@ -30,4 +31,5 @@ The available options under the ``emby:`` section are:
|
|||
- **port**: The Emby server port.
|
||||
Default: 8096
|
||||
- **username**: A username of a Emby user that is allowed to refresh the library.
|
||||
- **password**: That user's password.
|
||||
- **apikey**: An Emby API key
|
||||
- **password**: If no API key is present then enter the user aboves password.
|
||||
|
|
|
|||
Loading…
Reference in a new issue