use MP3::Tag; use File::Find; use strict; my @fileList; my $debug = 0; my $dir; if ($0=~m#^(.*)\\#) { $dir = "$1"; } elsif ($0=~m#^(.*)/# ) { $dir = "$1"; } else { `pwd` =~ /(.*)/; $dir = "$1"; } $dir =~ s/\\/\//g; find(\&matchMP3, $dir); print "Files found: ".($#fileList+1)."\n"; my $count = $#fileList+1; foreach my $item ( @fileList ) { print "Reading ID3: ".fitToScreen($item)."\n"; my $mp3 = MP3::Tag->new($item); $mp3->get_tags(); print "No ID3v2 tag found.\n", if not exists $mp3->{ID3v2}; next, if not exists $mp3->{ID3v2}; print "ID3v2 tag found...\n"; my $tag = $mp3->{ID3v2}; my $frameIDs_hash = $tag->get_frame_ids(); foreach my $frame (keys %$frameIDs_hash) { #my $format = $tag->get_format($frame); #print "| $frame (unknown): [UNKNOWN]\n", if not defined $format; #next, if not defined $format; my ($name, @info) = $tag->get_frame($frame); for my $info (@info) { if (ref $name) { if (ref $info) { print "| $frame:\n"; while(my ($key,$val)=each %$info) { print "| ($key => $val)\n"; } } else { print "| $frame ($info):\n"; } while(my ($key,$val)=each %$name) { print "| * $key => $val\n", if not $key eq "_Data"; print "| * $key => [IMAGE]\n", if ($frame eq "APIC" and $key eq "_Data"); print "| * $key => [DATA]\n", if (not $frame eq "APIC" and $key eq "_Data"); } } else { print "| $frame ($info): $name\n", if $info; print "| $frame (uknown): ".ref($name)."\n", if !$info; } } } $mp3->close(); $count--; print "Done. (".($#fileList+1-$count)." of ".($#fileList+1).")\n\n"; } print "\nPress return to continue..."; my $pause = <>; exit; sub matchMP3() { print "Searching directory $File::Find::name...\n", if -d $File::Find::name and $debug; if ( -f $File::Find::name ) { if ( $File::Find::name =~ /\.mp3/ ) { #print "Adding file $File::Find::name\n", if $debug == 2; push (@fileList, $File::Find::name); } } } sub fitToScreen() { my $filespec = shift; return $filespec, if length $filespec < 67; my @parts = split("/", $filespec); my $name = @parts[$#parts]; my $len = length $name; my $pre = 64 - $len; return substr($filespec, 0, $pre)."...".$name; }