diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-02-28 18:47:35 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-02-28 18:47:35 +0100 |
commit | 37a7b741692997d8cf7ecc371dc5c829a388067d (patch) | |
tree | 0a1ec749d6f8e53fba40c56a4304c8a8974ea2a1 /bin/dthumb | |
parent | 46cd0526adfe160984e36dcfc7af208b7ba6cd38 (diff) |
Move CLI code from App::Dthumb to bin/dthumb
Diffstat (limited to 'bin/dthumb')
-rwxr-xr-x | bin/dthumb | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -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__ |