dtown22
10/26/2007 10:50:00 PM
I don't like the idea of relocating variables, as I would like this
script to be as generic as possible...and I have thought of using a
temporary file, but not a big fan of it either.
None the less, thanks for trying to take a look at it. I don't much
understand why this doesnt work...and i will try to continue to play
around with it and see if i can come up with a combination which
works.
thanks again!
On Oct 26, 1:40 pm, "yer...@gmail.com" <yer...@gmail.com> wrote:
> On Oct 25, 3:58 pm, "dtow...@gmail.com" <dtow...@gmail.com> wrote:
>
>
>
> > I am trying to run a command line utility which converts a wma file to
> > a mp3 (i want to be able to do this for batch files) using FFMpeg &
> > LAME. I am trying to run the following command from ruby:
>
> > "C:\Documents and Settings\dt\Desktop\my stuff\songs\wma\ffmpeg.exe" -
> > i "C:\Documents and Settings\dt\Desktop\my stuff\songs\Who The
> > \Quadrophenia\07-0 - Who The - Love Reign O'er Me.wma" -vn -f wav - |
> > "C:\Documents and Settings\dt\Desktop\my stuff\songs\wma\lame.exe" -V
> > 6 - "C:\Documents and Settings\dt\Desktop\my stuff\songs\\Who The
> > \Quadrophenia\07-0 - Who The - Love Reign O'er Me.mp3"
>
> > It works perfect from the command line, but no matter how i try it
> > (with double quotes, single quotes, backticks, etc) it doesnt seem to
> > want to work from ruby
>
> > Here is an example of the code I have
>
> > ffmpeg = '"C:\\Documents and Settings\\dt\\Desktop\\my stuff\\songs> > \wma\\ffmpeg.exe"'
> > lame = '"C:\\Documents and Settings\\dt\\Desktop\\my stuff\\songs> > \wma\\lame.exe"'
>
> > newFile = child.sub('wma', 'mp3')
> > #cmd = ffmpeg + " -i " + child + " -vn -f wav - | " + lame + " -V 6 -
> > " + newFile
> > cmd1 = "#{ffmpeg} -i #{child} -vn -f wav - | #{lame} -V 6 -
> > #{newFile}"
> > puts cmd1
> > system(cmd1)
>
> > NOTE: child points to the same file wma file as above.
>
> > If i copy and paste the output of the puts command above into a
> > command window, it works fine...but from ruby, it seems to ignore the
> > pipe (|) command. I dont know if this is a windows issue, or if i am
> > missing something obvious. Any help is greatly appreciated.
>
> As far as I can tell, this is due to the way the Windows command
> interpreter handles double-quotes when a pipe is present along with
> the way Ruby's #system method calls the interpreter.
>
> >From a few tests I did, it seemed the leading double-quote was being
>
> stripped from the command line, but adding another did not fix the
> problem. I think you could fix it by either relocating your
> executables to a path with no spaces or using a temp file rather than
> a pipe. Maybe not optimal, but, like you, I fiddled with all sorts of
> single/double quotes and escaping and it didn't like any of it.