use strict; use MP3::Info; use File::Find; use SPOPS::Initialize; $|++; @ARGV = ('.') unless @ARGV; # the configuration SPOPS::Initialize->process({ config => { myobject => { class => 'MySPOPS::MP3', isa => [qw( MySPOPS::DBI )], field => [qw(title artist album year genre)], id_field => 'id', object_name => 'mp3', base_table => 'songs', } }}); find sub { return unless m/\.mp3$/; my $tag = get_mp3tag($_) or return; my $mp3 = MySPOPS::MP3->new({map {lc($_)=>$tag->{$_}} keys %$tag}); print STDERR join(':',values %$mp3),"\n"; $mp3->save(); }, @ARGV;