From f1d1250227aff1034009824ec5ce723d45397ec2 Mon Sep 17 00:00:00 2001 From: Ian Beckwith Date: Sat, 2 Oct 2010 01:48:02 +0100 Subject: [PATCH] tweaked error messages --- bin/id3fs-index | 5 ++--- lib/ID3FS/AudioFile.pm | 3 ++- lib/ID3FS/DB.pm | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/id3fs-index b/bin/id3fs-index index 93a6ebf..cff0990 100755 --- a/bin/id3fs-index +++ b/bin/id3fs-index @@ -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); diff --git a/lib/ID3FS/AudioFile.pm b/lib/ID3FS/AudioFile.pm index 8d86314..4086f63 100644 --- a/lib/ID3FS/AudioFile.pm +++ b/lib/ID3FS/AudioFile.pm @@ -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; diff --git a/lib/ID3FS/DB.pm b/lib/ID3FS/DB.pm index 96b4f8a..e09e754 100644 --- a/lib/ID3FS/DB.pm +++ b/lib/ID3FS/DB.pm @@ -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) -- 2.11.0