MP3情報の取得
MP3::Infoを使います。
use strict; use Encode; use MP3::Info; my $file = 'music.mp3'; my $info = get_mp3info($file); unless ($info) { die "$@[$file]"; } my $tag = get_mp3tag($file); unless ($tag) { die "$@[$file]"; } print "Version: ", $info->{VERSION}, "\n"; print "Layer: ", $info->{LAYER}, "\n"; print "Frequency: ", $info->{FREQUENCY}, "kHz", "\n"; print "Size: ", $info->{SIZE}, "bytes", "\n"; print "Time: ", $info->{TIME}, "\n"; print "Copyright: ", $info->{COPYRIGHT}, "\n"; print "Album: ", get_japanese_string($tag->{ALBUM}), "\n"; print "Artist: ", get_japanese_string($tag->{ARTIST}), "\n"; print "Comment: ", get_japanese_string($tag->{COMMENT}), "\n"; print "Genre: ", get_japanese_string($tag->{GENRE}), "\n"; print "Title: ", get_japanese_string($tag->{TITLE}), "\n"; print "Tracknum: ", $tag->{TRACKNUM}, "\n"; print "Year: ", $tag->{YEAR}, "\n"; sub get_japanese_string { return Encode::encode("cp932", $_[0]); }