aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--TODO30
-rwxr-xr-xrenrot86
-rw-r--r--renrot.rc10
4 files changed, 78 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index 473503f..10f1d15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
$Log$
+Revision 1.75 2006/05/14 10:46:23 andy
+Check if we have files to process is added.
+Synchronize TODO with last changes.
+New option --aggr and --no-aggr for switch aggregation process.
+No put single letter for %E, %F, %I or %W when tags is absent.
+
Revision 1.74 2006/05/13 15:18:08 andy
Correct definition of aggregation related variables.
Merge files from ARGV and --file option.
@@ -293,3 +299,4 @@ Id keyword is added to renrot file.
Revision 1.1 2005/10/17 13:39:38 zeus
ChangeLog file is added. Its the very begining.
+
diff --git a/TODO b/TODO
index e6f5442..dd1bcf4 100644
--- a/TODO
+++ b/TODO
@@ -22,18 +22,28 @@ Disk I/O
+ to implement work with separate files rather than with whole directory
-- to implement possibility to work with several IN directories and to
- output to the set of OUT directories
-
- decrease disk IO operations as possible
- to implement possibility to work with other formats, which use EXIF
mechanism
+- remove hardcoded '.jpg' extension
+
++- implement aggregation option (to aggregate large bundle of files
+ according the different time intervals, perhapse with some kind of
+ euristics for analyzing the bigest time interval between shots)
+
+q to write intellectual aggregation on clisp
+
- to fix the feature with --aggr-template SOMENAME, when SOMENAME is dumb
name, no % character and than renrot moves all to SOMENAME directory it'll
be called OUTDIR
+- to implement possibility to work with several IN directories and to
+ output to the set of OUT directories
+
++ to implement --no-mtime, and put it to the config
+
File naming
@@ -41,10 +51,6 @@ File naming
possible to name files in a different ways, YYYYMMDDHHmmSS, YYMMDDHHmmSS
e.t.c.)
-- to implement aggregation option ( to aggregate large bundle of files
- according the different time intervals, perhapse with some kind of
- euristics for analyzing the bigest time interval between shots )
-
+ to make the file name counter format of the dynamic length, according
the files number in the directory to process, it means NN for the number
less than 100, e.t.c.
@@ -55,7 +61,7 @@ File naming
Verbosity
-+- to complete verbose output option implementation
++ to complete verbose output option implementation
q to implement progress indicator or spinning indicator
@@ -64,15 +70,9 @@ Other
- UTF8fy (comments, tags, ...) since it's not implemented in ExifTool yet
-+ to implement --no-mtime, and put it to the config
-
? to write the function 'on/off validator' NO NEED SINCE IT'S IMPLEMENTED IN
getOptions()
-- temporary turn back the option syntax no-...
-
- to tune style look of comments, code e.t.c.
-- to review the code to optimize it where it's possible.
-
-q to write intellectual aggregation on clisp
++- to review the code to optimize it where it's possible.
diff --git a/renrot b/renrot
index ac5bd5a..a9584ff 100755
--- a/renrot
+++ b/renrot
@@ -21,6 +21,7 @@ my $rotateAngle; # define the angle, to rotate on, 90 or 270
my $rotateThumbnail; # define the angle, to rotate on, 90 or 270
my $noRename; # no rename needed, default is to rename to the YYYYmmddHHMMSS.jpg
my $nameTemplate; # template for the filename taken from CLI
+my $aggr = 0; # execute aggregation after main process
my $aggrTemplate; # template for the files aggregation taken from CLI
my $aggrDelta; # aggregation time delta n seconds ( file with delta > $aggrDelta is placed to the new DIR
my $aggrDir; # counterless directory name for "delta" type aggregation
@@ -72,6 +73,7 @@ sub getOptions {
my $showVersion = 0; # need version
my $showHelp = 0; # need help
my $getOptions = GetOptions (
+ "aggr!" => \$aggr,
"aggr-delta=i" => \$aggrDelta,
"aggr-dir=s" => \$aggrDir,
"aggr-dumb!" => \$aggrDumb,
@@ -102,6 +104,7 @@ sub getOptions {
dbgmsg (3, "getOptions(): --no-rename: $noRename\n") if (defined $noRename);
dbgmsg (3, "getOptions(): --comment-file: $comfile\n") if (defined $comfile);
dbgmsg (3, "getOptions(): --name-template: $nameTemplate\n") if (defined $nameTemplate);
+ dbgmsg (3, "getOptions(): --aggr: $aggr\n") if (defined $aggr);
dbgmsg (3, "getOptions(): --aggr-template: $aggrTemplate\n") if (defined $aggrTemplate);
dbgmsg (3, "getOptions(): --aggr-delta: $aggrDelta\n") if (defined $aggrDelta);
dbgmsg (3, "getOptions(): --aggr-dir: $aggrDir\n") if (defined $aggrDir);
@@ -243,6 +246,12 @@ foreach $file ( @files ) {
}
}
+# No file to process?
+if ($#filenames < 0) {
+ fatalmsg ("No files to process!\n");
+ exit 1;
+}
+
# Prepare software string for EXIF injection
my $softwareString = sprintf("ExifTool v%s, RenRot v%s", $Image::ExifTool::VERSION, $VERSION);
dbgmsg (1, "main(): Software: $softwareString\n");
@@ -402,9 +411,8 @@ foreach $file ( @files ) {
}
# seting mtime for the file if been asked for
- if ( $Mtime == 1 ) {
- my $timestamp = getTimestamp();
- $mTime = getUnixTime($timestamp);
+ if ($Mtime != 0) {
+ $mTime = getUnixTime(getTimestamp());
utime $mTime,$mTime,$newfilename;
dbgmsg (2, "main(): Changing mtime for $newfilename ok.\n");
}
@@ -413,20 +421,29 @@ foreach $file ( @files ) {
$filecounter++;
}
+if ($aggr != 0) {
+ aggregationProcess();
+}
+
+exit 0;
+
########################################################################################
#
-# file aggregation if requested
+# aggregationProcess() aggregate files to separate directories by request
#
-my $filetmp;
-my $timestampPrev;
-my $filePrev;
-my $isNewDir;
-my $NewDir;
-my $DirCounter = 1;
-if ( $AggrTemplate ) {
+sub aggregationProcess {
+ my $filetmp;
+ my $timestampPrev;
+ my $filePrev;
+ my $isNewDir;
+ my $NewDir;
+ my $DirCounter = 1;
+
procmsg ("AGGREGATION\n=======================\n");
- dbgmsg (1, "Aggregation template: $AggrTemplate\n");
+ dbgmsg (1, "aggregationProcess(): Aggregation template: $AggrTemplate\n");
+
$filecounter = 1;
+
foreach $file ( sort ( keys %filenameshash ) ) {
$filetmp = $file;
$file .= ".jpg";
@@ -489,8 +506,6 @@ if ( $AggrTemplate ) {
}
}
-exit 0;
-
########################################################################################
#
# timeNow() returns timestamp in form YYYYmmddHHMMSS
@@ -696,6 +711,7 @@ Options:
--rotate-thumb <90|270> rotate only thumbnail by 90 or 270 degree (it's for the files which were rotated, but thumbnail wasn't)
--no-rename no rename needed, default is to rename to the YYYYmmddHHMMSS.jpg
--name-template <TPL> filename template (see manual for details)
+ --aggr (*) aggregation switcher, set it if you want to aggregate files
--aggr-template <TPL> aggregation template (see manual for details)
--aggr-delta aggregation time delta (file with delta great than --aggr-delta is placed to the --aggr-dir followed by directory name counter starting from 1)
--aggr-dir counterless aggregation directory name
@@ -704,7 +720,7 @@ Options:
--comment-file <FILE> file with commentary
--file <FILE> ... multiple values option, contains file to be processed
-v [-v -v ...] amount of these options defines debug level
- -h, --help display this help and exit
+ -?, --help display this help and exit
--version output version information and exit
(*) The option does not take an argument and may be negated, i.e. prefixed by 'no'. E.g. 'mtime' will allow '--mtime' (positive value will be assigned) and '--nomtime' and '--no-mtime' (negative value will be assigned).
@@ -733,12 +749,12 @@ sub template2name {
my $WhiteBalance = "";
if ( defined $info->{"ExposureTime"} ) {
- $ExposureTime = $info->{"ExposureTime"};
+ $ExposureTime = "E" . $info->{"ExposureTime"};
$ExposureTime =~ s/\//by/g;
}
if ( defined $info->{"FileNumber"} ) {
- $FileNumber = $info->{"FileNumber"};
+ $FileNumber = "F" . $info->{"FileNumber"};
}
if ( defined $info->{"FNumber"} ) {
@@ -746,11 +762,11 @@ sub template2name {
}
if ( defined $info->{"ISO"} ) {
- $ISO = $info->{"ISO"};
+ $ISO = "I" . $info->{"ISO"};
}
if ( defined $info->{"WhiteBalance"} ) {
- $WhiteBalance = $info->{"WhiteBalance"};
+ $WhiteBalance = "W" . $info->{"WhiteBalance"};
$WhiteBalance =~ s/[\s()]//g;
}
@@ -760,15 +776,15 @@ sub template2name {
'a' => $anglesuffix,
'c' => sprintf($counterprefixsize, $filecounter),
'd' => $tm[3],
- 'E' => "E" . $ExposureTime,
- 'F' => "F" . $FNumber,
+ 'E' => $ExposureTime,
+ 'F' => $FNumber,
'H' => $tm[4],
- 'I' => "I" . $ISO,
+ 'I' => $ISO,
'i' => $FileNumber,
'M' => $tm[5],
'm' => $tm[2],
'S' => $tm[6],
- 'W' => "W" . $WhiteBalance,
+ 'W' => $WhiteBalance,
'Y' => $tm[0],
'y' => $tm[1],
);
@@ -841,9 +857,9 @@ date/time pattern template, set with B<--aggr-template>.
=over
-=item B<-h> or B<--help>
+=item B<-?> or B<--help>
-the help
+display this help and exit
=item B<-c> or B<--config-file> I<Configuration FILE>
@@ -882,7 +898,7 @@ file with commentary
=item B<--version>
-the version of this script
+output version information and exit
=item B<--mtime>
@@ -912,13 +928,13 @@ B<%c> file order number in the processed file set
B<%d> day of the month (01-31)
-B<%E> ExposureTime tag value if defined, otherwise E
+B<%E> ExposureTime tag value if defined
-B<%F> FNumber tag value if defined, otherwise F
+B<%F> FNumber tag value if defined
B<%H> hour (00-23)
-B<%I> ISO tag value if defined, otherwise I
+B<%I> ISO tag value if defined
B<%i> FileNumber tag if exists (otherwise, it'll be replaced by string
C<NA>)
@@ -929,7 +945,7 @@ B<%m> month (01-12)
B<%S> second (00-59)
-B<%W> WhiteBalance tag value if defined, otherwise W
+B<%W> WhiteBalance tag value if defined
B<%Y> year (1900, 1901, and so on)
@@ -951,9 +967,9 @@ look L<EXAMPLES> section.
==item B<--aggr-delta>
the type of aggregation "delta". really it is aggregation time delta in seconds
-( file with DateTimeOriginal and the one of the previous file delta, greater
-than B<--aggr-delta> is placed to the B<--aggr-dir> folowed by directory name
-counter )
+(file with DateTimeOriginal and the one of the previous file delta, greater
+than B<--aggr-delta> is placed to the B<--aggr-dir> followed by directory name
+counter)
==item B<--aggr-dir>
@@ -970,7 +986,7 @@ aggregation mode when files are moved to directories created.
=head1 B<EXAMPLES>
-The name template C<01.%c.%Y%m%d%H%M%S.%i.%E%F%W%I> produces following names:
+The name template C<01.%c.%Y%m%d%H%M%S.%i.%E%F%W%I> may produces following names:
=over
@@ -978,7 +994,7 @@ The name template C<01.%c.%Y%m%d%H%M%S.%i.%E%F%W%I> produces following names:
01.0024.20040131230857.100-0078.E1by320F2.8WAutoI50.jpg
-01.0022.20000820222108.NA.EFWI.jpg
+01.0022.20000820222108.NA.jpg
=back
diff --git a/renrot.rc b/renrot.rc
index bbb78ca..d3f3691 100644
--- a/renrot.rc
+++ b/renrot.rc
@@ -14,22 +14,22 @@
#
-## Template used for file name building while renaming.
+## Template is used for file name building while renaming.
#
# Interpreted sequences are:
# %% a literal %
# %c file order number in the processed file set
# %d day of the month (01-31)
-# %E ExposureTime tag value if defined, otherwise E
-# %F FNumber tag value if defined, otherwise F
+# %E ExposureTime tag value if defined
+# %F FNumber tag value if defined
# %H hour (00-23)
-# %I ISO tag value if defined, otherwise I
+# %I ISO tag value if defined
# %i FileNumber tag if exists (otherwise, it'll be replaced by string "NA")
# %M minute (00-59)
# %m month (01-12)
# %S second (00-59)
-# %W WhiteBalance tag value if defined, otherwise W
+# %W WhiteBalance tag value if defined
# %Y year (1900, 1901, and so on)
# %y last two digits of year (00..99)
#$NameTemplate = '%Y%m%d%H%M%S';

Return to:

Send suggestions and report system problems to the System administrator.