Put captures in a folder-structure
|
By:
JeanMu
Rank:
Frequent User
Topics:
16
From:
CH
|
Added:
08/21/2010 - 03:14 AM
Hi
I would like to have all the captured images in a folder structure instead of one flat folder wit thousands of files.
Example
D:\Captures\2010\08\21\20100821013152.jpg
or
D:\Captures\2010\08\21\013152.jpg
Or has anyone some tools or scripts that would help to organize alle the files during the night ?
Jean-Marc
|
By:
MelvinG
Rank:
Magna Cum Laude
Topics:
661
From:
Los Angeles, USA
|
Added:
08/21/2010 - 05:35 AM
I'm not aware of any such script existing. I can see why... it's useful but not the kind of thing that sounds like "great fun" to work on. However... work has been slow for me and I'm a bit bored. Maybe I can make something.
What do you prefer? An AbelCam plugin? Or an external script that you'd use the scheduler to run? If a script, PHP? Or Perl? Or ???
I'm not promising anything yet... just looking for more info and thinking about it.
|
By:
MelvinG
Rank:
Magna Cum Laude
Topics:
661
From:
Los Angeles, USA
|
Added:
08/21/2010 - 07:05 PM
Update: I've been looking at this problem a little more and I have decided I will make either a PHP script or a Perl script. The AbelCam Plugin option is not going to happen, at least not now.
So what do you want - Perl or PHP? If you haven't answered by the time I wake up later it will be done in Perl because PHP kinda sucks for this sort of job and Perl does not suck at all.
EDIT to add: Actually I did both - Perl & PHP. Scroll down a few posts to download scripts.
|
By:
MelvinG
Rank:
Magna Cum Laude
Topics:
661
From:
Los Angeles, USA
|
Added:
08/22/2010 - 04:03 PM
Here is the script solution for moving your captures (any .jpg files) into a folder structure as you described.
====================
EDIT on 2010-08-22: New version of the script uploaded. The link in this post now points to the new version. It runs insanely faster than the old version - 30 times faster on my system.
====================
It is a Perl script. Therefore, you will need to have a Perl interpreter available on your system. If you do not already have one, download this excellent free one and install it:
http://www.activestate.com/activeperl/downloads
This script digs into AbelCam's config.xml to find out what folder each of your cameras uses for Local Save. You will need to check the first line of the script to make sure it points to where your AbelCam config.xml is located. Change it if necessary. If your Windows is not US English you will definitely need to change it.
This script will work for more than one camera but you must make sure each camera has its own Local Save directory.
This script builds the folder structure under the Local Save directories. If Cam-1 uses c:\cam1saves for localsave, and Cam-2 uses c:\cam2saves, structures will look like this:
c:\cam1saves\2010\08\22
c:\cam2saves\2010\08\22
This script uses the files' timestamps, not the names, to decide which files go in what folders. The files simply get moved - the names are not messed with or changed in any way.
If you already have a bunch of old files built up in your Local Save directory this script will sort them all out the first time it is run. Every file it finds that is older than "today" will be moved to the appropriate folder. It will create all the folders it needs.
=============
Here is the link to the script:
http://eeberfest.net/AbelCam/jpeg_sort.zip
Download it and unzip it into some folder.
Here's a screenshot of how to set it up in the AbelCam Scheduler. This example assumes your Perl interpreter is installed in the default location (c:\perl\) and you unzipped the script into c:\perl_scripts.
I wrote this script just last night so it hasn't been tested over long periods of time. I did however test it quite a bit using old and new jpg files and it seems to work just fine.
|
By:
sse
Rank:
Forum Addict
Topics:
73
From:
n/a
|
Added:
08/23/2010 - 08:39 AM
Hello Melvin
that's a very good application for the scheduler.
Probably the location of the configuration folder could be taken from the environment,
something like
my $config = $ENV{'APPDATA'} . "/Seiz System Engineering/AbelCam/config.xml"; should work, no matter what OS and language is used.
|
By:
MelvinG
Rank:
Magna Cum Laude
Topics:
661
From:
Los Angeles, USA
|
Added:
08/23/2010 - 03:10 PM
Good point about the $ENV. When I first sat down to make that script I was thinking it would all be super easy because of all the app-specific environment variables AbelCam sets... and then I woke up and remembered I wouldn't be running under the webserver. Lol. So I went to the other extreme of using no env at all.
EDIT later to add: Hmmm, $ENV['APPDATA'] points to the logged-in user's appdata dir - not the All Users dir - on my XP system.
I'm still a bit bored, so I'm going to translate that script into PHP and post it later today. Will modify the Perl version to use APPDATA as you suggest, and re-post that at the same time.
It might be useful if at some point in the future the scheduler had a new "Type" option: a way (without having to run external 'wget' or similar) to do an HTTP GET to the running AbelCam server and discard any returns. The idea being to make a CGI-like thing run once - maybe a call to K8055 plugin or a PHP program (with full environment) ... Just thinking out loud here - not a fully developed idea at all,
|
By:
MelvinG
Rank:
Magna Cum Laude
Topics:
661
From:
Los Angeles, USA
|
Added:
08/23/2010 - 07:03 PM
Here is the PHP version of the same script.
All comments from my previous post about the Perl version apply to this PHP version too.
You will need to edit the Timezone info (as well as the previously described path info). See first few lines of the script.
Download: http://eeberfest.net/AbelCam/jpeg_sort_php.zip
Assuming your PHP interpreter was installed in the default location, and you've unzipped this script into c:\php_scripts, the Scheduler setup looks like this:
|
By:
MelvinG
Rank:
Magna Cum Laude
Topics:
661
From:
Los Angeles, USA
|
Added:
08/24/2010 - 09:15 AM
Just for fun and follow-up, here's my best shot at a solution for the AbelCam config path & environment variables situation we were discussing earlier in the thread.
$user = $ENV{'USERPROFILE'};
$apps = $ENV{'APPDATA'};
$all = $ENV{'ALLUSERSPROFILE'};
# Convert all Win "\" to Un*x "/"
# otherwise the s/ / /; below fails.
$apps=~s/\\/\//g;
$user=~s/\\/\//g;
$all=~s/\\/\//g;
$apps=~s/$user/$all/i;
$realpath = $apps . "/Seiz System Engineering/AbelCam/config.xml";
|
By:
MelvinG
Rank:
Magna Cum Laude
Topics:
661
From:
Los Angeles, USA
|
Added:
08/25/2010 - 07:35 PM
BUMP - to draw attention to the edits to my earlier posts - specifically the fact that I've updated the script since posting it originally.
|
By:
JeanMu
Rank:
Frequent User
Topics:
16
From:
CH
|
Added:
08/26/2010 - 12:22 AM
Wwwooowww !!!
So fast ! I did not have the time to check the forum. I hope I finde the time later this week to test it !
Thank you !
|
By:
SeanGa
Rank:
Frequent User
Topics:
15
From:
n/a
|
Added:
08/26/2010 - 08:03 PM
Melvin,
This was something I was look at doing myself. I didn't even think of using the scheduler to keep things sync'd. Brilliant. Thanks for your trouble. Can't wait to try it out.
|