OK... I have something working...
It isn't perfect, but it is a start. There are 2 major issues with this approach:
1 - You need to specify the script as an 'Execute command on all matches' script in your ZM filter configuration. This works, but
it is not executed very quickly due to the way ZM handles filters. Ideally, you will probably want this to run as part of a daemon that
watches /var/log/messages so that it is triggered almost instantly, instead of 60 seconds after the event is finished. I can do that easily and
send you the script at some point.
2. Right now this will display the live video of your camera for 15 seconds full-screen and that is not ideal either so I will look at making it appear
as a small window, but that requires you to have to install an AddOn for XBMC and I was hoping to avoid that. It also stops any video that is
currently playing, but we can avoid that when I make it an overlay window.
Hopefully you have some Linux skill and the commands below make sense.
P.S. Make sure you have curl installed on your system.
See below:
root@system-z:/var/lib/zm/bin# pwd
/var/lib/zm/bin
root@system-z:/var/lib/zm/bin# ls -l
total 4
-rwxrwxrwx 1 www-data www-data 835 2013-02-26 20:17 xbmc_alert.sh
root@system-z:/var/lib/zm/bin# chown -R www-data
root@system-z:/var/lib/zm/bin# chgrp -R www-data
root@system-z:/var/lib/zm/bin# cat xbmc_alert.sh
Code: Select all
#!/bin/bash
#ZoneMinder Info
zm_monitor=`basename \`dirname $1\``
zm_ip="192.168.1.100"
zm_user="admin"
zm_password="password"
#XBMC Info
xbmc_ip="192.168.1.101"
xbmc_user="XBMC"
xbmc_password="xbmc"
#Sleep time
sleeptime=15
curl -v -u ${xbmc_user}:${xbmc_password} -d \
"{ \"jsonrpc\": \"2.0\", \"method\": \"Player.Open\", \
\"params\": { \"item\": { \"file\": \
\"http://${zm_ip}/cgi-bin/nph-zms?mode=jpeg&monitor=${zm_monitor}&scale=100&user=${zm_user}&pass=${zm_password}\" }}, \
\"id\": 1 }" -H "Content-type:application/json" \
-X POST "http://${xbmc_ip}:8080/jsonrpc"
sleep $sleeptime
#Stops the player/picture:
curl -v -u ${xbmc_user}:${xbmc_password} -d \
"{\"jsonrpc\": \"2.0\", \"method\": \"Player.Stop\", \
\"params\": { \"playerid\": 1 }, \
\"id\": 1}" -H "Content-type:application/json" \
-X POST "http://${xbmc_ip}:8080/jsonrpc"
exit 0