I have a project where I’m trying to implement a pure LUA version of plex control. Unfortunately LUA without any plugins other than XML and JSON parsers and some platform specific extensions is my only option so I can’t leverage the python API libraries etc.
To that end I’ve been gathering what I can from the various documents out there to try and get things working. When that fails I model the necessary action in python then watch the traffic with wireshark. From there I figure out the curl syntax necessary to re-create the actions. Failing curl (there’s been a couple cases) I have a very simple perl application (yes I’m a perl wonk at heart) that I can use to build the http requests and send them.
So far I have successfully implemented device setup, getting a token, validating a token. Database traversal and info gathering is easy. I can create play queues (POST to server:32400/playQueues). I can also receive a transient token from the server. Where things are falling down is playing the resulting play queue using the /player/playback/playMedia command.
I have exactly replicated the HTTP request that the python library produces. I’m targeting against PMP and in the log I’m seeing:
2021-01-07 14:04:34 [ WARN ] RemoteComponent.cpp @ 321 - Failed to lock up subscriber "<X-Plex-Client-Identifier>"
The client returns a 406 Not acceptable error.
The request looks like this (coppied from wireshark capture):
GET /player/playback/playMedia?address=<SERVER IP>&commandID=2&containerKey=%2FplayQueues%2F4250%3Fwindow%3D100%26own%3D1&key=%2Flibrary%2Fmetadata%2F5176&machineIdentifier=<SERVER clientIdentifier>&offset=0&port=32400&token=<TRANSIENT token retrieved from server>&type=music HTTP/1.1
Host: <CLIENT IP>:32433
User-Agent: <Agent string>
Accept: */*
Connection: close
X-Plex-Platform: <platform>
X-Plex-Platform-Version: <platform version>
X-Plex-Provides: controller
X-Plex-Product: <Product name>
X-Plex-Version: 4.2.0
X-Plex-Device: <device type & model>
X-Plex-Device-Name: <device name>
X-Plex-Client-Identifier: <CONTROLLER clientIdentifier>
X-Plex-Sync-Version: 2
X-Plex-Target-Client-Identifier: <PLAYER clientIdentifier>
So, anyone have any insight on what I’m missing here? What does the log error mean? Is there any comprehensive API documentation for the /player/playback/playMedia process? I’d be happy to do it without making a play queue but I’m not sure that’s possible these days. Some insight into the steps needed would be great. The official document on creating a token was great and make implementing that super easy. I’d love the same sort of through-ness for player control.
FWIW I can do navigation commands on the player without a problem. Unfortunately that doesn’t help me out.
Thanks all!