target_dir /var/www ffmpeg_cap_new on output_normal=best ffmpeg_filename=%d-%m/motion/%H%M%S jpeg_filename=preview on_picture_save /usr/local/bin/RTgenhtmlThis way, motions saves jpeg's and avi's under /var/www/26-06/motion/ for the day 26th June, and runs the script. Then, a link with the jpeg pointing to the avi is appended to the index.html file (it is created if it does not exist) under /var/www/26-06.
#!/bin/bash BASENAME=`basename $1 .jpg` DATEDIR=/var/www/`date +%d-%m` gen_index() { cat <<header <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Motion</title> <meta name="description" content="Motion"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Expires" content="-1"> <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> </head> <body bgcolor="#000000" text="#ffffff" link="#00cfcf" vlink="#ffff66" alink="#99ffff" <div align="center"> <center><h1><a href="/">Motion</a></h1></center> <!-- START_OF_BODY --> </body> </html> header } cd $DATEDIR test -f index.html || gen_index > index.html cp index.html index.tmp LINK=\<A\ HREF=motion/$BASENAME.avi\>\<IMG\ border="0"\ src=motion/$BASENAME.jpg\>\</A\> sed '/^<!-- START_OF_BODY -->/a\'"$LINK" index.tmp > index.html rm index.tmp
What could I have done wrong.. I did have to change the directories to match mine.
-- TroyBackus - 14 Aug 2006
ProjectSummary | A bash script that generates html code in real time. |
ProjectStatus | Stable |
ReleaseVersion | |
ProjectSubmitter | Ramiro |