Astroboy
view release on metacpan or search on metacpan
2009-02-04 10:13 cvs
* Astroboy-1.05.tar.gz, MANIFEST, t/00_albumdir_basic.t,
t/01_albumfile_basic.t, t/02_astroboy.t,
t/03_albumdir_advanced.t, t/04_guesstags.t: made it so the distro
does not include my test mp3 suite, which is 1) bulky and 2)
copyrighted
2009-01-05 13:38 cvs
* bin/astroboyfindbad: made sure on missing args we say so for
bin/astroboyfindbad
2009-01-05 13:35 cvs
* t/04_guesstags.t: had to alter test 04 because it only works as
hack on my laptop
2009-01-05 13:25 cvs
* t/music/: dir1/velvet underground - loaded - 02 - sweet jane.mp3,
dir1/velvet underground - loaded - 05 - new age.mp3, dir2_copy/01
- Stone Temple Pilots - Meatplow.mp3, dir2_copy/01 - The
Gutter.mp3, dir2_copy/03 Sober.mp3, dir2_copy/03 Vicious
World.mp3, dir2_copy/06 Swamp Song.mp3, dir2_copy/Sonic Youth -
03 - Theresa's Sound-world.mp3: renaming mp3 files so they have
Changes
INSTALL
MANIFEST
Makefile.PL
README
bin/astroboy
bin/astroboyfindbad
bin/astroboyid3guess
bin/astroboyinfo
bin/m4amp3.pl
bin/mp3resize
lib/Astroboy.pm
lib/Astroboy.pod
lib/Astroboy/API.pod
lib/Astroboy/AlbumDir.pm
lib/Astroboy/AlbumFile.pm
lib/Astroboy/Base.pm
t/00_albumdir_basic.t
t/01_albumfile_basic.t
t/02_astroboy.t
t/03_albumdir_advanced.t
t/04_guesstags.t
t/05_absmusic_via_method.t
t/06_absmusic_via_class.t
t/99_cleanup.sh
META.yml Module meta-data (added by MakeMaker)
Makefile.PL view on Meta::CPAN
'Test::Simple' => '0',
},
LICENSE => 'perl',
EXE_FILES => [qw(bin/astroboy
bin/astroboyfindbad
bin/astroboyid3guess
bin/astroboyinfo
bin/m4amp3.pl
bin/mp3resize)],
);
bin/astroboyfindbad view on Meta::CPAN
or debug("no mp3 files in $abs_dir")
and next DIR;
SONG: for my $abs_path (@all){
$total++;
my($artist,$album,$song)= _artist_album_song($abs_path);
#hackish
if (!$artist and ( $opt_g or $opt_G)){
my $guess= $astro->artist_guess($abs_path);
if ($guess){
print STDERR "[artist guess : $guess] ";
if ($opt_G and $guess=~/\w/){
$artist = $guess;
`id3tag --artist="$artist" "$abs_path"`;
print STDERR "[committed] ";
}
}
}
bin/astroboyfindbad view on Meta::CPAN
sub usage {
qq{$0 - find mp3 files missing artist and or album id3 tag
OPTIONS
-d debug on
-h help
-v version and exit
-s also show which are missing song id3 tag
-b verbose, show what is missing
-g guess artist if missing from id3 tag
-G guess artist if missing from id3 tag and save
EXAMPLES
$0 ~/music/incoming
AUTHOR
Leo Charre leocharre at cpan dot org
SEE ALSO
bin/astroboyid3guess view on Meta::CPAN
my $astro = Astroboy->new;
my @mp3s = _argvfiles('mp3') or die("no files chosen");
for my $abs (@mp3s){
print $abs;
my $guess = $astro->artist_guess($abs);
$guess ||= '[no guess]';
print " $guess\n";
}
sub debug { print STDERR "$0, @_\n" if $opt_d; 1 }
lib/Astroboy/API.pod view on Meta::CPAN
=head1 Astroboy::Base
=head2 artists()
Simply returns names of subdirs in ABS_MUSIC.
=head2 artists_count()
Returns number.
=head2 artist_guess()
Argument is a string, a filename, or a path.
Tries to guess what artist it is.
Uses artists currently listed in ABS MUSIC.
=head2 debug()
=head2 abs_music()
Perl setget method. Argument is abs path to music. Default is $ENV{HOME}/music.
Same as $Astroboy::ABS_MUSIC, but as method.
lib/Astroboy/Base.pm view on Meta::CPAN
package Astroboy::Base;
use strict;
use vars qw(@ISA $VERSION @EXPORT);
use Exporter;
@ISA = qw/Exporter/;
@EXPORT = qw(debug abs_music artists artists_count artist_guess);
use LEOCHARRE::Dir;
use LEOCHARRE::Class2;
use Carp;
no strict 'refs';
__PACKAGE__->make_count_for('artists');
$Astroboy::ABS_MUSIC ||= $ENV{HOME}.'/music';
$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)/g;
lib/Astroboy/Base.pm view on Meta::CPAN
my @a = sort ( LEOCHARRE::Dir::lsd( abs_music() ) );
$self->{artists} = [@a];
}
$self->{artists};
}
sub artist_guess {
my ($self,$path) = ($_[0],lc($_[1]));
#TODO consider using String::Similarity::Group
unless($self->{artists_match}){
my $artists = $self->artists;
for (@$artists){
my $a = lc ($_);
$a=~s/_+/ /g;
$a=~s/^\s+|\s+$//g;
t/04_guesstags.t view on Meta::CPAN
my $as = $astro->artists;
ok $as;
my $c =scalar @$as;
ok($c,"got $c");
for my $path (
'/home/leo/music/tom_waits/Tom Waits_misc/Tom Waits - Martha.mp3'
){
my $guess = $astro->artist_guess($path);
ok($guess,"arg $path: $guess");
}
sub skipcond {
-d './t/music' and return 1;
ok(1, 'skipped, missing ./t/music, must be distro');
exit;
}
( run in 0.771 second using v1.01-cache-2.11-cpan-702932259ff )