POMdev wrote:
> It might be easier and more positive to use cron or task scheduler on
> your pc to run a script that uses ssh to log into the radio and then
> reboot? You might collect some statistics before rebooting, or kill an
> offending process and relaunch it without rebooting.
This is what I do. I have a simple python script that queries LMS to get
the IP address of my SB Radio, and then SSH's onto the radio and
triggers the reboot.
Code:
--------------------
#!/usr/bin/env python3
import json
import os
import requests
SERVER_IP = '127.0.0.1'
PLAYER_NAME = 'Radio'
try:
resp = json.loads(requests.post('http://%s:9000/jsonrpc.js' % SERVER_IP, data
= '{"id":1,"method":"slim.request","params":["",["serverstatus",0,100]]}').text)
for player in resp['result']['players_loop']:
if player['name']==PLAYER_NAME:
ip = player['ip'].split(':')[0]
os.popen('ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c aes128-cbc
root@%s reboot' % ip)
except:
print("FAILED")
--------------------
*Material debug:* 1. Launch via http: //SERVER:9000/material/?debug=json
(Use http: //SERVER:9000/material/?debug=json,cometd to also see update
messages, e.g. play queue) 2. Open browser's developer tools 3. Open
console tab in developer tools 4. REQ/RESP messages sent to/from LMS
will be logged here.
------------------------------------------------------------------------
cpd73's Profile: http://forums.slimdevices.com/member.php?userid=66686
View this thread: http://forums.slimdevices.com/showthread.php?t=111663
_______________________________________________
Radio mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/radio