我正在尝试让我的 callerid 脚本向我的 boxee 盒子连接的电视发送通知。我已经在我的几台计算机上使用 mgetty 和 notify-send 使脚本正常工作。
这是我的 cidscript.sh,它由 mgetty 触发
#!/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
我认为 json rpc 将是让它工作的唯一方法我已经设法在原始端口 9090 上远程登录到 boxee 盒子然后配对我的设备
所以脚本需要发送连接命令
{"jsonrpc": "2.0", "method": "Device.Connect", "params":{"deviceid": "############"}, "id": 1}
然后是实际的通知
{"jsonrpc": "2.0", "method": "GUI.NotificationShow", "params":{"msg" : "Phone call from... $CALLER_NAME $CALLER_ID"}, "id": 1}
我试过这个无济于事
curl -d '{"jsonrpc": "2.0", "method": "Device.Connect", "params":{"deviceid": "00112fa696c9"}, "id": 1}\
{"jsonrpc": "2.0", "method": "GUI.NotificationShow", "params":{"msg" : "test"}, "id": 1}' -i 192.168.1.6 9090