I was making a script for someone that changes the audio/subtitle stream of a stream when needed. This ofcourse requires the script to control the client. Everything in the script is working fine except one thing: python-plexapi, which is the package that I use to control the clients, can’t find the client.
When I start a stream on my phone, and I execute plex.clients(), I should see my phone in the returned list. However, the list is completly empty aside from plex web app clients. Looking at the source code, ppa just makes a request to the /clients endpoint. So I did that instead and indeed only saw one plex web app instance that I had open on my computer but not my phone that was streaming media at that moment.
This problem makes my script useless because I can’t control the client without the needed info and that info can only be found at the /clients endpoint but the client isn’t there. So I can’t control the client.
For example here example 4 shows example usage given directly by ppa that doesn’t work. The strange thing is that it worked a few weeks ago. I’ve personally seen the script work but now suddenly ppa can’t find the clients anymore because plex doesn’t show them in the endpoint. Maybe this is a bug in a new update? Or has this info moved to a different endpoint? Whatever is going on, a few weeks ago this worked fine and now it doesn’t and I didn’t do anything different in those weeks.
Both the person I’m making the script for and I have tried clients but nothing works. A tv, 2 different phones, a chromecast. Nothing is returned in the /clients endpoint aside from plex web app instances.
I’m surprised no one has made a post about this before because not a single script that controls clients, of which there are thousands of on github, would work.
Since python-plexapi is a 3rd. Party thing, you might get a better/faster respond by joining their Discord for support and discussion, as mentioned here
The thing is that in order for ppa to control the client, it needs info about it which it searches at the /clients endpoint. This is completely normal and how it should be done. However, /clients is just not showing the client. ppa is doing nothing wrong. Plex is not returning clients that it should be. If plex correctly returned the clients, ppa would do it’s thing perfectly fine.
In fact ppa is working so fine that it is even doing it now with the errors. I’m requesting ppa to control a client with a certain name so it searches it but plex says that there is no such client connected so ppa returns 404. Even with the errors, ppa is doing the correct thing. Plex should just correctly return the clients.