Fixed python 2.6 compatibility in the plexupdate plugin. Added requests as dependency in the docs for plexupdate

This commit is contained in:
Marvin Steadfast 2014-11-28 14:08:11 +01:00
parent b25393151d
commit 77f8eff78c
2 changed files with 11 additions and 6 deletions

View file

@ -21,7 +21,7 @@ def get_music_section(host, port):
"""Getting the section key for the music library in Plex.
"""
api_endpoint = 'library/sections'
url = urljoin('http://{}:{}'.format(host, port), api_endpoint)
url = urljoin('http://{0}:{1}'.format(host, port), api_endpoint)
# Sends request.
r = requests.get(url)
@ -38,8 +38,8 @@ def update_plex(host, port):
"""
# Getting section key and build url.
section_key = get_music_section(host, port)
api_endpoint = 'library/sections/{}/refresh'.format(section_key)
url = urljoin('http://{}:{}'.format(host, port), api_endpoint)
api_endpoint = 'library/sections/{0}/refresh'.format(section_key)
url = urljoin('http://{0}:{1}'.format(host, port), api_endpoint)
# Sends request and returns requests object.
r = requests.get(url)

View file

@ -4,8 +4,6 @@ PlexUpdate Plugin
``plexupdate`` is a very simple plugin for beets that lets you automatically
update `Plex`_'s music library whenever you change your beets library.
.. _Plex: http://plex.tv/
To use ``plexupdate`` plugin, enable it in your configuration
(see :ref:`using-plugins`).
Then, you'll probably want to configure the specifics of your Plex server.
@ -14,11 +12,18 @@ which looks like this::
plex:
host: localhost
port: 32400
port: 32400
To use the ``plexupdate`` plugin you need to install the `requests`_ library with:
pip install requests
With that all in place, you'll see beets send the "update" command to your Plex
server every time you change your beets library.
.. _Plex: http://plex.tv/
.. _requests: http://docs.python-requests.org/en/latest/
Configuration
-------------