import 0.0.0
This commit is contained in:
parent
77c82feac8
commit
8ee1628ee5
|
@ -0,0 +1,6 @@
|
||||||
|
Revision history for MP3-Tag-Utils
|
||||||
|
|
||||||
|
0.0.0 2010-08-19/17:00
|
||||||
|
-Initial release.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
Changes
|
||||||
|
MANIFEST
|
||||||
|
Makefile.PL
|
||||||
|
README
|
||||||
|
lib/MP3/Tag/Utils.pm
|
||||||
|
t/00-load.t
|
||||||
|
t/manifest.t
|
||||||
|
t/pod-coverage.t
|
||||||
|
t/pod.t
|
|
@ -0,0 +1,22 @@
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use ExtUtils::MakeMaker;
|
||||||
|
|
||||||
|
WriteMakefile(
|
||||||
|
NAME => 'MP3::Tag::Utils',
|
||||||
|
AUTHOR => q{Zane C. Bowers <vvelox@vvelox.net>},
|
||||||
|
VERSION_FROM => 'lib/MP3/Tag/Utils.pm',
|
||||||
|
ABSTRACT_FROM => 'lib/MP3/Tag/Utils.pm',
|
||||||
|
($ExtUtils::MakeMaker::VERSION >= 6.3002
|
||||||
|
? ('LICENSE'=> 'perl')
|
||||||
|
: ()),
|
||||||
|
PL_FILES => {},
|
||||||
|
INST_SCRIPT => 'bin',
|
||||||
|
PREREQ_PM => {
|
||||||
|
'Test::More' => 0,
|
||||||
|
'MP3::Tag'=>0,
|
||||||
|
'Text::NeatTemplate'=>0,
|
||||||
|
},
|
||||||
|
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
|
||||||
|
clean => { FILES => 'MP3-Tag-Utils-*' },
|
||||||
|
);
|
|
@ -0,0 +1,46 @@
|
||||||
|
MP3-Tag-Utils
|
||||||
|
|
||||||
|
Some assorted useful utilities for using MP3::Tag.
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLATION
|
||||||
|
|
||||||
|
To install this module, run the following commands:
|
||||||
|
|
||||||
|
perl Makefile.PL
|
||||||
|
make
|
||||||
|
make test
|
||||||
|
make install
|
||||||
|
|
||||||
|
SUPPORT AND DOCUMENTATION
|
||||||
|
|
||||||
|
After installing, you can find documentation for this module with the
|
||||||
|
perldoc command.
|
||||||
|
|
||||||
|
perldoc MP3::Tag::Utils
|
||||||
|
|
||||||
|
You can also look for information at:
|
||||||
|
|
||||||
|
RT, CPAN's request tracker
|
||||||
|
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MP3-Tag-Utils
|
||||||
|
|
||||||
|
AnnoCPAN, Annotated CPAN documentation
|
||||||
|
http://annocpan.org/dist/MP3-Tag-Utils
|
||||||
|
|
||||||
|
CPAN Ratings
|
||||||
|
http://cpanratings.perl.org/d/MP3-Tag-Utils
|
||||||
|
|
||||||
|
Search CPAN
|
||||||
|
http://search.cpan.org/dist/MP3-Tag-Utils/
|
||||||
|
|
||||||
|
|
||||||
|
LICENSE AND COPYRIGHT
|
||||||
|
|
||||||
|
Copyright (C) 2010 Zane C. Bowers
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of either: the GNU General Public License as published
|
||||||
|
by the Free Software Foundation; or the Artistic License.
|
||||||
|
|
||||||
|
See http://dev.perl.org/licenses/ for more information.
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
#Copyright (c) 2010, Zane C. Bowers
|
||||||
|
#All rights reserved.
|
||||||
|
#
|
||||||
|
#Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
#are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
#THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Getopt::Std;
|
||||||
|
use MP3::Tag::Utils;
|
||||||
|
|
||||||
|
#version function
|
||||||
|
sub main::VERSION_MESSAGE {
|
||||||
|
print "mp3rename 0.0.0\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
#print help
|
||||||
|
sub main::HELP_MESSAGE {
|
||||||
|
print "\n".
|
||||||
|
"-t <template> The template to use.\n".
|
||||||
|
"-p <pad to> The number of zeros to track should be padded out to.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
#gets the options
|
||||||
|
my %opts;
|
||||||
|
getopts('t:p:', \%opts);
|
||||||
|
|
||||||
|
#
|
||||||
|
my $mp3util=MP3::Tag::Utils->new;
|
||||||
|
|
||||||
|
my $returned=$mp3util->rename({files=>\@ARGV, template=>$opts{t}, padto=>$opts{p}});
|
||||||
|
|
||||||
|
#exit if the module errored
|
||||||
|
if ($mp3util->error) {
|
||||||
|
exit $mp3util->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
#errors if it failed
|
||||||
|
if (! $returned->{success}) {
|
||||||
|
print "Failed to rename some files...\n";
|
||||||
|
my $int=0;
|
||||||
|
while (defined( $returned->{failed}[$int] )) {
|
||||||
|
print $returned->{failed}[$int]."\n";
|
||||||
|
}
|
||||||
|
exit 254;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
mp3rename - Rename MP3 files based off of it's tags.
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
mp3rename [B<-p> <padto>] [B<-t> <template>] <mp3 files 0> [<mp3 file 1>...]
|
||||||
|
|
||||||
|
=head1 SWTICHES
|
||||||
|
|
||||||
|
=head2 -p <padto>
|
||||||
|
|
||||||
|
This is the number of zeros to pad the track number out to. By default this is 2.
|
||||||
|
|
||||||
|
=head2 -t <template>
|
||||||
|
|
||||||
|
This is the remplate to use for the new file name.
|
||||||
|
|
||||||
|
For more information on this see MP3::Tag::Utils.
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Copyright (c) 2010, Zame C. Bowers <vvelox@vvelox.net>
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
=head1 Changelog
|
||||||
|
|
||||||
|
=head2 0.0.0 - 2010-08-19/16:00
|
||||||
|
|
||||||
|
-Initial version.
|
||||||
|
|
||||||
|
=head1 SCRIPT CATEGORIES
|
||||||
|
|
||||||
|
Desktop
|
||||||
|
|
||||||
|
=head1 OSNAMES
|
||||||
|
|
||||||
|
any
|
||||||
|
|
||||||
|
=head1 README
|
||||||
|
|
||||||
|
mp3rename - Rename MP3 files based off of it's tags.
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,119 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
#Copyright (c) 2010, Zane C. Bowers
|
||||||
|
#All rights reserved.
|
||||||
|
#
|
||||||
|
#Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
#are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
#THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Getopt::Std;
|
||||||
|
use MP3::Tag::Utils;
|
||||||
|
|
||||||
|
#version function
|
||||||
|
sub main::VERSION_MESSAGE {
|
||||||
|
print "mp3show 0.0.0\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
#print help
|
||||||
|
sub main::HELP_MESSAGE {
|
||||||
|
}
|
||||||
|
|
||||||
|
#gets the options
|
||||||
|
my %opts;
|
||||||
|
getopts('', \%opts);
|
||||||
|
|
||||||
|
#
|
||||||
|
my $mp3util=MP3::Tag::Utils->new;
|
||||||
|
|
||||||
|
my $returned=$mp3util->show({files=>\@ARGV, });
|
||||||
|
|
||||||
|
#exit if the module errored
|
||||||
|
if ($mp3util->error) {
|
||||||
|
exit $mp3util->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
#errors if it failed
|
||||||
|
if (! $returned->{success}) {
|
||||||
|
print $returned->{show}."Failed to show some files...\n";
|
||||||
|
my $int=0;
|
||||||
|
while (defined( $returned->{failed}[$int] )) {
|
||||||
|
print $returned->{failed}[$int]."\n";
|
||||||
|
}
|
||||||
|
exit 254;
|
||||||
|
}
|
||||||
|
|
||||||
|
print $returned->{show};
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
mp3rename - Show tags for one or more MP3 file.
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
mp3rename <mp3 files 0> [<mp3 file 1>...]
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Copyright (c) 2010, Zame C. Bowers <vvelox@vvelox.net>
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
=head1 Changelog
|
||||||
|
|
||||||
|
=head2 0.0.0 - 2010-08-19/16:00
|
||||||
|
|
||||||
|
-Initial version.
|
||||||
|
|
||||||
|
=head1 SCRIPT CATEGORIES
|
||||||
|
|
||||||
|
Desktop
|
||||||
|
|
||||||
|
=head1 OSNAMES
|
||||||
|
|
||||||
|
any
|
||||||
|
|
||||||
|
=head1 README
|
||||||
|
|
||||||
|
mp3rename - Show tags for one or more MP3 file.
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,177 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
#Copyright (c) 2010, Zane C. Bowers
|
||||||
|
#All rights reserved.
|
||||||
|
#
|
||||||
|
#Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
#are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
#IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
#LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
#THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Getopt::Std;
|
||||||
|
use MP3::Tag::Utils;
|
||||||
|
|
||||||
|
$Getopt::Std::STANDARD_HELP_VERSION = 1;
|
||||||
|
|
||||||
|
#version function
|
||||||
|
sub main::VERSION_MESSAGE {
|
||||||
|
print "mp3tag 0.0.0\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
#print help
|
||||||
|
sub main::HELP_MESSAGE {
|
||||||
|
print "\n".
|
||||||
|
"-a <album>\n".
|
||||||
|
"-A <artist>\n".
|
||||||
|
"-c <comment>\n".
|
||||||
|
"-g <genre>\n".
|
||||||
|
"-s <song>\n".
|
||||||
|
"-S Use this flag if changing the song on more than one file.\n".
|
||||||
|
"-t <title>\n".
|
||||||
|
"-T <track>\n".
|
||||||
|
"-y <year>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
#gets the options
|
||||||
|
my %opts;
|
||||||
|
getopts('a:A:c:g:t:T:y:', \%opts);
|
||||||
|
|
||||||
|
#if more than one was specified, make sure the safety is off
|
||||||
|
if (
|
||||||
|
defined( $ARGV[1] ) &&
|
||||||
|
(!defined( $opts{S} ))
|
||||||
|
(defined($opts{t}))
|
||||||
|
) {
|
||||||
|
warn('More than one file specified and "-t" is being used, but "-S" is not supplied');
|
||||||
|
exit 254;
|
||||||
|
}
|
||||||
|
|
||||||
|
#init the utility
|
||||||
|
my $mp3util=MP3::Tag::Utils->new;
|
||||||
|
|
||||||
|
#change each one
|
||||||
|
my $int=0;
|
||||||
|
while ($ARGV[$int]) {
|
||||||
|
$mp3util->change({
|
||||||
|
file=>$ARGV[$int],
|
||||||
|
album=>$opts{a},
|
||||||
|
artist=>$opts{A},
|
||||||
|
comment=>$opts{c},
|
||||||
|
genre=>$opts{g},
|
||||||
|
title=>$opts{t},
|
||||||
|
track=>$opts{T},
|
||||||
|
year=>$opts{y},
|
||||||
|
});
|
||||||
|
|
||||||
|
$int++;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
mp3tag - Manipulate the tags for one or more MP3 files.
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
mp3tag [B<-S>] [B<-a> <album>] [B<-A> <artist>] [B<-c> <comment>] [B<-g> <genre>] [B<-t> <title>] [B<-T> <track>] [B<-y> <year>] <mp3 files 0> [<mp3 file 1>...]
|
||||||
|
mp3tag [B<-a> <album>] [B<-A> <artist>] [B<-c> <comment>] [B<-g> <genre>] [B<-t> <title>] [B<-T> <track>] [B<-y> <year>] [ <mp3 files 0>
|
||||||
|
|
||||||
|
=head1 SWTICHES
|
||||||
|
|
||||||
|
=head2 -S
|
||||||
|
|
||||||
|
If more than one file is specified and "-t" being used.
|
||||||
|
|
||||||
|
This is done as this is done as generally setting all MP3s to have the
|
||||||
|
same title is not desired.
|
||||||
|
|
||||||
|
=head2 -a <album>
|
||||||
|
|
||||||
|
Set the album name.
|
||||||
|
|
||||||
|
=head2 -A <artist>
|
||||||
|
|
||||||
|
Set the artist name.
|
||||||
|
|
||||||
|
=head2 -c <comment>
|
||||||
|
|
||||||
|
Set the comment.
|
||||||
|
|
||||||
|
=head2 -g <genre>
|
||||||
|
|
||||||
|
Set the genre.
|
||||||
|
|
||||||
|
=head2 -t <title>
|
||||||
|
|
||||||
|
Set the title.
|
||||||
|
|
||||||
|
=head2 -T <track>
|
||||||
|
|
||||||
|
Set the track.
|
||||||
|
|
||||||
|
=head2 -y <year>
|
||||||
|
|
||||||
|
Sets the year.
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Copyright (c) 2010, Zame C. Bowers <vvelox@vvelox.net>
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS` OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
=head1 Changelog
|
||||||
|
|
||||||
|
=head2 0.0.0 - 2010-08-19/16:00
|
||||||
|
|
||||||
|
-Initial version.
|
||||||
|
|
||||||
|
=head1 SCRIPT CATEGORIES
|
||||||
|
|
||||||
|
Desktop
|
||||||
|
|
||||||
|
=head1 OSNAMES
|
||||||
|
|
||||||
|
any
|
||||||
|
|
||||||
|
=head1 README
|
||||||
|
|
||||||
|
mp3tag - Manipulate the tags for one or more MP3 files.
|
||||||
|
|
||||||
|
=cut
|
|
@ -0,0 +1,12 @@
|
||||||
|
blib*
|
||||||
|
Makefile
|
||||||
|
Makefile.old
|
||||||
|
Build
|
||||||
|
Build.bat
|
||||||
|
_build*
|
||||||
|
pm_to_blib*
|
||||||
|
*.tar.gz
|
||||||
|
.lwpcookies
|
||||||
|
cover_db
|
||||||
|
pod2htm*.tmp
|
||||||
|
MP3-Tag-Utils-*
|
|
@ -0,0 +1,626 @@
|
||||||
|
package MP3::Tag::Utils;
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use MP3::Tag;
|
||||||
|
use Text::NeatTemplate;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
MP3::Tag::Utils - Assorted utilities for manipulating MP3 files via MP3::Tag.
|
||||||
|
|
||||||
|
=head1 VERSION
|
||||||
|
|
||||||
|
Version 0.0.0
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
our $VERSION = '0.0.0';
|
||||||
|
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
use MP3::Tag::Utils;
|
||||||
|
|
||||||
|
my $foo = MP3::Tag::Utils->new();
|
||||||
|
...
|
||||||
|
|
||||||
|
=head1 METHODS
|
||||||
|
|
||||||
|
=head2 new
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub new{
|
||||||
|
my %args;
|
||||||
|
if (defined($_[1])) {
|
||||||
|
%args=%{$_[1]};
|
||||||
|
}
|
||||||
|
my $method='new';
|
||||||
|
|
||||||
|
|
||||||
|
my $self={
|
||||||
|
perror=>undef,
|
||||||
|
error=>undef,
|
||||||
|
errorString=>'',
|
||||||
|
module=>'MP3-Tag-Utils',
|
||||||
|
};
|
||||||
|
bless $self;
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 change
|
||||||
|
|
||||||
|
Change the tags on a MP3 file.
|
||||||
|
|
||||||
|
=head3 args hash
|
||||||
|
|
||||||
|
=head4 file
|
||||||
|
|
||||||
|
The file to operate on.
|
||||||
|
|
||||||
|
=head4 album
|
||||||
|
|
||||||
|
If this is defined, the tag is set to it.
|
||||||
|
|
||||||
|
=head4 artist
|
||||||
|
|
||||||
|
If this is defined, the tag is set to it.
|
||||||
|
|
||||||
|
=head4 comment
|
||||||
|
|
||||||
|
If this is defined, the tag is set to it.
|
||||||
|
|
||||||
|
=head4 genre
|
||||||
|
|
||||||
|
If this is defined, the tag is set to it.
|
||||||
|
|
||||||
|
=head4 title
|
||||||
|
|
||||||
|
If this is defined, the tag is set to it.
|
||||||
|
|
||||||
|
=head4 track
|
||||||
|
|
||||||
|
If this is defined, the tag is set to it.
|
||||||
|
|
||||||
|
=head4 year
|
||||||
|
|
||||||
|
If this is defined, the tag is set to it.
|
||||||
|
|
||||||
|
$foo->change(\%args);
|
||||||
|
if($foo->error){
|
||||||
|
warn('Error '.$foo->error.': '.$foo->errorString);
|
||||||
|
}
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub change{
|
||||||
|
my $self=$_[0];
|
||||||
|
my %args;
|
||||||
|
if (defined($_[1])) {
|
||||||
|
%args=%{$_[1]};
|
||||||
|
}
|
||||||
|
my $method='rename';
|
||||||
|
|
||||||
|
#blanks any previous errors
|
||||||
|
if (!$self->errorblank) {
|
||||||
|
warn($self->{module}.' '.$method.': Unable to blank previous error');
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
#makes sure some files are specified.
|
||||||
|
if (!defined($args{file})) {
|
||||||
|
$self->{error}=1;
|
||||||
|
$self->{errorString}='No file specified';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#make sure something to change is specified
|
||||||
|
if (
|
||||||
|
(!defined( $args{album} )) &&
|
||||||
|
(!defined( $args{artist} )) &&
|
||||||
|
(!defined( $args{comment} )) &&
|
||||||
|
(!defined( $args{genre} )) &&
|
||||||
|
(!defined( $args{title} )) &&
|
||||||
|
(!defined( $args{track} )) &&
|
||||||
|
(!defined( $args{year} ))
|
||||||
|
) {
|
||||||
|
$self->{error}=3;
|
||||||
|
$self->{errorString}='Nothing specified to change';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
#makes sure it appears to be a MP3
|
||||||
|
if ($args{file} !~ /[Mm][Pp]3$/) {
|
||||||
|
$self->{error}=4;
|
||||||
|
$self->{errorString}='Not a MP3';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
#makes sure the track is numeric
|
||||||
|
if (
|
||||||
|
defined($args{track}) &&
|
||||||
|
($args{track} !~ /^[0123456789]*$/)
|
||||||
|
) {
|
||||||
|
$self->{error}=5;
|
||||||
|
$self->{errorString}='Track is not numeric';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
#makes sure the year is numeric
|
||||||
|
if (
|
||||||
|
defined($args{year}) &&
|
||||||
|
($args{year} !~ /^[0123456789]*$/)
|
||||||
|
) {
|
||||||
|
$self->{error}=5;
|
||||||
|
$self->{errorString}='Track is not numeric';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $mp3=MP3::Tag->new($args{file});
|
||||||
|
|
||||||
|
delete($args{file});
|
||||||
|
|
||||||
|
$mp3->update_tags(\%args);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 rename
|
||||||
|
|
||||||
|
This renames files.
|
||||||
|
|
||||||
|
One argument is taken and it is a hash ref.
|
||||||
|
|
||||||
|
The returned argument is a hash ref.
|
||||||
|
|
||||||
|
=head3 args hash ref
|
||||||
|
|
||||||
|
=head4 files
|
||||||
|
|
||||||
|
This is a array of files to rename.
|
||||||
|
|
||||||
|
=head4 template
|
||||||
|
|
||||||
|
This is the template to use for renaming a file.
|
||||||
|
|
||||||
|
The template keys are listed below.
|
||||||
|
|
||||||
|
{$title}
|
||||||
|
{$track}
|
||||||
|
{$artist}
|
||||||
|
{$album}
|
||||||
|
{$comment}
|
||||||
|
{$year}
|
||||||
|
{$genre}
|
||||||
|
|
||||||
|
The default template is.
|
||||||
|
|
||||||
|
{$artist} - {$album} ({$year}) - {$track} - {$title}.mp3
|
||||||
|
|
||||||
|
=head3 return hash ref
|
||||||
|
|
||||||
|
=head4 failed
|
||||||
|
|
||||||
|
This is a array of failed files.
|
||||||
|
|
||||||
|
=head4 padto
|
||||||
|
|
||||||
|
This pads a the track out to be this wide with zeros. By default is is 2.
|
||||||
|
|
||||||
|
To disable this, set it to 0.
|
||||||
|
|
||||||
|
=head4 success
|
||||||
|
|
||||||
|
This is true if it succeeds.
|
||||||
|
|
||||||
|
If it any thing failed, this is set to false.
|
||||||
|
|
||||||
|
my $returned=$foo->rename(\%args);
|
||||||
|
if ( $foo->error || ){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub rename{
|
||||||
|
my $self=$_[0];
|
||||||
|
my %args;
|
||||||
|
if (defined($_[1])) {
|
||||||
|
%args=%{$_[1]};
|
||||||
|
}
|
||||||
|
my $method='rename';
|
||||||
|
|
||||||
|
#blanks any previous errors
|
||||||
|
if (!$self->errorblank) {
|
||||||
|
warn($self->{module}.' '.$method.': Unable to blank previous error');
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined($args{padto})) {
|
||||||
|
$args{padto}=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#makes sure some files are specified.
|
||||||
|
if (!defined($args{files})) {
|
||||||
|
$self->{error}=1;
|
||||||
|
$self->{errorString}='No files specified';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
if (ref($args{files}) ne 'ARRAY') {
|
||||||
|
$self->{error}=2;
|
||||||
|
$self->{errorString}='The key files is not a array.';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
if (!defined($args{files}[0])) {
|
||||||
|
$self->{error}=1;
|
||||||
|
$self->{errorString}='No files specified';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $template='{$artist} - {$album} ({$year}) - {$track} - {$title}.mp3';
|
||||||
|
if (defined($args{template})) {
|
||||||
|
$template=$args{template};
|
||||||
|
}
|
||||||
|
|
||||||
|
#this will be returned
|
||||||
|
my $toreturn={failed=>[], success=>1,};
|
||||||
|
|
||||||
|
#declare it here so it does not have to be constantly recreated
|
||||||
|
my $tobj = Text::NeatTemplate->new();
|
||||||
|
|
||||||
|
|
||||||
|
my $int=0;
|
||||||
|
while (defined( $args{files}[$int] )) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
(! -r $args{files}[$int] ) ||
|
||||||
|
( $args{files}[$int] !~ /\.[Mm][Pp]3$/ )
|
||||||
|
) {
|
||||||
|
$toreturn->{success}=0;
|
||||||
|
push( @{ $self->{failed} }, $args{file}[$int] );
|
||||||
|
}else {
|
||||||
|
my $mp3=MP3::Tag->new( $args{files}[$int] );
|
||||||
|
my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
|
||||||
|
|
||||||
|
my $int2=length($track);
|
||||||
|
while ($int2 < $args{padto}) {
|
||||||
|
$track='0'.$track;
|
||||||
|
|
||||||
|
$int2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %data=(
|
||||||
|
title=>$title,
|
||||||
|
track=>$track,
|
||||||
|
artist=>$artist,
|
||||||
|
album=>$album,
|
||||||
|
comment=>$comment,
|
||||||
|
year=>$year,
|
||||||
|
genre=>$genre,
|
||||||
|
);
|
||||||
|
|
||||||
|
my $newfilename=$tobj->fill_in(
|
||||||
|
data_hash=>\%data,
|
||||||
|
template=>$template,
|
||||||
|
);
|
||||||
|
|
||||||
|
rename($args{files}[$int], $newfilename);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$int++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $toreturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 show
|
||||||
|
|
||||||
|
This returns a string containing a description of all the specified MP3s.
|
||||||
|
|
||||||
|
One argument is taken and it is a hash ref.
|
||||||
|
|
||||||
|
The returned argument is a hash ref.
|
||||||
|
|
||||||
|
=head3 args hash ref
|
||||||
|
|
||||||
|
=head4 files
|
||||||
|
|
||||||
|
This is a array of files to rename.
|
||||||
|
|
||||||
|
=head4 template
|
||||||
|
|
||||||
|
This is the template to use for renaming a file.
|
||||||
|
|
||||||
|
The template keys are listed below.
|
||||||
|
|
||||||
|
{$file}
|
||||||
|
{$title}
|
||||||
|
{$track}
|
||||||
|
{$artist}
|
||||||
|
{$album}
|
||||||
|
{$comment}
|
||||||
|
{$year}
|
||||||
|
{$genre}
|
||||||
|
|
||||||
|
The default template is.
|
||||||
|
|
||||||
|
File: {$file}
|
||||||
|
Artist: {$artist}
|
||||||
|
Album: {$album}
|
||||||
|
Year: {$year}
|
||||||
|
Track: {$track}
|
||||||
|
Title: {$title}
|
||||||
|
|
||||||
|
=head3 return hash ref
|
||||||
|
|
||||||
|
=head4 failed
|
||||||
|
|
||||||
|
This is a array of failed files.
|
||||||
|
|
||||||
|
=head4 padto
|
||||||
|
|
||||||
|
This pads a the track out to be this wide with zeros. By default is is 2.
|
||||||
|
|
||||||
|
To disable this, set it to 0.
|
||||||
|
|
||||||
|
=head4 success
|
||||||
|
|
||||||
|
This is true if it succeeds.
|
||||||
|
|
||||||
|
If it any thing failed, this is set to false.
|
||||||
|
|
||||||
|
my $returned=$foo->rename(\%args);
|
||||||
|
if ( $foo->error || ){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub show{
|
||||||
|
my $self=$_[0];
|
||||||
|
my %args;
|
||||||
|
if (defined($_[1])) {
|
||||||
|
%args=%{$_[1]};
|
||||||
|
}
|
||||||
|
my $method='rename';
|
||||||
|
|
||||||
|
#blanks any previous errors
|
||||||
|
if (!$self->errorblank) {
|
||||||
|
warn($self->{module}.' '.$method.': Unable to blank previous error');
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined($args{padto})) {
|
||||||
|
$args{padto}=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#makes sure some files are specified.
|
||||||
|
if (!defined($args{files})) {
|
||||||
|
$self->{error}=1;
|
||||||
|
$self->{errorString}='No files specified';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
if (ref($args{files}) ne 'ARRAY') {
|
||||||
|
$self->{error}=2;
|
||||||
|
$self->{errorString}='The key files is not a array.';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
if (!defined($args{files}[0])) {
|
||||||
|
$self->{error}=1;
|
||||||
|
$self->{errorString}='No files specified';
|
||||||
|
warn($self->{module}.' '.$method.':'.$self->error.': '.$self->{errorString});
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $template="File: {\$file}\n".
|
||||||
|
"Artist: {\$artist}\n".
|
||||||
|
"Album: {\$album}\n".
|
||||||
|
"Year: {\$year}\n".
|
||||||
|
"Track: {\$track}\n".
|
||||||
|
"Title: {\$title}\n\n";
|
||||||
|
if (defined($args{template})) {
|
||||||
|
$template=$args{template};
|
||||||
|
}
|
||||||
|
|
||||||
|
#this will be returned
|
||||||
|
my $toreturn={failed=>[], success=>1, show=>''};
|
||||||
|
|
||||||
|
#declare it here so it does not have to be constantly recreated
|
||||||
|
my $tobj = Text::NeatTemplate->new();
|
||||||
|
|
||||||
|
my $int=0;
|
||||||
|
while (defined( $args{files}[$int] )) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
(! -r $args{files}[$int] ) ||
|
||||||
|
( $args{files}[$int] !~ /\.[Mm][Pp]3$/ )
|
||||||
|
) {
|
||||||
|
$toreturn->{success}=0;
|
||||||
|
push( @{ $self->{failed} }, $args{file}[$int] );
|
||||||
|
}else {
|
||||||
|
my $mp3=MP3::Tag->new( $args{files}[$int] );
|
||||||
|
my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
|
||||||
|
|
||||||
|
my $int2=length($track);
|
||||||
|
while ($int2 < $args{padto}) {
|
||||||
|
$track='0'.$track;
|
||||||
|
|
||||||
|
$int2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %data=(
|
||||||
|
file=>$args{files}[$int],
|
||||||
|
title=>$title,
|
||||||
|
track=>$track,
|
||||||
|
artist=>$artist,
|
||||||
|
album=>$album,
|
||||||
|
comment=>$comment,
|
||||||
|
year=>$year,
|
||||||
|
genre=>$genre,
|
||||||
|
);
|
||||||
|
|
||||||
|
$toreturn->{show}=$toreturn->{show}.$tobj->fill_in(
|
||||||
|
data_hash=>\%data,
|
||||||
|
template=>$template,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$int++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $toreturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
=head1 ERROR RELATED METHODS
|
||||||
|
|
||||||
|
=head2 error
|
||||||
|
|
||||||
|
This returns the current error value.
|
||||||
|
|
||||||
|
This returns a integer or undefined, Perl boolean value, indicating if
|
||||||
|
a error is present or not and if it is which.
|
||||||
|
|
||||||
|
if($foo->error){
|
||||||
|
print "Error Code: ".$foo->error."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub error{
|
||||||
|
return $_[0]->{error};
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 errorString
|
||||||
|
|
||||||
|
This turns the current error string.
|
||||||
|
|
||||||
|
if($foo->errorString ne ''){
|
||||||
|
print "Error String: ".$foo->errorString."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub errorString{
|
||||||
|
return $_[0]->{errorString};
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 errorblank
|
||||||
|
|
||||||
|
This blanks a error, if a permanent error is not set.
|
||||||
|
|
||||||
|
This is a internal method and there is no good reason to call it.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub errorblank{
|
||||||
|
if ($_[0]->{perror}) {
|
||||||
|
warn($_[0]->{module}.' errorblank: Unable to blank error. A permanent one is set');
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
$_[0]->{error}=undef;
|
||||||
|
$_[0]->{errorString}='';
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
=head1 ERROR CODES
|
||||||
|
|
||||||
|
=head2 1
|
||||||
|
|
||||||
|
No files specified.
|
||||||
|
|
||||||
|
=head2 2
|
||||||
|
|
||||||
|
The files key does not contain a array.
|
||||||
|
|
||||||
|
=head2 3
|
||||||
|
|
||||||
|
No changes specified.
|
||||||
|
|
||||||
|
=head2 4
|
||||||
|
|
||||||
|
Does not appear to be a MP3.
|
||||||
|
|
||||||
|
=head2 5
|
||||||
|
|
||||||
|
Track is not numeric.
|
||||||
|
|
||||||
|
=head2 6
|
||||||
|
|
||||||
|
Year is not numeric.
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Zane C. Bowers, C<< <vvelox at vvelox.net> >>
|
||||||
|
|
||||||
|
=head1 BUGS
|
||||||
|
|
||||||
|
Please report any bugs or feature requests to C<bug-mp3-tag-utils at rt.cpan.org>, or through
|
||||||
|
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MP3-Tag-Utils>. I will be notified, and then you'll
|
||||||
|
automatically be notified of progress on your bug as I make changes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=head1 SUPPORT
|
||||||
|
|
||||||
|
You can find documentation for this module with the perldoc command.
|
||||||
|
|
||||||
|
perldoc MP3::Tag::Utils
|
||||||
|
|
||||||
|
|
||||||
|
You can also look for information at:
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item * RT: CPAN's request tracker
|
||||||
|
|
||||||
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MP3-Tag-Utils>
|
||||||
|
|
||||||
|
=item * AnnoCPAN: Annotated CPAN documentation
|
||||||
|
|
||||||
|
L<http://annocpan.org/dist/MP3-Tag-Utils>
|
||||||
|
|
||||||
|
=item * CPAN Ratings
|
||||||
|
|
||||||
|
L<http://cpanratings.perl.org/d/MP3-Tag-Utils>
|
||||||
|
|
||||||
|
=item * Search CPAN
|
||||||
|
|
||||||
|
L<http://search.cpan.org/dist/MP3-Tag-Utils/>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
|
||||||
|
=head1 ACKNOWLEDGEMENTS
|
||||||
|
|
||||||
|
|
||||||
|
=head1 LICENSE AND COPYRIGHT
|
||||||
|
|
||||||
|
Copyright 2010 Zane C. Bowers.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of either: the GNU General Public License as published
|
||||||
|
by the Free Software Foundation; or the Artistic License.
|
||||||
|
|
||||||
|
See http://dev.perl.org/licenses/ for more information.
|
||||||
|
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
1; # End of MP3::Tag::Utils
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!perl -T
|
||||||
|
|
||||||
|
use Test::More tests => 1;
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
use_ok( 'MP3::Tag::Utils' ) || print "Bail out!
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
diag( "Testing MP3::Tag::Utils $MP3::Tag::Utils::VERSION, Perl $], $^X" );
|
|
@ -0,0 +1,55 @@
|
||||||
|
#!perl -T
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Test::More tests => 3;
|
||||||
|
|
||||||
|
sub not_in_file_ok {
|
||||||
|
my ($filename, %regex) = @_;
|
||||||
|
open( my $fh, '<', $filename )
|
||||||
|
or die "couldn't open $filename for reading: $!";
|
||||||
|
|
||||||
|
my %violated;
|
||||||
|
|
||||||
|
while (my $line = <$fh>) {
|
||||||
|
while (my ($desc, $regex) = each %regex) {
|
||||||
|
if ($line =~ $regex) {
|
||||||
|
push @{$violated{$desc}||=[]}, $.;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (%violated) {
|
||||||
|
fail("$filename contains boilerplate text");
|
||||||
|
diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
|
||||||
|
} else {
|
||||||
|
pass("$filename contains no boilerplate text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub module_boilerplate_ok {
|
||||||
|
my ($module) = @_;
|
||||||
|
not_in_file_ok($module =>
|
||||||
|
'the great new $MODULENAME' => qr/ - The great new /,
|
||||||
|
'boilerplate description' => qr/Quick summary of what the module/,
|
||||||
|
'stub function definition' => qr/function[12]/,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
TODO: {
|
||||||
|
local $TODO = "Need to replace the boilerplate text";
|
||||||
|
|
||||||
|
not_in_file_ok(README =>
|
||||||
|
"The README is used..." => qr/The README is used/,
|
||||||
|
"'version information here'" => qr/to provide version information/,
|
||||||
|
);
|
||||||
|
|
||||||
|
not_in_file_ok(Changes =>
|
||||||
|
"placeholder date/time" => qr(Date/time)
|
||||||
|
);
|
||||||
|
|
||||||
|
module_boilerplate_ok('lib/MP3/Tag/Utils.pm');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!perl -T
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Test::More;
|
||||||
|
|
||||||
|
unless ( $ENV{RELEASE_TESTING} ) {
|
||||||
|
plan( skip_all => "Author tests not required for installation" );
|
||||||
|
}
|
||||||
|
|
||||||
|
eval "use Test::CheckManifest 0.9";
|
||||||
|
plan skip_all => "Test::CheckManifest 0.9 required" if $@;
|
||||||
|
ok_manifest();
|
|
@ -0,0 +1,18 @@
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Test::More;
|
||||||
|
|
||||||
|
# Ensure a recent version of Test::Pod::Coverage
|
||||||
|
my $min_tpc = 1.08;
|
||||||
|
eval "use Test::Pod::Coverage $min_tpc";
|
||||||
|
plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
|
||||||
|
if $@;
|
||||||
|
|
||||||
|
# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
|
||||||
|
# but older versions don't recognize some common documentation styles
|
||||||
|
my $min_pc = 0.18;
|
||||||
|
eval "use Pod::Coverage $min_pc";
|
||||||
|
plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
|
||||||
|
if $@;
|
||||||
|
|
||||||
|
all_pod_coverage_ok();
|
Loading…
Reference in New Issue