Changeset 40 in mp3-find for trunk/lib/MP3/Find/Filesystem.pm


Ignore:
Timestamp:
06/07/11 23:10:52 (13 years ago)
Author:
peter
Message:

Reversed accidental commit of extra changes in r39

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/MP3/Find/Filesystem.pm

    r39 r40  
    1212use MP3::Find::Util qw(get_mp3_metadata); 
    1313 
    14 # XXX: this may or may not lead to faster searches 
    1514eval { 
    1615    require Sort::Key; 
     
    1918}; 
    2019my $USE_SORT_KEY = $@ ? 0 : 1; 
     20 
     21 
     22eval { require MP3::Tag }; 
     23my $CAN_USE_ID3V2 = $@ ? 0 : 1; 
    2124 
    2225use_winamp_genres(); 
     
    4952        } 
    5053    } 
    51  
     54     
     55    if ($$options{use_id3v2} and not $CAN_USE_ID3V2) { 
     56        # they want to use ID3v2, but don't have MP3::Tag 
     57        warn "MP3::Tag is required to search ID3v2 tags\n"; 
     58    } 
     59         
    5260    # run the actual find 
    5361    my @results; 
     
    94102    my $mp3 = get_mp3_metadata({ 
    95103        filename  => $filename, 
     104        use_id3v2 => $options->{use_id3v2}, 
    96105    }); 
    97106 
     
    130139L<File::Find>, L<MP3::Info>, L<Scalar::Util> 
    131140 
     141L<MP3::Tag> is also needed if you want to search using ID3v2 tags. 
     142 
    132143=head1 DESCRIPTION 
    133144 
    134145This module implements the C<search> method from L<MP3::Find::Base> 
    135146using a L<File::Find> based search of the local filesystem. 
    136  
    137 In addition to just the basic ID3v1 tags, you can search for files by their 
    138 ID3v2 data, using the four-character frame names.  This isn't very useful if 
    139 you are just search by artist or title, but if, for example, you have made use 
    140 of the C<TOPE> ("Orignal Performer") frame, you could search for all the cover 
    141 songs in your collection: 
    142  
    143     $finder->find_mp3s(query => { tope => '.' }); 
    144  
    145 As with the basic query keys, ID3v2 query keys are converted to uppercase 
    146 internally. 
    147147 
    148148=head2 Special Options 
     
    152152=item C<exclude_path> 
    153153 
    154 Scalar or arrayref; any file whose name matches any of these paths will be 
    155 skipped. 
     154Scalar or arrayref; any file whose name matches any of these paths 
     155will be skipped. 
     156 
     157=item C<use_id3v2> 
     158 
     159Boolean, defaults to false. If set to true, MP3::Find::Filesystem will 
     160use L<MP3::Tag> to get the ID3v2 tag for each file. You can then search 
     161for files by their ID3v2 data, using the four-character frame names.  
     162This isn't very useful if you are just search by artist or title, but if, 
     163for example, you have made use of the C<TOPE> ("Orignal Performer") frame, 
     164you could search for all the cover songs in your collection: 
     165 
     166    $finder->find_mp3s(query => { tope => '.' }); 
     167 
     168As with the basic query keys, ID3v2 query keys are converted to uppercase 
     169internally. 
    156170 
    157171=back 
     
    167181=head1 COPYRIGHT AND LICENSE 
    168182 
    169 Copyright (c) 2006-2008 by Peter Eichman. All rights reserved. 
     183Copyright (c) 2006 by Peter Eichman. All rights reserved. 
    170184 
    171185This program is free software; you can redistribute it and/or 
Note: See TracChangeset for help on using the changeset viewer.