While idly thinking about coding an mp3 sorting program, I decided to look at my options for reading mp3 tags.
Turns out that (unless my benchmarking is off) MP3::Info is much faster than MP3::Tag. pudge was quite pleased...
If the following benchmark is completely off, I can only claim exhaustion, as it was wirtten at an hour when I should have been asleep. :-)
#!/usr/local/bin/perl use MP3::Info; use MP3::Tag; use Benchmark; use strict; use warnings; my $track = shift; timethese( shift || 10000, { info => sub { my $tag = get_mp3tag($track); my $tracknum = $tag->{TRACKNUM}; }, autotag => sub { my $mp3 = MP3::Tag->new($track); my $tracknum = ( $mp3->autoinfo )[1]; }, manualtag => sub { my $mp3 = MP3::Tag->new($track); $mp3->get_tags; if ( exists $mp3->{ID3v1} ) { # read some information from the tag my $id3v1 = $mp3 ->{ID3v1}; # $id3v1 is only a shortcut for $mp3 +->{ID3v1} my $tracknum = $mp3->{ID3v1}->track; } if ( exists $mp3->{ID3v2} ) { # read some information from the tag my $tacknum = $mp3->{ID3v2}->get_frame("TRCK"); # delete the tag completely from the file $mp3->{ID3v2}->remove_tag; } $mp3->close(); } } );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Benchmarking MP3::Tag vs. MP3::Info
by b10m (Vicar) on Jul 21, 2006 at 06:44 UTC | |
by dha (Acolyte) on Jul 21, 2006 at 16:59 UTC | |
Re: Benchmarking MP3::Tag vs. MP3::Info
by xdg (Monsignor) on Jul 21, 2006 at 10:30 UTC | |
Re: Benchmarking MP3::Tag vs. MP3::Info
by revdiablo (Prior) on Jul 21, 2006 at 16:12 UTC | |
Re: Benchmarking MP3::Tag vs. MP3::Info
by dsully (Acolyte) on Jul 21, 2006 at 18:06 UTC | |
by xdg (Monsignor) on Jul 21, 2006 at 19:14 UTC | |
by dsully (Acolyte) on Jul 24, 2006 at 03:48 UTC |
Back to
Meditations