Hello devs, I'm sure someone with the minimal skill I lack can help me out with some python json bash scripting help.
I'm trying to get my callerid script to send a notification to my boxee box connected tv. I've got the script working using mgetty and notify-send on a couple of my computers.
here is my cidscript.sh which gets triggered by mgetty
Code:#!/bin/sh # send message to computer ssh -o ConnectTimeout=10 mrplow@192.168.1.10 "DISPLAY=:0 notify-send 'Phone call from... $CALLER_NAME $CALLER_ID'" & sleep 0.2 ssh -o ConnectTimeout=10 christine@192.168.1.3 "DISPLAY=:0 notify-send 'Phone call from... $CALLER_NAME $CALLER_ID'" & sleep 0.2 ssh -o ConnectTimeout=10 mrplow@192.168.1.120 "DISPLAY=:0 notify-send 'Phone call from... $CALLER_NAME $CALLER_ID'" & sleep 0.2 su mrplow -c "DISPLAY=:0.0 notify-send 'Phone call from... $CALLER_NAME $CALLER_ID'" & sleep 5 # update logs echo `date +"%F %a %r"`"|$CALLER_ID|$CALLER_NAME" >> /home/mrplow/answering_machine/logs/incoming-calls.log scp -o ConnectTimeout=10 /home/mrplow/answering_machine/logs/incoming-calls.log christine@192.168.1.3:/home/christine/Desktop/incoming-calls.log sleep 0.2 exit 1
so onto the boxee box...
I think json rpc is going to be the only way to get this to work without making an actual app. the webgui doesn't seem to support any notifications
I've managed to telnet into the boxee box on raw port 9090
then paired my device using the help from this thread source:forums.boxee.tv
request pair code
{"jsonrpc": "2.0", "method": "Device.PairChallenge", "params": {"deviceid": "############", "applicationid": "testapp", "label": "test", "icon": "http://blah.com/test.jpg", "type": "tablet"}, "id": 1}
send pair code
{"jsonrpc": "2.0", "method": "Device.PairResponse", "params":{"deviceid": "############", "code": "####"},"id": 1}
here is the fuction I'm trying to get working
connect
{"jsonrpc": "2.0", "method": "Device.Connect", "params":{"deviceid": "############"}, "id": 1}
this is the part I can't figure out, I'm good with copy paste not so much with this though
GUI.NotificationShow
Show notification dialog for 5 seconds.
PARAMETER
msg string message to display in the notification dialog
source:developer.boxee.tv
here is what I have guessed/tried
if anyone could help with the notification json line or with implementing it in my script I'd be greatfull, or just help with the script in general I'd be grateful. Sometimes the mgetty script returns null parameters when it has missing caller info and because of this sometimes my script returns the previous caller's info but thats really for another message board3Code:{"jsonrpc": "2.0", "method": "GUI.NotificationShow", "test"} {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "msg":"test"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "params":{"test"}, "id": 1} {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "msg":{"test"}, "id": 1} {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "msg":{"test"}} {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "msg":"test", "id": 1} {"error":{"code":-32602,"data":{"method":"GUI.NotificationShow","stack":{"message":"Missing parameter","name":"msg","type":"string"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "params":"test", "id": 1} {"error":{"code":-32600,"message":"Invalid request."},"id":1,"jsonrpc":"2.0"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "params":"test"} {"error":{"code":-32600,"message":"Invalid request."},"id":null,"jsonrpc":"2.0"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "string":test} {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"} {"jsonrpc": "2.0", "method": "GUI.NotificationShow", "string":"test"}


Reply With Quote

Bookmarks