Skip to content

Commit

Permalink
Merge pull request #2117 from mousey/master
Browse files Browse the repository at this point in the history
Emby API Key
  • Loading branch information
sampsyo committed Jul 21, 2016
2 parents f87486c + af24277 commit d0c2bb1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
22 changes: 12 additions & 10 deletions beetsplug/embyupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,26 @@ def update(self, lib):
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

# 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)
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -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)
----------------------

Expand Down
4 changes: 3 additions & 1 deletion docs/plugins/embyupdate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand All @@ -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.

0 comments on commit d0c2bb1

Please sign in to comment.