summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build.PL2
-rw-r--r--README1
-rwxr-xr-xbin/dthumb4
-rwxr-xr-xlib/App/Dthumb.pm19
4 files changed, 25 insertions, 1 deletions
diff --git a/Build.PL b/Build.PL
index 5ec738b..c93bbd7 100644
--- a/Build.PL
+++ b/Build.PL
@@ -21,7 +21,9 @@ my $build = Module::Build->new(
'Data::Section' => 0,
'Getopt::Long' => 0,
'Image::Imlib2' => 0,
+ 'IO::Handle' => 0,
'MIME::Base64' => 0,
+ 'Time::Progress' => 0,
},
);
$build->create_build_script();
diff --git a/README b/README
index 8678cef..f9fd483 100644
--- a/README
+++ b/README
@@ -4,6 +4,7 @@ Requires:
* perl version 5.10 or newer
* Data::Section
* Image::Imlib2
+ * Time::Progress
Installation:
diff --git a/bin/dthumb b/bin/dthumb
index fc76350..f3eb2cd 100755
--- a/bin/dthumb
+++ b/bin/dthumb
@@ -45,6 +45,8 @@ images.
Note that recursion is not yet supported.
+During operation, B<dthumb> will show its progress on STDERR.
+
=head1 OPTIONS
=over
@@ -104,6 +106,8 @@ F<.dthumb>, which contains various data (so far icons and javascript code).
=item * Image::Imlib2
+=item * Time::Progress
+
=back
=head1 BUGS AND LIMITATIONS
diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm
index ed1ed72..2a4ae27 100755
--- a/lib/App/Dthumb.pm
+++ b/lib/App/Dthumb.pm
@@ -10,11 +10,13 @@ use base 'Exporter';
use App::Dthumb::Data;
use Cwd;
use Image::Imlib2;
+use IO::Handle;
+use Time::Progress;
our @EXPORT_OK = ();
our $VERSION = '0.1';
-local $| = 1;
+STDERR->autoflush(1);
sub new {
my ($obj, $conf) = @_;
@@ -29,6 +31,7 @@ sub new {
$ref->{config} = $conf;
$ref->{data} = App::Dthumb::Data->new();
+ $ref->{timer} = Time::Progress->new();
$ref->{html} = $ref->{data}->get('html_start');
@@ -94,6 +97,11 @@ sub read_directories {
@{$self->{files}} = sort { lc($a) cmp lc($b) } @files;
@{$self->{old_thumbnails}} = @old_thumbs;
+
+ $self->{timer}->attr(
+ min => 1,
+ max => scalar @files,
+ );
}
sub create_files {
@@ -132,9 +140,16 @@ sub create_thumbnails {
my ($self) = @_;
for my $file (@{$self->{files}}) {
+
+ print STDERR $self->{timer}->report(
+ "\r\e[KCreating Thumbnails: %p done, %L elapsed, %E remaining",
+ ++$self->{current_file_id},
+ );
+
$self->create_thumbnail_html($file);
$self->create_thumbnail_image($file);
}
+ print "\n";
}
sub create_thumbnail_html {
@@ -219,3 +234,5 @@ sub write_out_html {
# }
# return;
#}
+
+1;