Re: [mp3encoder] lame and linux!
awesome! thanks guys! I'll try that this morning. cheers, -Ken On 8/3/06, Stephen Swinsburg [EMAIL PROTECTED] wrote: Heres the perl equivalent: #!/usr/bin/perl -w # # script to process all mp3 files under a given directory or directories # use File::Find; no warnings 'File::Find'; #the @array holds the dirs you want to search, you can specify multiple dirs here or just one, #uncomment appropriate one [EMAIL PROTECTED] = (/path/to/your/directory/, /path/to/your/ directory2/); @directories_to_search = /path/to/your/directory/; find(\processFiles, @directories_to_search); #this function is called on every file and dir that is found under the sub processFiles() { #check if its a .mp3 file if ($_ =~ /(mp3)$/) { #the filename found is stored in $_ so we can use that directly $command = lame -b 64 -f -m s $_ stream_$_; $result = `$command`; } } On 04/08/2006, at 12:40 PM, Warren Toomey wrote: On Thu, Aug 03, 2006 at 06:29:12PM -0400, Ken wrote: such I've added code to re-encode mp3's as they are being uploaded, but all for the existing mp3's, is it possible in the Linux shell to use maybe grep or something to go though all the folders and re-encode every single mp3 one at a time using this command lame -b 64 -f -m s SongName.mp3 stream_SongName.mp3 Write a script called /tmp/z like this #!/bin/sh infile=$1 dir=`dirname $infile` base=`basename $infile` outfile=$dir/stream_$base lame -b 64 -f -m s $infile $outfile Make it executable, and test it with a single input file. Now apply it to the whole directory: find dir -name '*.mp3' -exec /tmp/z {} \; where dir is the top-level directory name. Cheers, Warren ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ Steve Swinsburg Programmer Teaching Learning Centre University of New England, Armidale, 2351 [EMAIL PROTECTED] t: +612 6773 2922 f: +612 6773 3269 ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [mp3encoder] lame and linux!
I'm getting this error when it try to run your script: find: /tmp/z: No such file or directory and the command I'm running it with, not sure if this is right, find /home/www.site.com/members/ -name '*.mp3' -exec /tmp/z {} \; thanks again, -Ken On 8/3/06, Warren Toomey [EMAIL PROTECTED] wrote: On Thu, Aug 03, 2006 at 06:29:12PM -0400, Ken wrote: such I've added code to re-encode mp3's as they are being uploaded, but all for the existing mp3's, is it possible in the Linux shell to use maybe grep or something to go though all the folders and re-encode every single mp3 one at a time using this command lame -b 64 -f -m s SongName.mp3 stream_SongName.mp3 Write a script called /tmp/z like this #!/bin/sh infile=$1 dir=`dirname $infile` base=`basename $infile` outfile=$dir/stream_$base lame -b 64 -f -m s $infile $outfile Make it executable, and test it with a single input file. Now apply it to the whole directory: find dir -name '*.mp3' -exec /tmp/z {} \; where dir is the top-level directory name. Cheers, Warren ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [mp3encoder] lame and linux!
I often use grep in conjunction with find and xargs. Check out xargs, it might do exactly what you want or at least some of it. On 8/4/06, Ken [EMAIL PROTECTED] wrote: I'm getting this error when it try to run your script: find: /tmp/z: No such file or directory and the command I'm running it with, not sure if this is right, find /home/www.site.com/members/ -name '*.mp3' -exec /tmp/z {} \; thanks again, -Ken On 8/3/06, Warren Toomey [EMAIL PROTECTED] wrote: On Thu, Aug 03, 2006 at 06:29:12PM -0400, Ken wrote: such I've added code to re-encode mp3's as they are being uploaded, but all for the existing mp3's, is it possible in the Linux shell to use maybe grep or something to go though all the folders and re-encode every single mp3 one at a time using this command lame -b 64 -f -m s SongName.mp3 stream_SongName.mp3 Write a script called /tmp/z like this #!/bin/sh infile=$1 dir=`dirname $infile` base=`basename $infile` outfile=$dir/stream_$base lame -b 64 -f -m s $infile $outfile Make it executable, and test it with a single input file. Now apply it to the whole directory: find dir -name '*.mp3' -exec /tmp/z {} \; where dir is the top-level directory name. Cheers, Warren ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [mp3encoder] lame and linux!
On Fri, Aug 04, 2006 at 11:01:08AM -0400, Ken wrote: I'm getting this error when it try to run your script: find: /tmp/z: No such file or directory and the command I'm running it with, not sure if this is right, find /home/www.site.com/members/ -name '*.mp3' -exec /tmp/z {} \; thanks again, -Ken Did you write a script called /tmp/z with these contents and make it executable? On 8/3/06, Warren Toomey [EMAIL PROTECTED] wrote: Write a script called /tmp/z like this #!/bin/sh infile=$1 dir=`dirname $infile` base=`basename $infile` outfile=$dir/stream_$base lame -b 64 -f -m s $infile $outfile Make it executable, and test it with a single input file. ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder
Re: [mp3encoder] lame and linux!
What version Perl are you running? I just ran it on my machine and it worked fine. $ perl -v This is perl, v5.8.7 built for i486-linux Hope this helps. hmm, i got this error trying to run the perl script: [EMAIL PROTECTED] home]# ./lame.pl unknown warnings category 'File::Find' at ./lame.pl line 8 BEGIN failed--compilation aborted at ./lame.pl line 8. so I guess 'File::Find' isn't installed? but i can't remember the commands to install it, i haven't used perl in years. any ideas? thanks again! -Ken On 8/4/06, Ken [EMAIL PROTECTED] wrote: awesome! thanks guys! I'll try that this morning. cheers, -Ken On 8/3/06, Stephen Swinsburg [EMAIL PROTECTED] wrote: Heres the perl equivalent: #!/usr/bin/perl -w # # script to process all mp3 files under a given directory or directories # use File::Find; no warnings 'File::Find'; #the @array holds the dirs you want to search, you can specify multiple dirs here or just one, #uncomment appropriate one [EMAIL PROTECTED] = (/path/to/your/directory/, /path/to/your/ directory2/); @directories_to_search = /path/to/your/directory/; find(\processFiles, @directories_to_search); #this function is called on every file and dir that is found under the sub processFiles() { #check if its a .mp3 file if ($_ =~ /(mp3)$/) { #the filename found is stored in $_ so we can use that directly $command = lame -b 64 -f -m s $_ stream_$_; $result = `$command`; } } On 04/08/2006, at 12:40 PM, Warren Toomey wrote: On Thu, Aug 03, 2006 at 06:29:12PM -0400, Ken wrote: such I've added code to re-encode mp3's as they are being uploaded, but all for the existing mp3's, is it possible in the Linux shell to use maybe grep or something to go though all the folders and re-encode every single mp3 one at a time using this command lame -b 64 -f -m s SongName.mp3 stream_SongName.mp3 Write a script called /tmp/z like this #!/bin/sh infile=$1 dir=`dirname $infile` base=`basename $infile` outfile=$dir/stream_$base lame -b 64 -f -m s $infile $outfile Make it executable, and test it with a single input file. Now apply it to the whole directory: find dir -name '*.mp3' -exec /tmp/z {} \; where dir is the top-level directory name. Cheers, Warren ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ Steve Swinsburg Programmer Teaching Learning Centre University of New England, Armidale, 2351 [EMAIL PROTECTED] t: +612 6773 2922 f: +612 6773 3269 ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder ___ mp3encoder mailing list mp3encoder@minnie.tuhs.org https://minnie.tuhs.org/mailman/listinfo/mp3encoder