Audio-M4P
view release on metacpan or search on metacpan
lib/Audio/M4P/QuickTime.pm view on Meta::CPAN
The following tag names are supported by this method:
album
artist
comment
genre ( the integer value genre )
title
track
total
=back
=head2 Other Audio::TagLib syntactic compatibility
=over 4
=item The following 'set' methods are equivalent to methods above used with an argument. They are included in this module for Audio::TagLib compatibility:
=item Method equivalent to
=item ------------------------
=item setAlbum album
=item setArtist artist
=item setTitle title
=item setComment comment
=item setGenre genre
=item setTrack track
=item setTracks tracks
=item setTotal total tracks
=back
=head2 Apple m4a personal data removal function
=over 4
=item B<CleanAppleM4aPersonalData>
my $file_name = "mp4aIDfile.m4a";
my $qt = Audio::M4P::QuickTime->new(file => $file_name);
$qt->CleanAppleM4aPersonalData();
$qt->WriteFile('cleaned' . $file_name);
...OR...
#!/usr/bin/perl
use Tk;
use Cwd;
use strict;
use warnings;
use Audio::M4P::QuickTime;
my $backup_requested = "yes";
my $win = new MainWindow;
my $frm = $win->Frame()->pack;
$frm->Label(
-text => "Anonymize Apple iTunes Plus .m4a Files",
-font => "Garamond 20 bold",
)->pack;
my $do_backup_choice = $frm->Radiobutton(
-text => "Back Up (append .old.m4a to old files)",
-value => 'yes',
-variable => \$backup_requested,
-font => "Garamond 14 bold",
)->pack;
my $do_no_backup_choice = $frm->Radiobutton(
-text => "Do Not Back Up (files will be over-written!)",
-value => 'no',
-variable => \$backup_requested,
-font => "Garamond 14 bold",
)->pack;
my $convert_button = $win->Button(
-text => "Convert Files",
-command => \&push_button,
-font => "Garamond 17 bold",
)->pack;
my $exit_button = $win->Button(
-text => "Exit",
-command => sub { exit 0 },
-font => "Garamond 17 bold",
)->pack;
MainLoop;
sub push_button {
my $write_extension = $backup_requested eq 'no' ? '' : '.old.m4a';
my @file_list = $win->getOpenFile(
-defaultextension => ".pl",
-filetypes => [ [ 'MP4a files', '.m4a', ], [ 'All Files', '*', ], ],
-initialdir => Cwd::cwd(),
-initialfile => "getopenfile",
-title => "Choose Purchased Apple iTunes Plus Files to Anonymize",
-multiple => 1,
);
foreach my $filename (@file_list) {
my $qt = Audio::M4P::QuickTime->new( file => $filename );
if ( $qt->FindAtom("mp4a") ) {
$qt->CleanAppleM4aPersonalData();
rename( $filename, $filename . $write_extension );
$qt->WriteFile($filename);
}
else {
$win->messageBox(
-message => "Error: $filename is not a valid m4a file.",
-type => 'ok',
-icon => 'error'
);
}
}
}
Remove personal identifiers from Apple's iTMS .m4a format files.
Note: to prevent inadvertent alteration of non-Apple .m4a files, the function
requires a m4a atom to be part of the file unless the "force" argument is used, eg.
$qt->CleanAppleM4aPersonalData( force => 1, zero_free_atoms => 1 );
Here, the zero_free_atoms => 1 named argument forces all data in free atoms
to be nulled out as well.
=back
=head2 Class Internal Methods and Functions
=over 4
=item AtomList
=item AtomTree
=item ConvertDrmsToMp4a
=item DeleteAtom
=item DeleteAtomWithStcoFix
=item DumpTree
=item FindAtom
=item FindAtomData
( run in 0.952 second using v1.01-cache-2.11-cpan-524268b4103 )