Page 6 of 6

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Friday 27 January 2017 10:24
by cattoo
Well, I put the PID part back in the script. And did a couple of reboots. Now its working on some of the flex players. Will test more when I get home.

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Friday 27 January 2017 11:44
by racquemis
The issue was probably due to timeouts from excessive http get requests due the misconfigured script.

Keep me posted ;)

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Saturday 28 January 2017 21:26
by chrisfraser05
does anyone have any info on how to run this on windows?

I'm struggling to find info :(

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Sunday 29 January 2017 0:46
by racquemis
If you want to run the script from Windows first install python 2.7 on your system.

Next create a new bat file and input the following:

Code: Select all

C:\python27\python.exe c:\<plex script directory>\plex.py

Save the file somewhere that makes sense, e.g. same place as the script file.
Now create a shortcut for the bat file and place it in the startup folder ( %AppData%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup) to make it the script autorun on login.

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Sunday 29 January 2017 10:44
by chrisfraser05
As Simple as that?

Thanks very much for the assistance!

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Sunday 29 January 2017 11:23
by racquemis
Yes, but do you get a command prompt type window on your desktop
If you want to run the script invisibly rename python.exe in the bat file to pythonw.exe.

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Saturday 04 February 2017 22:16
by chrisfraser05
Thanks guys

Got this running brilliantly after a bit of messing about!

As always the help on here is brilliant!


I'm going to have to try and figure out how to use it to trigger some automation now :0

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Sunday 05 February 2017 23:19
by chrisfraser05
Has anyone gotten this to see what Chromecast is playing?

I can't get it to work, but then I'm struggling to find out what plex names the device.

None of the devices show their name in the session/status page, and under devices all three of my Chromecast are known as Chromecast, which doesn't work.

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Monday 06 February 2017 7:10
by cattoo
I think that you should be checking that device that you are casting from.

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Tuesday 07 February 2017 6:03
by racquemis
The names you should be using are the same names that appear under to status sessions page but also the names under now playing in Plex Web. But if it doesn't appear under sessions while playing something over the chromecast there is nothing I can do.

About the chromecast: with the chromecast app on Android, used to configure and connect the chromecast to your wifi network, you also have the ability to chance the device name. Google for the info on how to do it.

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Sunday 19 February 2017 6:48
by kllngtme
So I'm trying to figure out how to make a blockly script with this to turn off a light if something is playing. How do I do this with a text field in Domoticz? Any info to start would be great now that I got this Plex script working with Domoticz..

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Thursday 23 February 2017 15:22
by racquemis
The script automatically creates a user variable for each for the configured plex clients. It's value indicated the playback status. It in the documentation in the first post. These user variables can be used directly in blockly

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Friday 03 March 2017 18:09
by rathmannm
Hi,

I can't seem to get this to work. When I run plex.py manually I get the following error:

Traceback (most recent call last):
File "./plex.py", line 119, in <module>
test = urllib2.urlopen(requestURL,timeout = 5).read()
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 407, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 445, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 401: Unauthorized

I have Plex Pass so I have added the
plexToken = 'xxxxxxxxxxxxxx'

In my Plex server network settings under "List of IP addresses and networks that are allowed without auth" I have also
maintained the IP address where I am running the plex.py from.

Any idea what I am missing?

Thanks,
Manuel

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Sunday 05 March 2017 19:31
by racquemis
First thing in troubleshooting your issue is to navigate to the URL the scripts build manually with your browser.

http://<IP>:32400/status/sessions?X-Plex-Token=<YOURTOKEN>
If you still get an unauthorized reponse from the URL then either the token is incorrect or Plex doesn't recognize the network/IP the command is issued from as being whitelisted.

Under "List of IP addresses and networks that are allowed without auth" in plex. Whitelist the gateway (not your IP) and subnet mask.
So if your on for example IP 192.168.2.5 with gateway address 192.168.2.254 enter the following: 192.168.2.254/255.255.255.0

This will whitelist all devices on the specified internal network from accessing the plex server.

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Saturday 01 July 2017 20:17
by Onkytonk
rathmannm wrote:Hi,

I can't seem to get this to work. When I run plex.py manually I get the following error:

Traceback (most recent call last):
File "./plex.py", line 119, in <module>
test = urllib2.urlopen(requestURL,timeout = 5).read()
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 407, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 445, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 401: Unauthorized

I have Plex Pass so I have added the
plexToken = 'xxxxxxxxxxxxxx'

In my Plex server network settings under "List of IP addresses and networks that are allowed without auth" I have also
maintained the IP address where I am running the plex.py from.

Any idea what I am missing?

Thanks,
Manuel
I'm getting the very same error - Though between the errors, it is displaying whats playing! So something is working, but the error is preventing the information relaying to the domoticz text/variable.

I've whitelisted the IP/subnet into plex already but still not luck.

Any help please?

EDIT: Removed everything and started from scratch and got everything working!!

Now though, having issues with the variables not updating automatically unless I run the script manually.

Any help on this one please?

Re: Plex Status - Video, Audio, Photo, Play Progress

Posted: Friday 22 December 2017 15:16
by cattoo
Onkytonk wrote: Saturday 01 July 2017 20:17
rathmannm wrote:Hi,

I can't seem to get this to work. When I run plex.py manually I get the following error:

Traceback (most recent call last):
File "./plex.py", line 119, in <module>
test = urllib2.urlopen(requestURL,timeout = 5).read()
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 407, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 445, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 401: Unauthorized

I have Plex Pass so I have added the
plexToken = 'xxxxxxxxxxxxxx'

In my Plex server network settings under "List of IP addresses and networks that are allowed without auth" I have also
maintained the IP address where I am running the plex.py from.

Any idea what I am missing?

Thanks,
Manuel
I'm getting the very same error - Though between the errors, it is displaying whats playing! So something is working, but the error is preventing the information relaying to the domoticz text/variable.

I've whitelisted the IP/subnet into plex already but still not luck.

Any help please?

EDIT: Removed everything and started from scratch and got everything working!!

Now though, having issues with the variables not updating automatically unless I run the script manually.

Any help on this one please?
You could see if the script is running top -U pi (or what user you are use)