From 37a7b741692997d8cf7ecc371dc5c829a388067d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 28 Feb 2011 18:47:35 +0100 Subject: Move CLI code from App::Dthumb to bin/dthumb --- bin/dthumb | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'bin/dthumb') diff --git a/bin/dthumb b/bin/dthumb index 64c527a..ced3a78 100755 --- a/bin/dthumb +++ b/bin/dthumb @@ -8,8 +8,13 @@ use autodie; use App::Dthumb; use Getopt::Long qw(:config no_ignore_case); +use IO::Handle; +use Time::Progress; + +STDERR->autoflush(1); my $opt = {}; +my $id = 1; GetOptions( $opt, @@ -25,8 +30,31 @@ GetOptions( ) or die("Please see perldoc -F $0\n"); my $dthumb = App::Dthumb->new($opt); +my $timer = Time::Progress->new(); + + +$dthumb->check_cmd_flags(); +$dthumb->read_directories(); +$dthumb->create_files(); +$dthumb->delete_old_thumbnails(); + +$timer->attr( + min => 1, + max => scalar $dthumb->get_files(), +); + +for my $file ($dthumb->get_files()) { + print STDERR $timer->report( + "\r\e[KCreating Thumbnails: %p done, %L elapsed, %E remaining", + $id++, + ); + + $dthumb->create_thumbnail_html($file); + $dthumb->create_thumbnail_image($file); +} +print "\n"; -$dthumb->run(); +$dthumb->write_out_html(); __END__ -- cgit v1.2.3