diff options
author | Daniel Friesel <derf@finalrewind.org> | 2012-08-19 12:12:30 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2012-08-19 12:14:51 +0200 |
commit | ef33ea24e3e472d8098bd490043e5c0f53d9374c (patch) | |
tree | 338af381bca50437c37de2c020a8cf59b49d3f9d | |
parent | 0e96a7165de21a1e14d106224ab41d58a1b65db1 (diff) |
move db_info into Hashl.pm
-rwxr-xr-x | bin/hashl | 18 | ||||
-rw-r--r-- | lib/App/Hashl.pm | 9 |
2 files changed, 14 insertions, 13 deletions
@@ -21,6 +21,7 @@ my $db_file = '.hashl.db'; my $total = 0; my $cur = 0; my $show_progress = 1; +my @edb_files; my $timer; my $incoming_dir; my $read_size; @@ -34,6 +35,7 @@ STDERR->autoflush(1); GetOptions( 'd|database=s' => \$db_file, + 'e|extra-db=s' => \@edb_files, 'f|force' => \$add_unignore, 'n|no-progress' => sub { $show_progress = 0 }, 's|read-size=i' => sub { $read_size = $_[1] * 1024 }, @@ -83,7 +85,7 @@ sub get_total { } sub drop_deleted { - for my $file ( $hashl->files() ) { + for my $file ( $hashl->files ) { if ( not -e $file ) { $hashl->delete_file($file); } @@ -126,16 +128,6 @@ sub db_find_known { return; } -sub db_info { - printf( "Database created by hashl v%s\n", $hashl->db_version, ); - printf( - "Read size: %d bytes (%s)\n", - $hashl->read_size, $hashl->si_size( $hashl->read_size ), - ); - - return; -} - sub file_info { my ($file) = @_; @@ -335,7 +327,7 @@ sub cmd_info { file_info($file); } else { - db_info(); + $hashl->db_info(); } return; @@ -549,7 +541,7 @@ C<< cd /tmp/mnt/ext; hashl copy /media/videos/incoming >> Personally, I have all my videos on an external hard disk, which I usually do not carry with me. So, when I get new videos, I put them into F<~/lib/videos> -on my netboo, and then later copy them to the external disk. Of course, it +on my netbook, and then later copy them to the external disk. Of course, it can always happen that I get a movie I already have, or forget to move something from F<~/lib/videos> to the external disk, especially since I also always have some stuff from the disk in F<~/lib/videos>. diff --git a/lib/App/Hashl.pm b/lib/App/Hashl.pm index dc5fca5..f17f771 100644 --- a/lib/App/Hashl.pm +++ b/lib/App/Hashl.pm @@ -107,6 +107,15 @@ sub read_size { return $self->{config}->{read_size}; } +sub db_info { + my ($self) = @_; + + return sprintf( + "Database created by hashl v%s\n" . "Read size: %d bytes (%s)\n", + $self->db_version, $self->read_size, $self->si_size( $self->read_size ), + ); +} + sub db_version { my ($self) = @_; |