Changeset 3 in mp3-find
- Timestamp:
- 01/30/06 02:05:25 (19 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Changes
r1 r3 1 1 Revision history for Perl extension MP3::Find. 2 2 3 0.01 Sun Jan 22 20:07:17 2006 4 - original version; created by h2xs 1.23 with options 5 -XAn MP3::Find 6 3 0.01 29 Jan 2006 4 - first CPAN release -
trunk/MANIFEST
r1 r3 5 5 t/MP3-Find.t 6 6 lib/MP3/Find.pm 7 lib/MP3/Find/Base.pm 8 lib/MP3/Find/Filesystem.pm 9 lib/MP3/Find/DB.pm 10 lib/MP3/Find/Util.pm 7 11 bin/mp3find 12 bin/mp3db 13 META.yml Module meta-data (added by MakeMaker) -
trunk/Makefile.PL
r1 r3 10 10 'Scalar::Util' => 0, 11 11 }, 12 EXE_FILES => [qw( 13 bin/mp3find 14 )], 12 15 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 13 16 (ABSTRACT_FROM => 'lib/MP3/Find.pm', # retrieve abstract from module -
trunk/bin/mp3find
r1 r3 60 60 =over 61 61 62 =item C<-i >62 =item C<-ignore-case>, C<-i> 63 63 64 64 Case insensitive matching. 65 65 66 =item C<- w>66 =item C<-exact-match>, C<-w> 67 67 68 Match only whole words. 68 All search patterns must match the entire value, and not just a 69 substring. This has the same effect as putting a C<^> and C<$> 70 around each pattern. 69 71 70 72 =item C<-sort> … … 92 94 instead. 93 95 94 =item C<< <-field> <pattern>>>96 =item C<< -<field> <pattern> [patterns...] >> 95 97 96 The fields you are searching on. These are and-ed together. For the list 97 of recognized fields, see L<MP3::Find>. 98 The fields you are searching on. More than one pattern for a given field 99 are combined with 'OR', while the fields to be matched are 'AND'-ed together. 100 For the list of recognized fields, see L<MP3::Find>. 98 101 99 102 =back … … 103 106 Peter Eichman <peichman@cpan.org> 104 107 108 =head1 COPYRIGHT AND LICENSE 109 110 Copyright (c) 2006 by Peter Eichman. All rights reserved. 111 112 This program is free software; you can redistribute it and/or 113 modify it under the same terms as Perl itself. 114 105 115 =cut -
trunk/lib/MP3/Find.pm
r1 r3 37 37 =head1 SYNOPSIS 38 38 39 use MP3Find; 39 # select with backend you want 40 use MP3::Find qw(Filesystem); 40 41 41 42 print "$_\n" foreach find_mp3s( … … 59 60 or the actual Perl data structure representing the results. 60 61 62 There are currently two backends to this module: L<MP3::Find::Filesystem> 63 and L<MP3::Find::DB>. You choose which one you want by passing its 64 name as the argument to you C<use> statement; B<MP3::Find> will look for 65 a B<MP3::Find::$BACKEND> module. If no backend name is given, it will 66 default to using L<MP3::Find::Filesystem>. 67 68 B<Note:> I'm still working out some kinks in the DB backend, so it 69 is currently not as stable as the Filesystem backend. 70 61 71 =head1 REQUIRES 62 72 63 L<File::Find>, L<MP3::Info>, L<Scalar::Util> 73 L<File::Find>, L<MP3::Info>, and L<Scalar::Util> are needed for 74 the filesystem backend (L<MP3::Find::Filesystem>). 64 75 65 L<DBI> and L<DBD::SQLite> are needed if you want to have a66 database backend .76 L<DBI>, L<DBD::SQLite>, and L<SQL::Abstract> are needed for the 77 database backend (L<MP3::Find::DB>). 67 78 68 79 =head1 EXPORTS … … 95 106 =item C<exact_match> 96 107 97 Adds an implicit C<^> and C<$> around each query string. 108 Adds an implicit C<^> and C<$> around each query string. Does nothing 109 if the query is already a regular expression. 98 110 99 111 =item C<sort> … … 101 113 What field or fields to sort the results by. Can either be a single 102 114 scalar field name to sort by, or an arrayref of field names. Again, 103 acceptable field names are anything that L<MP3::Info> knows about. 115 acceptable field names are anything that L<MP3::Info> knows about; 116 field names will be converted to upper case as with the C<query> 117 option. 104 118 105 119 =item C<printf> … … 144 158 =back 145 159 160 =head1 BUGS 161 162 There are probably some in there; let me know if you find any (patches 163 welcome). 164 146 165 =head1 TODO 147 166 148 More of a structured query would be nice; currently everything 149 is and-ed together, and it would be nice to be able to put query 150 keys together with a mixture of and and or. 167 Better tests, using some actual sample mp3 files. 151 168 152 Searching a big directory is slo-o-ow! Investigate some sort of 153 caching of results? 154 155 The current sorting function is also probably quite inefficient. 169 Other backends (a caching filesystem backend, perhaps?) 156 170 157 171 =head1 SEE ALSO 172 173 L<MP3::Find::Filesystem>, L<MP3::Find::DB> 174 175 L<mp3find> is the command line frontend to this module (it 176 currently only uses the filesystem backend). 158 177 159 178 See L<MP3::Info> for more information about the fields you can -
trunk/lib/MP3/Find/DB.pm
r1 r3 47 47 # module return 48 48 1; 49 50 =head1 NAME 51 52 MP3::Find::DB - SQLite database backend to MP3::Find 53 54 =head1 SYNOPSIS 55 56 use MP3::Find::DB; 57 my $finder = MP3::Find::DB->new; 58 59 my @mp3s = $finder->find_mp3s( 60 dir => '/home/peter/music', 61 query => { 62 artist => 'ilyaimy', 63 album => 'myxomatosis', 64 }, 65 ignore_case => 1, 66 ); 67 68 =head1 REQUIRES 69 70 L<DBI>, L<DBD::SQLite>, L<SQL::Abstract> 71 72 =head1 DESCRIPTION 73 74 This is the SQLite database backend for L<MP3::Find>. 75 76 B<Note:> I'm still working out some kinks in here, so this backend 77 is currently not as stable as the Filesystem backend. 78 79 =head2 Special Options 80 81 =over 82 83 =item C<db_file> 84 85 The name of the SQLite database file to use. Defaults to F<~/mp3.db>. 86 87 The database should have at least one table named C<mp3> with the 88 following schema: 89 90 CREATE TABLE mp3 ( 91 mtime INTEGER, 92 FILENAME TEXT, 93 TITLE TEXT, 94 ARTIST TEXT, 95 ALBUM TEXT, 96 YEAR INTEGER, 97 COMMENT TEXT, 98 GENRE TEXT, 99 TRACKNUM INTEGER, 100 VERSION NUMERIC, 101 LAYER INTEGER, 102 STEREO TEXT, 103 VBR TEXT, 104 BITRATE INTEGER, 105 FREQUENCY INTEGER, 106 SIZE INTEGER, 107 OFFSET INTEGER, 108 SECS INTEGER, 109 MM INTEGER, 110 SS INTEGER, 111 MS INTEGER, 112 TIME TEXT, 113 COPYRIGHT TEXT, 114 PADDING INTEGER, 115 MODE INTEGER, 116 FRAMES INTEGER, 117 FRAME_LENGTH INTEGER, 118 VBR_SCALE INTEGER 119 ); 120 121 =back 122 123 =head1 TODO 124 125 Move the database/table creation code from F<mp3db> into this 126 module. 127 128 Database maintanence routines (e.g. clear out old entries) 129 130 =head1 SEE ALSO 131 132 L<MP3::Find>, L<MP3::Find::DB> 133 134 =head1 AUTHOR 135 136 Peter Eichman <peichman@cpan.org> 137 138 =head1 COPYRIGHT AND LICENSE 139 140 Copyright (c) 2006 by Peter Eichman. All rights reserved. 141 142 This program is free software; you can redistribute it and/or 143 modify it under the same terms as Perl itself. 144 145 =cut -
trunk/lib/MP3/Find/Filesystem.pm
r1 r3 73 73 # module return 74 74 1; 75 76 =head1 NAME 77 78 MP3::Find::Filesystem - File::Find-based backend to MP3::Find 79 80 =head1 SYNOPSIS 81 82 use MP3::Find::Filesystem; 83 my $finder = MP3::Find::Filesystem->new; 84 85 my @mp3s = $finder->find_mp3s( 86 dir => '/home/peter/music', 87 query => { 88 artist => 'ilyaimy', 89 album => 'myxomatosis', 90 }, 91 ignore_case => 1, 92 ); 93 94 =head1 REQUIRES 95 96 L<File::Find>, L<MP3::Info>, L<Scalar::Util> 97 98 =head1 DESCRIPTION 99 100 This module implements the C<search> method from L<MP3::Find::Base> 101 using a L<File::Find> based search of the local filesystem. 102 103 =head2 Special Options 104 105 There are no special options for B<MP3::Find::Filesystem>. See 106 L<MP3::Find> for the description of the general options. 107 108 =head1 SEE ALSO 109 110 L<MP3::Find>, L<MP3::Find::DB> 111 112 =head1 AUTHOR 113 114 Peter Eichman <peichman@cpan.org> 115 116 =head1 COPYRIGHT AND LICENSE 117 118 Copyright (c) 2006 by Peter Eichman. All rights reserved. 119 120 This program is free software; you can redistribute it and/or 121 modify it under the same terms as Perl itself. 122 123 =cut
Note: See TracChangeset
for help on using the changeset viewer.