#!/usr/bin/perl -w use strict; use MP3::Tag; use File::Find; # define how autoinfo tries to get information # default: # MP3::Tag->config("autoinfo","ID3v2","ID3v1","filename"); # don't use ID3v2: # MP3::Tag->config("autoinfo","ID3v1","filename"); # read a directory path from STDIN # Since we don't have a prompt, the cursor is just going to sit idle until your supply some input while () { chomp; # find all entries in the given directory/folder, calls the &wanted call-back for every file/directory encountered find(\&wanted, $_); } sub wanted { # $_ automatically contains the current file name i.e. "Knock You Down.MP3" # don't bother processing anything that does not have the .mp3 extension, case irrelevant return unless /mp3$/i; if (my $mp3=MP3::Tag->new($_)) { print "$_ (Tags: ", join(", ",$mp3->get_tags),")\n"; my @info=$mp3->autoinfo; print "* Song: $info[0]\n"; print "* Track: $info[1]\n"; print "* Artist: $info[2]\n"; print "* Album: $info[3]\n"; print "* Comment: $info[4]\n"; } print "\n"; }