Index: /trunk/Changes
===================================================================
--- /trunk/Changes	(revision 11)
+++ /trunk/Changes	(revision 12)
@@ -1,6 +1,6 @@
 Revision history for Perl extension MP3::Find.
 
-0.01  29 Jan 2006
-    - first CPAN release
+0.03
+    - added "exclude_path" option to filesystem backend
 
 0.02  1 Feb 2006
@@ -9,2 +9,5 @@
     - DB management functions are now in the DB backend
     - rewrote (and documented) mp3db to use the new DB backend functions
+
+0.01  29 Jan 2006
+    - first CPAN release
Index: /trunk/lib/MP3/Find/DB.pm
===================================================================
--- /trunk/lib/MP3/Find/DB.pm	(revision 11)
+++ /trunk/lib/MP3/Find/DB.pm	(revision 12)
@@ -123,4 +123,5 @@
         warn "Multiple records for $$mp3{FILENAME}\n" if @$records > 1;
         
+        #TODO: maybe print status updates somewhere else?
         if (@$records == 0) {
             $insert_sth->execute(map { $mp3->{$$_[0]} } @COLUMNS);
@@ -138,4 +139,5 @@
     # (see http://rt.cpan.org/Ticket/Display.html?id=9643#txn-120724)
     foreach ($mtime_sth, $insert_sth, $update_sth) {
+        $_->{RaiseError} = 0;  # don't die on error
         $_->{Active} = 1;
         $_->finish;
Index: /trunk/lib/MP3/Find/Filesystem.pm
===================================================================
--- /trunk/lib/MP3/Find/Filesystem.pm	(revision 11)
+++ /trunk/lib/MP3/Find/Filesystem.pm	(revision 12)
@@ -30,7 +30,17 @@
     }
     
+    if ($$options{exclude_path}) {
+        my $ref = ref $$options{exclude_path};
+        if ($ref eq 'ARRAY') {
+            $$options{exclude_path} = '(' . join('|', @{ $$options{exclude_path} }) . ')';
+        }
+        unless ($ref eq 'Regexp') {
+            $$options{exclude_path} = qr[$$options{exclude_path}];
+        }
+    }
+    
     # run the actual find
     my @results;
-    find(sub { match_mp3($File::Find::name, $query, \@results) }, $_) foreach @$dirs;
+    find(sub { match_mp3($File::Find::name, $query, \@results, $options) }, $_) foreach @$dirs;
     
     # sort the results
@@ -54,7 +64,11 @@
 
 sub match_mp3 {
-    my ($filename, $query, $results) = @_;
+    my ($filename, $query, $results, $options) = @_;
     
     return unless $filename =~ m{[^/]\.mp3$};
+    if ($$options{exclude_path}) {
+        return if $filename =~ $$options{exclude_path};
+    }
+    
     my $mp3 = {
         FILENAME => $filename,
@@ -103,6 +117,10 @@
 =head2 Special Options
 
-There are no special options for B<MP3::Find::Filesystem>. See
-L<MP3::Find> for the description of the general options.
+=over
+
+=item C<exclude_path>
+
+Scalar or arrayref; any file whose name matches any of these paths
+will be skipped.
 
 =head1 SEE ALSO
Index: /trunk/t/02-filesystem.t
===================================================================
--- /trunk/t/02-filesystem.t	(revision 11)
+++ /trunk/t/02-filesystem.t	(revision 12)
@@ -2,9 +2,11 @@
 use strict;
 
-use Test::More 'no_plan'; #tests => 4;
+use Test::More tests => 6;
 BEGIN { use_ok('MP3::Find::Filesystem') };
 
 my $SEARCH_DIR = 't/mp3s';
-my $MP3_COUNT = 0;
+my $EXCLUDE_DIR = 't/mp3s/dont_look_here';
+my $MP3_COUNT = 1;
+my $EXCLUDED_MP3_COUNT = 1;
 
 # exercise the object
@@ -20,3 +22,10 @@
 is(scalar(@res), $MP3_COUNT, 'dir as ARRAY ref');
 
+# exclude
+@res = $finder->find_mp3s(dir => $SEARCH_DIR, exclude_path => $EXCLUDE_DIR);
+is(scalar(@res), $MP3_COUNT - $EXCLUDED_MP3_COUNT, 'excluded directory');
+
+@res = $finder->find_mp3s(dir => $SEARCH_DIR, exclude_path => [$EXCLUDE_DIR]);
+is(scalar(@res), $MP3_COUNT - $EXCLUDED_MP3_COUNT, 'excluded directory as array');
+
 #TODO: get some test mp3s
Index: /trunk/t/03-db.t
===================================================================
--- /trunk/t/03-db.t	(revision 11)
+++ /trunk/t/03-db.t	(revision 12)
@@ -19,5 +19,5 @@
 my $SEARCH_DIR = 't/mp3s';
 my $DB_FILE = 't/mp3.db';
-my $MP3_COUNT = 0;
+my $MP3_COUNT = 1;
 
 # exercise the object
