Page 1 of 1

script to create directory with films of events...

Posted: Mon Jul 30, 2007 2:37 pm
by gab74
I need a script to create films of events recorded in this way

1. Create directory of days in which there are events.
2. Create in every directory the films of motions named with time of events.

in this way using nautilis i can browse the directories and find the films i want

Has anyone made something scripts ???
________
YAMAHA SRX

Posted: Tue Jul 31, 2007 12:30 pm
by gab74
I try to use something of this :

Code: Select all


#!/bin/bash
# zeroth, set magic variables
ZMHOME=/var/www/html/zm
MPEGDIR=/var/www/html/zmmpeg
cd $ZMHOME/events

mysql -u zm --password=zonepassr -D zm \
        -e "SELECT MonitorId,Id,Name FROM Events \
        ORDER BY MonitorID,Id" | sed 1d |
while read xMONITOR xEVENT xNAME
do
        # Sign on
        echo "Processing $xMONITOR/$xEVENT/$xNAME" >&2

        # check to make sure the event directory exists, or skip the event
        [ -d "$xMONITOR/$xEVENT" ] || {
                echo "=== Skipping $xMONITOR/$xEVENT -- no directory ===" >&2
                continue
        }
        cd $xMONITOR/$xEVENT

        # Now, we're in the right place.  Grab the timestamp off the first jpeg,
        # then build the mpeg and name it appropriately
        TIMESTAMP="`date -r \`ls | head -1\` -Iminutes`"

        CLIPNAME="${MPEGDIR}/${xNAME}-${TIMESTAMP}.mpg"
        echo "Processing $xMONITOR/$xEVENT/$xNAME" >&2

        ffmpeg -y -r 2.19 -i %03d-capture.jpg -s 480x360 -r 25 $CLIPNAME 
        echo "Processing $xMONITOR/$xEVENT/$xNAME" >&2

        cd ../..
        echo >&2

        sleep 2
done

But this only encode one subdirectory....not all subdirectories.....
Anyone can help me to correct this script to process all events directory and not one only ?
________
Bmw X5 History