#!/usr/bin/perl use MP3::Info; use File::Find; print < Catalogue ENDPREFIX find(\&record, "./"); print "
Artist/Collection Album/Folder Track Name Duration
\n\n\n"; sub record() { $name = $_; $dir = $File::Find::dir; @segs = split("/", $dir); $artist = $segs[1]; shift(@segs); shift(@segs); $album = join("/", @segs); if (-d $name || $name =~ /jpg|png|gif|bmp|doc|rtf|txt/i || $name =~ /^[.]/ || $dir =~ /Recycled/i) { return; } if (! $album) { $album = " "; # for generating a table cell in HTML } $info = get_mp3info($name); print ""; if ($name =~ /[.]mp3$/ && ! $@ && $info->{SECS} > 0) { $s = $info->{SS}; $m = $info->{MM} % 60; $h = int($info->{MM} / 60); if ($h > 0) { printf("%s%s%s%d:%02d:%02d", $artist, $album, $name, $h, $m, $s); } else { printf("%s%s%s%02d:%02d", $artist, $album, $name, $m, $s); } } else { printf("%s%s%s ", $artist, $album, $name); $@ = ""; # reset error message } print "\n"; }