AnyData
view release on metacpan or search on metacpan
lib/AnyData/Format/Mp3.pm view on Meta::CPAN
######################################################################
package AnyData::Format::Mp3;
######################################################################
#
# copyright 2000 by Jeff Zucker <jeff@vpservices.com>
# all rights reserved
#
######################################################################
=head1 NAME
AnyData::Format::Mp3 - tied hash and DBI access to Mp3 files
=head1 SYNOPSIS
use AnyData;
my $playlist = adTie( 'Passwd', ['c:/My Music/'] );
while (my $song = each %$playlist){
print $song->{artist} if $song->{genre} eq 'Reggae'
}
OR
use DBI
my $dbh = DBI->connect('dbi:AnyData:');
$dbh->func('playlist','Mp3,['c:/My Music'],'ad_catalog');
my $playlist = $dbh->selectall_arrayref( qq{
SELECT artist, title FROM playlist WHERE genre = 'Reggae'
});
# ... other DBI/SQL operations
=head1 DESCRIPTION
This module provides a tied hash interface and a DBI/SQL interface to MP files. It creates an in-memory database or hash from the Mp3 files themselves without actually creating a separate database file. This means that the database is automatically...
Many mp3 (mpeg three) music files contain a header describing the song
name, artist, and other information about the music.
Simply choose 'Mp3' as the format and give a reference to an array of directories containing mp3 files. Each file in those directories will become a record containing the fields:
song
artist
album
year
genre
filename
filesize
This module is a submodule of the AnyData.pm and DBD::AnyData.pm modules. Refer to their documentation for further details.
=head1 AUTHOR & COPYRIGHT
copyright 2000, Jeff Zucker <jeff@vpservices.com>
all rights reserved
=cut
use strict;
use warnings;
use AnyData::Format::Base;
use AnyData::Storage::FileSys;
use AnyData::Storage::File;
use vars qw( @ISA $VERSION);
@AnyData::Format::Mp3::ISA = qw( AnyData::Format::Base );
$VERSION = '0.12';
sub new {
my $class = shift;
my $self = shift || {};
#use Data::Dumper; die Dumper $self;
my $dirs = $self->{dirs} || $self->{file_name} || $self->{recs};
$self->{col_names} = 'song,artist,album,year,genre,filename,filesize';
$self->{recs} =
$self->{records} = get_data( $dirs );
return bless $self, $class;
}
sub storage_type { 'RAM'; }
sub read_fields {
my $self = shift;
my $thing = shift;
return @$thing if ref $thing eq 'ARRAY';
return split ',', $thing;
}
sub write_fields { die "WRITING NOT IMPLEMENTED FOR FORMAT Mp3"; }
sub get_data {
my $dirs = shift;
my $table = [];
my @files = AnyData::Storage::FileSys::get_filename_parts(
{},
part => 'ext',
( run in 0.641 second using v1.01-cache-2.11-cpan-39bf76dae61 )