Here's something I wrote in perl to encode mp3's ripped from a cd. It's not elegant, but it works. ---- Cut here---- #!/usr/bin/perl -w # this is the SCSI device id $cd_device="1,3,0"; $encoder_options="-S -m s -q 0 --vbr-new -V 0 -b 192 -B 320 -f -k"; mkdir "riptemp"; chdir "riptemp"; system ("/usr/bin/cdda2wav -D $cd_device -B -L"); open (CDINDEX, "audio.cdindex") || die "Can't open file: audio.cdindex \n"; while (<CDINDEX>) { if (/Title\>(.*)\</) { $album=$1; } if (/Artist\>(.*)\</) { $artist=$1; } if (/Num\=\"(\d+)\"\>/) { $count=$1; } if (/Name\>(.*)\</) { $song[$count]=$1; } } close CDINDEX; @wavfiles=`ls *.wav`; chomp(@wavfiles); @mp3files=@wavfiles; for (0..$#mp3files) { $mp3files[$_]=~ s/wav/mp3/; } for (0..$#wavfiles) { my $track; $track=$_ + 1; system(qq{\/usr\/local\/bin\/lame $encoder_options --tl "$album" --ta "$artist" --tt "$song[$track]" --tn $track $wavfiles[$_] $mp3files[$_]}); } mkdir "..\/$artist"; mkdir "..\/$artist\/$album"; for (0..$#mp3files) { my $track; $track=$_ +1; system(qq{ mv $mp3files[$_] "..\/$artist\/$album\/$artist - $album - $song[$track].mp3"}); } system ("rm -f audio*"); chdir ".."; rmdir "riptemp"; ---and here :-)----- -- Chris ---------------------------------- E Mail chris@glovercc.clara.co.uk On Sat, 3 Jan 2004, Syd Hancock wrote:
Hi all
I want to do something that I am sure is very simple but I am frustrated because I am not sure where to start.
Basically all I want to do is to feed all the files from a directory one by one into an application - i.e. using lame to encode wav files to mp3.
Can this be done from a bash script or should I use perl or ???
Any advice or info much appreciated.
Syd
_______________________________________________ main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!