only complain about missing albums if $verbose, complain about artists always
[id3fs.git] / lib / ID3FS / DB.pm
index f457905..d149b6a 100644 (file)
@@ -454,9 +454,15 @@ sub add
     my $haspic=$file->haspic();
 
     $artist=undef unless($self->ok($artist));
+    print "$self->{me}: $path: no artist tag defined\n" unless(defined($artist));
     my $artist_id=$self->add_to_table("artists",  $artist);
     my $path_id=$self->add_to_table("paths", $pathpart);
     $album=undef unless($self->ok($album));
+    if($self->{verbose} && !defined($album))
+    {
+       print "$self->{me}: $path: no album tag defined\n";
+    }
+
     my $albums_id=$self->add_to_table("albums", $album);
     my $file_id=$self->add_to_table("files", $filepart,
                                    { "artists_id" => $artist_id,
@@ -560,7 +566,7 @@ sub files_in
 {
     my ($self, $dir)=@_;
     $dir=~s/^$self->{base}\/?//;
-    print "Munged dir: $dir\n";
+#    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");
@@ -578,7 +584,7 @@ sub prune_directories
     {
        my($path, $id)=@$pathpair;
        my $fullpath="$self->{absbase}/$path";
-       print "PRUNING PATH $fullpath: ";
+#      print "PRUNING PATH $fullpath: ";
        unless(-d $fullpath)
        {
            push(@ids, $id)
@@ -591,6 +597,7 @@ sub prune_directories
 sub prune_paths
 {
     my($self, @ids)=@_;
+    return unless(@ids);
     my $sql=("DELETE FROM files WHERE paths_id IN (\n\t" .
             join(', ', map { "\"$_\""; } @ids). "\n\t)");
     print "SQL: \n", $sql, "\n";