Overview¶
Unofficial Python bindings for the Plex API. Our goal is to match all capabilities of the officialPlex Web Client. A few of the many features we currently support are:
- Navigate local or remote shared libraries.
- Perform library actions such as scan, analyze, empty trash.Marshalls garden planner Marshalls' Garden Visualiser does exactly what it says – it is a sophisticated tool that enables you to see for yourself what your dream garden will look like when it is finished. Plan-A-Garden from Better Homes & Gardens is easy to use because it supports drag. Great offers & range of Flowers & Plants, Vegetable Plants, Vegetable & Flower Seeds & Seed Potatoes plus Wild Bird Food and Gardening Accessories from Marshalls Garden. 100% satisfaction guarantee. Gardener’s Supply Company. If you’re looking for a completely free garden planner but you only grow. Garden visualizer from marshalls. The Garden Visualiser can be used across a variety of platforms and operating systems. By creating an account with us, you will be able to access all your designs from any device that supports the Garden Visualiser by simply logging in.
- Remote control and play media on connected clients, including Controlling Sonos speakers
- Listen in on all Plex Server notifications.
Installation & Documentation¶
Custom Server Access Urls
Documentation can be found at Read the Docs.
Join our Discord for support and discussion.
Getting a PlexServer Instance¶
There are two types of authentication. If you are running on a separate networkor using Plex Users you can log into MyPlex to get a PlexServer instance. Anexample of this is below. NOTE: Servername below is the name of the server (notthe hostname and port). If logged into Plex Web you can see the server name inthe top left above your available libraries.
If you want to avoid logging into MyPlex and you already know your auth tokenstring, you can use the PlexServer object directly as above, by passing inthe baseurl and auth token directly.
Usage Examples¶
Controlling Sonos speakers¶
To control Sonos speakers directly using Plex APIs, the following requirements must be met:
Disabling GDM auto discovery of your Plex Media Server. GDM is used to auto discover your PMS server, if you are having issues with it not automatically discovering your PMS or it is showing the wrong IP then you can disable this and hard code your PMS's IP (and port if using a non-standard one).
- Active Plex Pass subscription
- Sonos account linked to Plex account
- Plex remote access enabled
Due to the design of Sonos music services, the API calls to control Sonos speakers route through https://sonos.plex.tvand back via the Plex server’s remote access. Actual media playback is local unless networking restrictions prevent theSonos speakers from connecting to the Plex server directly.
Running tests over PlexAPI¶
- UDP: 1900 (access to the Plex DLNA Server) UDP: 5353 (older Bonjour/Avahi network discovery) TCP: 8324 (controlling Plex for Roku via Plex Companion) UDP: 32410, 32412, 32413, 32414 (current GDM network discovery) TCP: 32469 (access to the Plex DLNA Server).
- SOBROADCAST, 1) gdmip = '255.255.255.255' gdmport = 32412 else: # setup socket for multicast to Plex server(s) gdmip = '239.0.0.250' gdmport = 32414 try: # Send data to the multicast group sock. Sendto (gdmmsg, (gdmip, gdmport)).
Use:
with appropriatearguments and add this new server to a shared user which username is defined in environment veriable SHARED_USERNAME.It uses official docker image to create a proper instance.
For skipping the docker and reuse a existing server use
Also in order to run most of the tests you have to provide some environment variables:
- PLEXAPI_AUTH_SERVER_BASEURL containing an URL to your Plex instance, e.g. http://127.0.0.1:32400 (without trailingslash)
- PLEXAPI_AUTH_MYPLEX_USERNAME and PLEXAPI_AUTH_MYPLEX_PASSWORD with your MyPlex username and password accordingly
After this step you can run tests with following command:
Some of the tests in main test-suite require a shared user in your account (e.g. test_myplex_users,test_myplex_updateFriend, etc.), you need to provide a valid shared user’s username to get them running you need toprovide the username of the shared user as an environment variable SHARED_USERNAME. You can enable a Guest account andsimply pass Guest as SHARED_USERNAME (or just create a user like plexapitest and play with it).
To be able to run tests over Mobile Sync api you have to some some more environment variables, to following valuesexactly:
Plex Gdm Free
- PLEXAPI_HEADER_PROVIDES=’controller,sync-target’
- PLEXAPI_HEADER_PLATFORM=iOS
- PLEXAPI_HEADER_PLATFORM_VERSION=11.4.1
- PLEXAPI_HEADER_DEVICE=iPhone
And finally run the sync-related tests:
Common Questions¶
Why are you using camelCase and not following PEP8 guidelines?
Plex Preferred Network Interface
This API reads XML documents provided by MyPlex and the Plex Server.We decided to conform to their style so that the API variable names directlymatch with the provided XML documents.
Why don’t you offer feature XYZ?
This library is meant to be a wrapper around the XML pages the Plexserver provides. If we are not providing an API that is offerered in theXML pages, please let us know! – Adding additional features beyond thatshould be done outside the scope of this library.
Plex Gdm Download
What are some helpful links if trying to understand the raw Plex API?