vpeter
Actually I used and it worked :):
http://user:[email protected]:58080/jsonrpc)
Now I am suffering with the script.. grrr. I'm not a unix guy. My Script:
MyPI:~/.config # more testscript.sh
myvar=""
myvar=$(curl -s -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "p roperties": ["tvshowid"], "playerid": 1}, "id": "VideoGetItem"}' http://user:[email protected]:58080/json rpc)
echo $myvar
if [[ $myvar == *"unknown"* ]]
then
echo "NOT PLAYING"
else
echo "PLAYING"
fi
MyPI:~/.config #
MyPI:~/.config # ./testscript.sh
{"id":"VideoGetItem","jsonrpc":"2.0","result":{"item":{"label":"","type":"unknown"}}}
PLAYING
MyPI:~/.config #
The variable is storing the output correctly, but I don't seem to find away how to check if the variable contains 'unknown' The problem seems to be the IF statement with the pattern matching.
Any ideas are welcome