Index: trunk/lib/MP3/Find/DB.pm
===================================================================
--- trunk/lib/MP3/Find/DB.pm	(revision 18)
+++ trunk/lib/MP3/Find/DB.pm	(revision 19)
@@ -43,4 +43,8 @@
 );
 
+my $DEFAULT_STATUS_CALLBACK = sub {
+    my ($action_code, $filename) = @_;
+    print STDERR "$action_code $filename\n";
+};
 
 sub search {
@@ -89,6 +93,8 @@
 sub update_db {
     my $self = shift;
-    my $db_file = shift or croak "Need the name of the databse to update";
+    my $db_file = shift or croak "Need the name of the database to update";
     my $dirs = shift;
+    
+    my $status_callback = $self->{status_callback} || $DEFAULT_STATUS_CALLBACK;
     
     my @dirs = ref $dirs eq 'ARRAY' ? @$dirs : ($dirs);
@@ -126,10 +132,10 @@
         if (@$records == 0) {
             $insert_sth->execute(map { $mp3->{$$_[0]} } @COLUMNS);
-            print STDERR "A $$mp3{FILENAME}\n";
+            $status_callback->(A => $$mp3{FILENAME});
             $count++;
         } elsif ($mp3->{mtime} > $$records[0][0]) {
             # the mp3 file is newer than its record
             $update_sth->execute((map { $mp3->{$$_[0]} } @COLUMNS), $mp3->{FILENAME});
-            print STDERR "U $$mp3{FILENAME}\n";
+            $status_callback->(U => $$mp3{FILENAME});
             $count++;
         }
@@ -140,4 +146,5 @@
     foreach ($mtime_sth, $insert_sth, $update_sth) {
         $_->{RaiseError} = 0;  # don't die on error
+        $_->{PrintError} = 0;  # ...and don't even say anything
         $_->{Active} = 1;
         $_->finish;
@@ -150,5 +157,7 @@
     my $self = shift;
     my $db_file = shift or croak "Need the name of the databse to sync";
-    
+
+    my $status_callback = $self->{status_callback} || $DEFAULT_STATUS_CALLBACK;
+
     my $dbh = DBI->connect("dbi:SQLite:dbname=$db_file", '', '', {RaiseError => 1});
     my $select_sth = $dbh->prepare('SELECT FILENAME FROM mp3');
@@ -162,5 +171,5 @@
         unless (-e $filename) {
             $delete_sth->execute($filename);
-            print STDERR "D $filename\n";
+            $status_callback->(D => $filename);
             $count++;
         }
