| AudioFile-Info-Ogg-Vorbis-Header documentation | Contained in the AudioFile-Info-Ogg-Vorbis-Header distribution. |
AudioFile::Info::Ogg::Vorbis::Header - Perl extension to get info from Ogg Vorbis files.
Extracts data from an Ogg Vorbis file using the CPAN module Ogg::Vorbis::Header.
See AudioFile::Info for more details.
Creates a new object of class AudioFile::Info::Ogg::Vorbis::Header. Usually called by AudioFile::Info::new.
Dave Cross, <dave@dave.org.uk>
Copyright 2003 by Dave Cross
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| AudioFile-Info-Ogg-Vorbis-Header documentation | Contained in the AudioFile-Info-Ogg-Vorbis-Header distribution. |
# # $Id: Header.pm 22 2008-04-20 07:33:23Z dave $ #
package AudioFile::Info::Ogg::Vorbis::Header; use 5.006; use strict; use warnings; use Carp; use Ogg::Vorbis::Header; # nasty Inline kludge # needed as this module is never "used", only "required" require Inline; Inline->init; our $VERSION = sprintf "%d", '$Revision: 22 $ ' =~ /(\d+)/; my %data = (artist => 'ARTIST', title => 'TITLE', album => 'ALBUM', track => 'TRACKNUMBER', year => 'DATE', genre => 'GENRE'); sub new { my $class = shift; my $file = shift; my $obj = Ogg::Vorbis::Header->new($file); bless { obj => $obj }, $class; } sub DESTROY {} sub AUTOLOAD { our $AUTOLOAD; my ($pkg, $sub) = $AUTOLOAD =~ /(.*)::(\w+)/; croak "Invalid attribute '$sub'" unless $data{$sub}; if ($_[1]) { if (grep { $_ eq $data{$sub} } $_[0]->{obj}->comment_tags) { $_[0]->{obj}->edit_comment($data{$sub}, $_[1]); } else { $_[0]->{obj}->add_comments($data{$sub}, $_[1]); } $_[0]->{obj}->write_vorbis; } return ($_[0]->{obj}->comment($data{$sub}))[0]; } 1; __END__