Does it work if you include the token in the url?
Code: Select all
http://localhost:32400/status/sessions/?X-Plex-Token=YOURTOKENVALUEHERE
Moderator: leecollings
Code: Select all
http://localhost:32400/status/sessions/?X-Plex-Token=YOURTOKENVALUEHERE
Code: Select all
pi@raspberrypi ~/domoticz/scripts/python $ sudo ./plex.py
13:23:00- Seems to be an old file, ignoring.
IDLE
IDLE
Code: Select all
^CTraceback (most recent call last):
File "./plex.py", line 389, in <module>
time.sleep (plex_Interval)
KeyboardInterrupt
Thanks! You were fasterracquemis wrote:Great! I'll make the necessary changes
EDIT: Script has been updated with Plex Home support. Now also clears the dummy device log when state="stopped"
Two IDLE messages in a row are only generated when the script is first started and there is no media playing or when you misconfigured the script.MAidEN wrote:Ok but I have launch a video on my plex server, the result of script can't be "IDLE"...
Code: Select all
dom_PlexPlayers = ['OpenELEC-PHT','Jasper-TPC'] #Players not on this list will be ignored
dom_PlexPlayInfo_ID = ['24','30']
Code: Select all
print 'Episode ' + state.capitalize() + ': ' + parenttitle + " - " + videotitle.encode('utf-8') + PlayProgress
Code: Select all
Paused Movie: -2012-720p (0:01:39/0:06:44)
Paused Movie: Sam Smith (0:13:18/1:02:32)
Playing Episode: Mad Men - Time Zones (0:05:16/0:47:39)
Paused Movie: -2012-720p (0:01:39/0:06:44)
Paused Movie: Sam Smith (0:13:18/1:02:32)
Playing Episode: Mad Men - Time Zones (0:05:16/0:47:39)
Traceback (most recent call last):
File "./plextest.py", line 104, 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 404, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1187, in do_open
r = h.getresponse(buffering=True)
File "/usr/lib/python2.7/httplib.py", line 1051, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 415, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 371, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "/usr/lib/python2.7/socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
timeout: timed out
None
Paused Movie: -2012-720p (0:01:39/0:06:44)
Paused Movie: Sam Smith (0:13:18/1:02:32)
Playing Episode: Mad Men - Time Zones (0:05:26/0:47:39)
Code: Select all
tags
Yes the Pi is rebooted many times and the @reboot is placed in the crontab. Just checked again to be sure.racquemis wrote:Have you reboot the raspberry pi? you've added @reboot in crontab. You need to reboot for the script to start automatically.
For the problem with your variables, please show me how your script settings look like. put it in code tags
Code: Select all
#general Script settings
plex_Interval = 5 # Poll Interval. The Plex Server updates the session status every 10 seconds. Leave at 5 to not mis any state change.
plex_ShowPlayProgress = True
plex_AutoClearPlayLog = True # Should be enabled when showing Play Progress
plex_AutoCreateUserVariables = True # Automatically create a user variable for each Client listed under dom_PlexPlayers
plex_ViewOffsetTimeout = 15 # In seconds.
plex_MaxErrorCount = 3 # number of consecutive errors until Plex is considered Offline
#RunState values (for user variable)
plex_ServerOffline = -1
plex_Idle = 0
plex_Video_Playing = 1
plex_Video_Paused = 2
plex_Video_Stopped = 3
plex_Video_Buffering = 4
plex_Audio_Playing = 11
plex_Audio_Paused = 12
plex_Audio_Stopped = 13
plex_Audio_Buffering = 14
#Plex Server Settings
plexIP = '192.168.1.20'
plexPort = '32400' # (default port = 32400)
plexToken = '' # (Fill in when using Plex Home. To Retrieve Token: https://support.plex.tv/hc/en-us/articles/204059436-Finding-your-account-token-X-Plex-Token)
#domoticz settings
domoticz_host = '192.168.1.70'
domoticz_port = '8080'
domoticz_url = 'json.htm'
#Translation Array - It's also possible to specify custom search strings. Place them at the beginning of the array.
transl_search = ['Playing','Stopped','Buffering','Paused','Video','Movie','Episode','Clip','Audio','Slideshow']
transl_replace = ['','','','','','','','','',''] #place replacement string on the same index as the search string. empty strings are not processed.
#Plex Players Settings - This script handles multiple players
dom_PlexPlayers = ['TV UE55JU7000'] #Players not on this list will be ignored
dom_PlexPlayInfo_ID = ['80']
dom_PlexPlayState_ID = ['',''] # Name of User Variable. Is overwrriten when plex_AutoCreateUserVariables=True
Code: Select all
@reboot python /home/pi/domoticz/scripts/plex.py &
Code: Select all
@reboot python /home/pi/domoticz/scripts/python/plex.py &
Users browsing this forum: No registered users and 1 guest