summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-08-19 12:12:30 +0200
committerDaniel Friesel <derf@finalrewind.org>2012-08-19 12:14:51 +0200
commitef33ea24e3e472d8098bd490043e5c0f53d9374c (patch)
tree338af381bca50437c37de2c020a8cf59b49d3f9d
parent0e96a7165de21a1e14d106224ab41d58a1b65db1 (diff)
move db_info into Hashl.pm
-rwxr-xr-xbin/hashl18
-rw-r--r--lib/App/Hashl.pm9
2 files changed, 14 insertions, 13 deletions
diff --git a/bin/hashl b/bin/hashl
index 1d53691..d3187c5 100755
--- a/bin/hashl
+++ b/bin/hashl
@@ -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) = @_;