1159b3361Sopenharmony_ci# 2159b3361Sopenharmony_ci# From: Per Bolmstedt <tomten@kol14.com> 3159b3361Sopenharmony_ci# 4159b3361Sopenharmony_ci# AC> If someone has scripts that read input ID3 tags and convert 5159b3361Sopenharmony_ci# AC> them to args for lame (which then encodes the tags into the 6159b3361Sopenharmony_ci# AC> output files), let me know, too! 7159b3361Sopenharmony_ci# 8159b3361Sopenharmony_ci# This is easy peasy using Perl. Especially using Chris Nandor's excellent 9159b3361Sopenharmony_ci# MP3::Info package (available on CPAN). Here's a program I just wrote that 10159b3361Sopenharmony_ci# I think does what you want. Invoke it with "<program> <file> [options]" 11159b3361Sopenharmony_ci# (where the options can include an output filename), like for example: 12159b3361Sopenharmony_ci# 13159b3361Sopenharmony_ci# lameid3.pl HQ.mp3 LQ.mp3 -fv 14159b3361Sopenharmony_ci# 15159b3361Sopenharmony_ci# (Note how the syntax differs from that of Lame's.) The program will 16159b3361Sopenharmony_ci# extract ID3 tags from the input file and invoke Lame with arguments for 17159b3361Sopenharmony_ci# including them. (This program has not undergone any real testing..) 18159b3361Sopenharmony_ci 19159b3361Sopenharmony_ciuse MP3::Info; 20159b3361Sopenharmony_ciuse strict; 21159b3361Sopenharmony_ci 22159b3361Sopenharmony_cimy %flds = ( 23159b3361Sopenharmony_ci TITLE => 'tt', 24159b3361Sopenharmony_ci ARTIST => 'ta', 25159b3361Sopenharmony_ci ALBUM => 'tl', 26159b3361Sopenharmony_ci YEAR => 'ty', 27159b3361Sopenharmony_ci COMMENT => 'tc', 28159b3361Sopenharmony_ci GENRE => 'tg', 29159b3361Sopenharmony_ci TRACKNUM => 'tn' 30159b3361Sopenharmony_ci ); 31159b3361Sopenharmony_ci 32159b3361Sopenharmony_cimy $f = shift @ARGV; 33159b3361Sopenharmony_cimy $s = "lame ${f} " . &makeid3args( $f ) . join ' ', @ARGV; 34159b3361Sopenharmony_ciprint STDERR "[${s}]\n"; 35159b3361Sopenharmony_cisystem( $s ); 36159b3361Sopenharmony_ci 37159b3361Sopenharmony_cisub makeid3args( $ ) 38159b3361Sopenharmony_ci{ 39159b3361Sopenharmony_ci my $s; 40159b3361Sopenharmony_ci if ( my $tag = get_mp3tag( @_->[ 0 ] ) ) 41159b3361Sopenharmony_ci { 42159b3361Sopenharmony_ci for ( keys %flds ) 43159b3361Sopenharmony_ci { 44159b3361Sopenharmony_ci if ( $tag->{ $_ } ) 45159b3361Sopenharmony_ci { 46159b3361Sopenharmony_ci $s .= sprintf( 47159b3361Sopenharmony_ci "--%s \"%s\" ", 48159b3361Sopenharmony_ci %flds->{ $_ }, 49159b3361Sopenharmony_ci $tag->{ $_ } ); 50159b3361Sopenharmony_ci } 51159b3361Sopenharmony_ci } 52159b3361Sopenharmony_ci } 53159b3361Sopenharmony_ci return $s || ""; 54159b3361Sopenharmony_ci} 55159b3361Sopenharmony_ci 56