Page 1 of 1

Grabbing a representative alarm image? [SOLVED]

Posted: Mon May 24, 2010 11:16 pm
by Kepesk
ZomeAlarm is awesome. I have it successfully detecting when someone approaches my front door, and through a script, sending me a notification through gtalk.

However, I also would like to be able to grab an image that is representative of that alarm (such as the first alarmed image or the most alarmed image) and use the script to copy it to a particular location on my server for easy access.

Does anyone know a way of passing an image location to a script in this manner? Or is there another way to go about this altogether?

Thanks!

Posted: Wed May 26, 2010 4:34 pm
by Kepesk
I figured out a way to do it, not by having the script grab the image location from ZoneMinder, but by having the script determine the proper file on its own:

Code: Select all

#!/bin/bash
NEWEST=
for f in ls /var/cache/zoneminder/events/FrontDoor/*/030-capture.jpg
do
    if [ -z "$NEWEST" ]
    then
        NEWEST=$f
    elif [ "$f" -nt "$NEWEST" ]
    then
        NEWEST=$f
    fi
done
cp $NEWEST /var/www/mh/frontdoornewest.jpg
In this case, FrontDoor is the name of my camera, and it has a pre event image count of 30, so 030-capture.jpg would be the first alarmed frame.