Astroboy
view release on metacpan or search on metacpan
bin/astroboy view on Meta::CPAN
#!/usr/bin/perl
use MP3::Tag;
use strict;
use vars qw(@FILES @ALBUM_DIRS @TRASH $ABS_MUSIC $VERSION);
use Astroboy;
use Getopt::Std::Strict 'a:tehdv';
use LEOCHARRE::Dir ':all';
$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)/g;
INIT {
$opt_h and print usage() and exit;
$opt_v and print $VERSION and exit;
}
my $astro = Astroboy->new;
$opt_a and $Astroboy::ABS_MUSIC = $opt_a;
my $abs_music = $astro->abs_music;
debug("MUSIC : $abs_music");
@ARGV and scalar @ARGV or die("missing arguments\n");
for ( @ARGV){
my $abs = Cwd::abs_path($_) or next;
if (-f $abs ){
do_file($abs);
}
elsif( -d $abs ){
do_dir($abs);
}
}
exit;
sub do_dir {
my $abs = shift;
-d $abs or return;
my $a = $astro->dir($abs) or warn("Not album dir $abs\n") and return;
$opt_t and $a->empty_trash;
my $newloc = $a->refile or warn("cant refile $abs, ".$a->errstr) and return;
debug("refiled to $newloc");
return 1;
}
( run in 0.316 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )