mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-12 23:17:07 +00:00
Document Sonos controls in README
This commit is contained in:
parent
c4c90acd34
commit
17adcd1385
1 changed files with 41 additions and 1 deletions
42
README.rst
42
README.rst
|
@ -15,7 +15,7 @@ Plex Web Client. A few of the many features we currently support are:
|
||||||
|
|
||||||
* Navigate local or remote shared libraries.
|
* Navigate local or remote shared libraries.
|
||||||
* Perform library actions such as scan, analyze, empty trash.
|
* Perform library actions such as scan, analyze, empty trash.
|
||||||
* Remote control and play media on connected clients.
|
* Remote control and play media on connected clients, including `Controlling Sonos speakers`_
|
||||||
* Listen in on all Plex Server notifications.
|
* Listen in on all Plex Server notifications.
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,6 +129,46 @@ Usage Examples
|
||||||
plex.library.section('TV Shows').get('The 100').rate(8.0)
|
plex.library.section('TV Shows').get('The 100').rate(8.0)
|
||||||
|
|
||||||
|
|
||||||
|
Controlling Sonos speakers
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
To control Sonos speakers directly using Plex APIs, the following requirements must be met:
|
||||||
|
|
||||||
|
1. Active Plex Pass subscription
|
||||||
|
2. Sonos account linked to Plex account
|
||||||
|
3. Plex remote access enabled
|
||||||
|
|
||||||
|
Due to the design of Sonos music services, the API calls to control Sonos speakers route through https://sonos.plex.tv
|
||||||
|
and back via the Plex server's remote access. Actual media playback is local unless networking restrictions prevent the
|
||||||
|
Sonos speakers from connecting to the Plex server directly.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from plexapi.myplex import MyPlexAccount
|
||||||
|
from plexapi.server import PlexServer
|
||||||
|
|
||||||
|
baseurl = 'http://plexserver:32400'
|
||||||
|
token = '2ffLuB84dqLswk9skLos'
|
||||||
|
|
||||||
|
account = MyPlexAccount(token)
|
||||||
|
server = PlexServer(baseurl, token)
|
||||||
|
|
||||||
|
# List available speakers/groups
|
||||||
|
for speaker in account.sonos_speakers():
|
||||||
|
print(speaker.title)
|
||||||
|
|
||||||
|
# Obtain PlexSonosPlayer instance
|
||||||
|
speaker = account.sonos_speaker("Kitchen")
|
||||||
|
|
||||||
|
album = server.library.section('Music').get('Stevie Wonder').album('Innervisions')
|
||||||
|
|
||||||
|
# Speaker control examples
|
||||||
|
speaker.playMedia(album)
|
||||||
|
speaker.pause()
|
||||||
|
speaker.setVolume(10)
|
||||||
|
speaker.skipNext()
|
||||||
|
|
||||||
|
|
||||||
Running tests over PlexAPI
|
Running tests over PlexAPI
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue