Kodi Community Forum

Full Version: return info if recording
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi, i been trying to find out a way to json rpc return if the xbmc is recording.

i built in a script so it do several checks to perform before suspend, but when we add a programed recording, when xbmc wakeups and start recording it doesnt actually play the recording so my script doesnt detect any activity by xbmc, so i need to check if pvr is recording.

can some post me the example with json rpc ?
hey, pls some1 know command, i have searched and searched and i havent got any luck with pvr.getproperties, i just cant do the json request right :S
Completely untested since I don't have a PVR backend
Code:
{ "jsonrpc": "2.0", "method": "PVR.GetProperties", "params": { "properties": [ "recording" ] }, "id": 1 }
For the ones that need, here the script i build to check before suspeding,
add it to crontab , but first edit and check your internal ip, my is in the range of 192.168.1.x so you need to change that if you have different.
also do changes in the system idle, i have set 30 seconds for testing proposes, and in the real script i coment all the "then" Echos


#!/bin/bash
Video=$(curl -s -u xbmc:xbmc -X POST -H 'Content-type: application/json' -d '{"jsonrpc": "2.0", "method": "Player.GetItem", "params": {"playerid":1 }, "id": 1}' http://localhost:8080/jsonrpc)
Audio=$(curl -s -u xbmc:xbmc -X POST -H 'Content-type: application/json' -d '{"jsonrpc": "2.0", "method": "Player.GetItem", "params": {"playerid":0 }, "id": 1}' http://localhost:8080/jsonrpc)
Picture=$(curl -s -u xbmc:xbmc -X POST -H 'Content-type: application/json' -d '{"jsonrpc": "2.0", "method": "Player.GetItem", "params": {"playerid":2 }, "id": 1}' http://localhost:8080/jsonrpc)
IsIdle=$(curl -s -u xbmc:xbmc -X POST -H 'Content-type: application/json' -d '{"jsonrpc": "2.0", "method": "XBMC.GetInfoBooleans", "params": { "booleans": ["System.IdleTime(30) "] }, "id": 1}' http://localhost:8080/jsonrpc)
Rec=$(curl -s -u xbmc:xbmc -X POST -H 'Content-type: application/json' -d '{"jsonrpc": "2.0", "method": "PVR.GetProperties", "params": { "properties": [ "recording" ] }, "id": 1 }' http://localhost:8080/jsonrpc)


echo "Watching Videos: $Video"
echo "PVR Record Active: $Rec"
echo "Sistem Idle mode: $IsIdle"
echo "Watching Fotos: $Picture"
echo "Listening Audio: $Audio"

if "$Video" =~ error (wiki)
then
#echo No Videos Playing
if "$Audio" =~ error (wiki)
then
#echo No Audio Playing
if "$IsIdle" =~ true (wiki)
then
echo System Is in Idle Mode
if [ `netstat -a |grep 9982 |grep 192.168 | wc -l` == "0" ]
then
echo No Active TVHEADEND CLIENT
if [ `netstat |grep 1679 | wc -l` == "0" ]
then
echo No UPNP Client
if "$Picture" =~ error (wiki)
then
echo not Wacthing Pictures
if [ `ps -a |grep apt-get | wc -l` == "0" ]
then
echo System Not Updating
if [ `netstat -ute |grep 9981 |grep 192.168 | wc -l` == "0" ]
then
echo No Web Client in Tvheadend
if [ `netstat -an |grep :80 |grep 192.168.1 | wc -l` == "0" ]
then
echo XBMC Web 80 No Clients
if "$Rec" =~ false (wiki)
then
echo PVR Not Recording
if [ `/usr/bin/smbstatus | grep DENY | wc -l` == "0" ]
then
echo No Active Samba User
pm-suspend
else
echo System Samba User Active
fi
else
echo System PVR Recording Active
fi
else
echo System XBMC Web Clients On
fi
else
echo System TVHeadend Web Clients on
fi
else
echo System Updating
fi
else
echo System Playing Pictures
fi
else
echo System Clients UPNP ON
fi
else
echo System TVHeadend Clients ON
fi
else
echo System Not Idle Mode
fi
else
echo System Playing Audio
fi
else
echo System Playing Movie
fi
exit 0