#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use feature ':5.10';
use MP3::Tag;
binmode STDOUT, ':utf8';
binmode STDIN, ':utf8';
my $dir = shift;
mp3_list($dir);
sub mp3_list {
my ($top) = @_;
if (-d $top) {
my $DIR;
opendir $DIR, $top;
while (my $item = readdir $DIR) {
next if $item eq '.' || $item eq '..';
mp3_list("$top/$item");
}
}
else {
if ( $top =~ /\.mp3$/ ) {
my $mp3 = MP3::Tag->new($top);
say $mp3->title;
}
}
}
No comments:
Post a Comment