[ale] "motion" and snapshots?
Robert L. Harris
Robert.L.Harris at rdlg.net
Wed Apr 7 22:37:14 EDT 2004
I'll compare yours against mine I wrote while waiting on my freaking
cablemmodem to come up. Helped when I found the "onsave" directive in
the config file.
Thanks for pointing out this proggy, it's great.
Thus spake Geoffrey (esoteric at 3times25.net):
> Robert L. Harris wrote:
> >
> >I know Geoff and a couple others are playing with "motion". I just
> >got a new webcam and it's actually supported. Getting motion up and
> >online was quick and I love the built in web server. So far the only
> >problem I've got is the snapshots are saved in
> ><prefix>/2004/04/08/21/22/snapshot.jpg format instead of somethign
> >like /prefix/200404082122.jpg which makes poking through a history
> >much simpler. Anyone found a way to manage something like this?
>
> I've got a perl script around here that does a conversion like this, let
> me look around...... Ah, here it is! It's ugly, it's old, it uses
> static directory values, feel free to hack away at it. Hope it helps!
>
> --
> Until later, Geoffrey Registered Linux User #108567
> Building secure systems in spite of Microsoft
> #!/usr/bin/perl
>
> # use diagnostics;
> use strict;
>
> my ($nfn, $fn, @parts, %newdir, %newfn, $i, $key, $value, %file, @df, @data);
>
> chdir "/home/esoteric/watch" || die "died attempting to chdir";
>
> my @files = `find . -name '*.jpg' -print`;
>
> printf "files to move: %s\n", $#files + 1;
>
> my @pre_df=`df /home/esoteric/store`;
>
> foreach $fn (@files) {
>
> # parse through each file name, and build the new filename
> # and directory name the file will reside
>
> chomp $fn;
> @parts = split ("/", $fn);
> $file{$fn} = $parts[0];
> $newdir{$fn} = "/home/esoteric/store/archive/" .
> substr($parts[1], 2, 2) . $parts[2] . $parts[3];
> $newfn{$fn} = $parts[4] . $parts[5] . substr($parts[6], 0, 2);
>
> for ($i = 1; $i < $#parts; $i++) {
> $file{$fn} = $file{$fn} . "/" . $parts[$i];
> }
> }
>
> my $count=0;
>
> while (($key, $value) = each %file) { $count++; }
>
> printf "files to move: %s\n", $count;
>
> $count=0;
> while (($key, $value) = each %file) {
>
> # create the directory if it does not exist
>
> if ( ! -d $newdir{$key} ) { mkdir $newdir{$key}; }
>
> # insure unique file names
>
> $nfn=$newdir{$key} . "/" . $newfn{$key} . ".jpg";
>
> while ( -e $nfn ) {
> printf "Found a duplicate <%s> and <%s>\n", $nfn, $newfn{$key};
> print "Changing file name";
> $nfn=$newdir{$key} . "/" . $newfn{$key} . "a.jpg";
> }
>
> # printf "moving %s to %s\n", $key, $nfn;
> `/bin/mv $key $nfn`;
> if ( ! -e $nfn ) { die "file doesn't exist, mv failed\n" }
> # if ( $? != 0 ) {die "mv $key $nfn failed ($?)";}
> $count++;
> }
> print "files moved: $count\n";
>
> # $list=`find * -type d -depth -print`;
> # print "list of directories located: $list\n";
> `find * -type d -depth -print |xargs rmdir`;
>
> @df=`df /home/esoteric/store`;
> @data = split " ", $df[1];
> $data[4] =~ s/%//;
> print $pre_df[1];
> print $df[1];
> if ( $data[4] > 98 ) {
> `/home/esoteric/shl/dosound /home/esoteric/sounds/intercom.au`;
> }
> exit;
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
:wq!
---------------------------------------------------------------------------
Robert L. Harris | GPG Key ID: E344DA3B
@ x-hkp://pgp.mit.edu
DISCLAIMER:
These are MY OPINIONS ALONE. I speak for no-one else.
With Dreams To Be A King First One Should Be A Man
- Manowar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
More information about the Ale
mailing list