tweaked error messages
authorIan Beckwith <ianb@erislabs.net>
Sat, 2 Oct 2010 00:48:02 +0000 (01:48 +0100)
committerIan Beckwith <ianb@erislabs.net>
Sat, 2 Oct 2010 00:48:20 +0000 (01:48 +0100)
bin/id3fs-index
lib/ID3FS/AudioFile.pm
lib/ID3FS/DB.pm

index 93a6ebf..cff0990 100755 (executable)
@@ -54,14 +54,14 @@ else
     {
        if(Cwd::abs_path($path) !~ /^$abs_base/)
        {
-           print "$me, $path is outside $base, skipping\n";
+           print "$me: $path is outside $base, skipping\n";
        }
        File::Find::find( {wanted => \&wanted, follow => 1, no_chdir => 1}, $path);
     }
     my $directories_pruned=$db->prune_directories();
     if($files_pruned || $directories_pruned)
     {
-       print "Removing data from pruned files\n" if $verbose;
+       print "$me: removing data from pruned files\n" if $verbose;
        $db->remove_unused();
     }
 }
@@ -87,7 +87,6 @@ sub prune
 {
     my $dir=shift;
     return unless(opendir(DIR, $dir));
-    print "Pruning $dir\n";
     my @oldfiles=$db->files_in($dir);
     my @newfiles=grep { !/^\.\.?$/; } readdir(DIR);
     closedir(DIR);
index 8d86314..4086f63 100644 (file)
@@ -16,6 +16,7 @@ sub new
     my $path=shift;
     my $ext=($path=~/.*\.(.*)/)[0];
     return undef unless($ext);
+    my $me=shift;
     $ext=lc($ext);
     if($ext eq "mp3")
     {
@@ -31,7 +32,7 @@ sub new
     }
     else
     {
-       print("Unknown extension: $ext\n");
+       print("$me: $path: Unknown extension: $ext\n");
        return undef;
     }
     return $self;
index 96b4f8a..e09e754 100644 (file)
@@ -445,7 +445,7 @@ sub add
     {
        ($pathpart, $filepart) = ($relpath =~ /(.*)\/(.*)/);
     }
-    my $file=ID3FS::AudioFile->new($path);
+    my $file=ID3FS::AudioFile->new($path, $self->{me});
     return unless(defined($file));
     my $artist=$file->artist();
     my $album=$file->album();
@@ -568,7 +568,6 @@ sub files_in
 {
     my ($self, $dir)=@_;
     $dir=~s/^$self->{base}\/?//;
-#    print "Munged dir: $dir\n";
     my $sql=("SELECT files.name FROM files\n" .
             "INNER JOIN paths ON files.paths_id=paths.id\n" .
             "WHERE paths.name=?\n");
@@ -586,7 +585,6 @@ sub prune_directories
     {
        my($path, $id)=@$pathpair;
        my $fullpath="$self->{absbase}/$path";
-#      print "PRUNING PATH $fullpath: ";
        unless(-d $fullpath)
        {
            push(@ids, $id)