Audio-M4P

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.21 Sun 5 Feb 2006
    - changed pod doc formatting
    - added support to adding tag meta data to video files without meta data atom

0.20 Sat 4 Feb 2006
    - bug fixes for handling video files with chapters or variant data sections
    - more tests

0.19 Sat Jan 28 2006
    - additions to hashes for  MP4::Info compatibility
    - additional functions for MP3::Tag compatibility
    
0.18 Mon Jan 23 2006
    - fixed genre setting logic
    
0.16 Thu Sep 1 2005
    - some code syntax and spacing cleanup

0.15 Thu July 28 2005
    - changed cover artwork meta data additions to follow iTunes usage
    

lib/Audio/M4P/QuickTime.pm  view on Meta::CPAN

        $self->FixStco( -8, $ilst->start );
        return unless $covr = $self->FindAtom('covr');
    }
	$covr->insertNew( 'data', pack( 'NN', $type, 0 ) . $art );
	$self->FixStco( -16 - length $art, $covr->start );
	return 1;
}

#-----------------------------------------------------------

# MP3::Tag analogs, but more fields, and allow setting of tags

sub autoinfo {
    my ($self) = @_;
    my $tags = $self->GetMetaInfo;
    return (
        $tags->{TITLE},   $tags->{TRKN}, $tags->{ARTIST}, $tags->{ALBUM},
        $tags->{COMMENT}, $tags->{YEAR}, $tags->{GENRE}
    );
}

lib/Audio/M4P/QuickTime.pm  view on Meta::CPAN

Get or set a meta information field via a hash reference to an Apple iTMS
type dict data structure. Possible fields are copyright, comments, 
songName, genre, playlistArtistName, genreID, composerName, playlistName,
year, trackNumber, trackCount, discNumber, discCount, and artworkURL. iTMS 
meta data entries may not be compatible with MP3::Info type meta data. An
optional second argument, if true, prevents the method from replacing old meta
information, as in $qt->iTMS_MetaInfo($hashref, 1);

Note that although this method of manipulating M4P data tags is closest to the 
way iTMS and iTunes do metadata, it may be less intuitive for most audio tag 
programmers than the MP3::Tag and Audio::TagLib compatible methods below.

=item B<GetCoverArt>

  my $artwork = $qt->GetCoverArt();
  foreach my $pic (@{$artwork}) { 
      # do stuff with art
  }
  
Returns a reference to an array of cover artwork. Note: the artwork routines
were suggested and largely contributed by pucklock. (Thanks!)

lib/Audio/M4P/QuickTime.pm  view on Meta::CPAN


The method adds a single album cover by either adding one covr atom or 
by adding one cover's data to an existing covr atom. Takes a argument which 
should be a compatible graphic format binary, but does NO checks for 
compatibility with iTunes' cover art display. The type should be 13 
for jpeg, 14 for png graphics format, but defaults to 13.


=back

=head2 MP3::Tag and Audio::TagLib Compatible Functions

=over 4

=item B<autoinfo>

  my($title, $tracknum, $artist, $album, $comment, $year, $genre) =
    $qt->autoinfo;

Returns an array of tag metadata, similar to the same method in MP3::Tag.

=item B<album>

  my $album = $qt->album;
  $new_album = "My New Album Name";
  $qt->album($new_album);

Get and set title tag data.
Similar to the same method in MP3::TagLib.

Note this and other tag functions below will usually return the empty 
string "" when there is tag data lacking, unless an integer result is expected, 
in which case 0 is returned. This is for compatibility with MP3::Tag and 
Audio::TagLib's implementation of these methods.

=item B<artist>

  my $artist = $qt->artist;
  $new_artist = "My New Artist";
  $qt->artist($new_artist);

Get and set artist tag data.
Similar to the same method in MP3::TagLib.

=item B<comment>

  my $comment = $qt->comment;
  $new_comment = "My Comment Goes Here";
  $qt->comment($new_comment);

Get and set comment tag data.
Similar to the same method in MP3::Tag.

=item B<genre>

  my $genre = $qt->genre;
  $new_genre = 18;
  $qt->genre($new_genre);

Get and set genre tag data BY NUMBER.

=item B<genre_as_text>

lib/Audio/M4P/QuickTime.pm  view on Meta::CPAN

code, which can be imported by the declaration "our @genre_strings;" 
in code using the module.

=item B<title>

  my $title = $qt->title;
  $new_title = "My New One";
  $qt->title($new_title);

Get and set title tag data.
Similar to the same method in MP3::Tag.

=item B<track>

  my $track = $qt->track;
  my $new_track = 3;
  $qt->track($new_track);

Get or set the track number.

=item B<tracks>

  my ($track, $count) = $qt->tracks;
  my $new_track_number = 3;
  my $total_tracks_on_CD = 17;
  $qt->tracks($new_track_number, $total_tracks_on_CD);

Get or set both the track number and the total tracks on the originating media 
work. Not actually an MP3::Tag method, but MP4 files, unlike many MP3 files, 
regularly contain both track number and the total originating CD's track count.

=item B<total>

  my $total = $qt->total;
  my $new_total = 15;
  $qt->total($new_total);

Get or set the track total number.

=item B<year>

  my $year = $qt->year;
  $new_year = "My New One";
  $qt->year($new_year);

Get and set year tag data.
Similar to the same method in MP3::Tag.

=item B<all_tags>

  my $tref = $qt->all_tags( album => "My new album", genre => 21 );
  print $tref->{artist};

Similar to the Audio::File::Tag B<all> method. Set or get all the above tags. 
To set the tags pass a hash reference with the names of the tags as keys and 
the tag values as hash values. Returns a hash reference if no argument is 
specified.

lib/Audio/M4P/QuickTime.pm  view on Meta::CPAN

=item L<Audio::M4P>, L<Audio::M4P::Atom>

=back    

=head1 SEE ALSO

=over 4

=item L<LWP::UserAgent::iTMS_Client>, L<iTunes::Sid>

=item L<MP3::Info>, L<MP4::Info>, L<MP3::Tag>, L<Audio::TagLib>, L<Audio::File::Tag>, L<Mac::iTunes>, L<Net::iTMS>, L<LWP::UserAgent::iTMS_Client>

=back

=head1 AUTHOR 

=over 4

William Herrera B<wherrera@skylightview.com>. 

=back

t/03_test.t  view on Meta::CPAN

# t/03_test.t - check metadat MP3::Tag compatibility methods & variant MP4 files

use strict;
use warnings;

use Test::More tests => 13;

BEGIN { use_ok('Audio::M4P::Decrypt'); }

my $object = new Audio::M4P::Decrypt;
isa_ok( $object, 'Audio::M4P::Decrypt' );



( run in 0.736 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )