Hey all. I've been working on a Python script that bridges my Plex and Insteon devices but am having one weird little nuisance.
The basic goal is this: I sit down in my basement home theater with an Openelec/Plex HTPC and Insteon ISY-994i controlled lights. I hit play on a movie in Plex and all the lights dim to my "movie mode". When I hit pause or stop, the lights come back up to "normal mode".
All is (surprisingly to me) working GREAT and my not having to lift another arm or device to control my lights is just super cool. (Ultimate laziness: Achieved) I'm polling my https://server/status/sessions XML file every several seconds just fine. HOWEVER...
The movie state changing to "playing" or "paused" is near instant. But when I am "playing" or "paused" and hit "stop"... my status/sessions xml will just sort of hang out in the same state for some time until it finally clears out. About a minute or two. It doesn't go to "stopped", and it doesn't zero out the connection. I can workaround it in my logic by hitting pause first, then stop, but I'd love to ...not.
It does the same thing on my Plex Home Theater Client on my Windows 7 machine, which also happens to be my Plex Server. I can even fully close the PHT client, but /status/sessions still shows "playing" and the Plex Server activity monitor still shows the title playing. It does not do it with my Plex Web Client on the same machine though. If I hit the "x" it just closes out in the xml immediately.
Any thoughts as to why this behavior occurs? And if there is a way to get an accurate representation of when a movie is "stopped"?
Thanks in advance. (And I look forward to sharing my script once complete.)
Yup... Looks like the same problem. Thanks for the link. I'm guessing it must be some sort of design "feature"... like maybe you don't want to dump any transcoding progress right away in case the client comes back. But not reporting that it goes on pause or stop is just very odd.
This has worked for me flawlessly for over a year. And since a while, it doesn’t which is kind of annoying because i do a complete shutdown with my Indigo Home automation when i go to bed, just to find out in the middle of the night, when i make a bottle for my new born, that the player state because other than playing and all the lights are on.
This hasn’t been an issue as long as i know. i just don’t get why the xml information should be frozen in time. This also affects plexweb and other channels of information gathering.
The only “fix” for my specific case is that I have scripted my home automation to look for a status of “playing” or for a status change from “playing” to “paused”, or “playing” to no status at all (which equates to stopped). If you are playing a title, and hit STOP, the status will continue to show “playing” for about 3 minutes. Enough time for you to shut down your tv and lights, and go upstairs. Then when it finally goes to “stopped” the lights come back on. What I’ve been doing is right before I hit stop, I hit pause, wait a few seconds for the script to trigger, then hit stop. That will leave the hung status as “paused” for those 3 minutes instead of “playing”, which is enough to trigger my home automation to go back to lights up, and I have no further action that takes place when going from paused to off.
Just a note: Appears that this problem is not present in the new Plex Media Player. Confirmed on my Raspberry Pi2 running PMP that the status sessions drops immediately upon stopping.
Hi David.
I’d be glad to share it. I have it pretty much in a nice state right now. I have it on GitHub and will start a new thread on it once I have it cleaned up and a little more ready to share. Won’t be long.
You could take a look at using websockets ws://ip:port/:/websockets/notifications. I’m not sure if PHT still has the “stop” problem with websockets, but it should be instant without polling your server every few seconds.