Changeset 29 in mp3-find for trunk/bin


Ignore:
Timestamp:
05/21/06 05:17:23 (19 years ago)
Author:
peter
Message:
  • factored out 'get_mp3_metadata' function from Filesystem.pm to Util.pm
  • added 'update' function to DB.pm that combines 'update_db' and 'update_file' (for updating just specific files); idea courtesy of Matt Dietrich
  • modified mp3db to let you mix and match files and directories on the command line; now also uses the 'update' function in DB.pm
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/mp3db

    r23 r29  
    1313$DB_FILE ||= catfile($ENV{HOME}, 'mp3.db'); 
    1414 
    15 my @DIRS = @ARGV; 
     15my @NAMES = @ARGV; 
    1616 
    1717my $f = MP3::Find::DB->new; 
    1818$f->create_db($DB_FILE) if $CREATE; 
    19 $f->update_db($DB_FILE, \@DIRS) if @DIRS; 
     19 
     20if (@NAMES) { 
     21    my @files = grep { -f } @NAMES; 
     22    my @dirs  = grep { -d } @NAMES; 
     23 
     24    $f->update({ 
     25        dsn   => "dbi:SQLite:dbname=$DB_FILE", 
     26        dirs  => \@dirs, 
     27        files => \@files, 
     28    }); 
     29} 
    2030 
    2131=head1 NAME 
Note: See TracChangeset for help on using the changeset viewer.