Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emby API Key #2117

Merged
merged 4 commits into from
Jul 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
Copy link

@ghost ghost Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs rewording. Perhaps something like" Emby password (only needed if no API key is provided)