
Hi Aristotle. It was very generous of you to take so much time over "my" script, which, as I mentioned earlier, was almost entirely a mere cobbling together by me of bits and pieces which I'd taken from others. Given that you'd created an alternative script, I took the liberty of trying it out. Having saved it and made it executable by all, I then tried to run it in a terminal window. The directory in which I was when I did so contained two .wma files, Beethoven1.wma, which was a re-named file I'd copied over from my Windows computer, and Beethoven2.wma, which was just a copy of Beethoven1.wma, created so that I could test what happened when I tried to convert multiple files from wma to mp3. This is what happened. I got the following output: "Beethoven1.wma => Beethoven1.wma.wav Could not find "Beethoven1.wma.wav". Beethoven2.wma => Beethoven2.wma.wav" and then the graphical representation of the xmms player appeared on the screen, without any activity being apparent. After some time when nothing had happened, I tried to close that representation, but its close box wouldn't respond. I then closed the terminal window, upon which the xmms window closed too. I then opened xmms and checked the output plugin situation. I found that the output plugin was Disk Writer, which I'd expected, since the script hadn't had the chance to restore the OSS plugin. If what I've reported above suggests to you some tiny glitch in your script and you don't feel that you've spent too much time on it already, I'd be grateful to hear what amendment should be made to it. Best wishes, Leslie

Hi Leslie, * Leslie Katz <lesliek(a)ozemail.com.au> [2006-05-24 09:10]:
I got the following output:
"Beethoven1.wma => Beethoven1.wma.wav Could not find "Beethoven1.wma.wav". Beethoven2.wma => Beethoven2.wma.wav"
Yes well, there’s a typo: I wrote `base="${src%.wmv}"` in the script. Can you spot the mistake? :-)
I then opened xmms and checked the output plugin situation. I found that the output plugin was Disk Writer, which I'd expected, since the script hadn't had the chance to restore the OSS plugin.
But there was a pristine `.orig` copy of the config, no? Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>

A. Pagaltzis wrote:
Hi Leslie,
* Leslie Katz <lesliek(a)ozemail.com.au> [2006-05-24 09:10]:
I got the following output:
"Beethoven1.wma => Beethoven1.wma.wav Could not find "Beethoven1.wma.wav". Beethoven2.wma => Beethoven2.wma.wav"
Yes well, there’s a typo: I wrote `base="${src%.wmv}"` in the script. Can you spot the mistake? :-)
I thought at first that it was that wmv should have been wma, but when I made that change, the script still wouldn't work, so I have to confess that I just can't spot it. What I know I have to do, when your script is working, is to try to work out exactly what it does. It'll be just as if I were reading a book in French with a French-English dictionary beside me, looking up every word one at a time. Instead, I'll be looking up braces and ampersands!
I then opened xmms and checked the output plugin situation. I found that the output plugin was Disk Writer, which I'd expected, since the script hadn't had the chance to restore the OSS plugin.
But there was a pristine `.orig` copy of the config, no?
Oh yes, there was no problem about that at all. In fact, I'd even saved a copy of it somewhere else on the system before doing anything else.
Regards,
Thanks for your patience in all this and best wishes, Leslie

* Leslie Katz <lesliek(a)ozemail.com.au> [2006-05-24 10:50]:
I thought at first that it was that wmv should have been wma, but when I made that change, the script still wouldn't work, so I have to confess that I just can't spot it.
That was indeed what I was talking about. It still won't work? What does "doesn't work" mean, precisely -- what is it doing and how is that wrong? Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>

A. Pagaltzis wrote:
* Leslie Katz <lesliek(a)ozemail.com.au> [2006-05-24 10:50]:
I thought at first that it was that wmv should have been wma, but when I made that change, the script still wouldn't work, so I have to confess that I just can't spot it.
That was indeed what I was talking about. It still won't work? What does "doesn't work" mean, precisely -- what is it doing and how is that wrong?
Regards,
Well, I made that sole change to the script and did exactly what I did before. The output I got this time was as follows: Beethoven1.wma => Beethoven1.wav Could not find "Beethoven1.wav". Beethoven2.wma => Beethoven1.wav Could not find "Beethoven2.wav". and then the prompt. During that process, I thought I saw, for the briefest moment, the xmms window open and close. Also, when I afterwards checked the directory in which the two wma files were, I found, in addition to the two wma files (each of which is 599.26 Kbytes in size), two wav files, Beethoven1.wav and Beethoven2.wav. The first of those files was said to be 44 bytes in size and the second 144.04 Kbytes in size. That's all the information I'm able to report.

Hi Leslie You might want to add the following to the start of the script to help debug set -x ie #!/bin/bash set -x CFG=~/.xmms/config and so on Then run the script Regards Simon Leslie Katz wrote:
A. Pagaltzis wrote:
* Leslie Katz <lesliek(a)ozemail.com.au> [2006-05-24 10:50]:
I thought at first that it was that wmv should have been wma, but when I made that change, the script still wouldn't work, so I have to confess that I just can't spot it.
That was indeed what I was talking about. It still won't work? What does "doesn't work" mean, precisely -- what is it doing and how is that wrong?
Regards,
Well, I made that sole change to the script and did exactly what I did before.
The output I got this time was as follows:
Beethoven1.wma => Beethoven1.wav Could not find "Beethoven1.wav". Beethoven2.wma => Beethoven1.wav Could not find "Beethoven2.wav".
and then the prompt.
During that process, I thought I saw, for the briefest moment, the xmms window open and close.
Also, when I afterwards checked the directory in which the two wma files were, I found, in addition to the two wma files (each of which is 599.26 Kbytes in size), two wav files, Beethoven1.wav and Beethoven2.wav. The first of those files was said to be 44 bytes in size and the second 144.04 Kbytes in size.
That's all the information I'm able to report.
_______________________________________________ wlug mailing list | wlug(a)list.waikato.ac.nz Unsubscribe: http://list.waikato.ac.nz/mailman/listinfo/wlug

* Leslie Katz <lesliek(a)ozemail.com.au> [2006-05-24 11:20]:
Well, I made that sole change to the script and did exactly what I did before.
The output I got this time was as follows:
Beethoven1.wma => Beethoven1.wav Could not find "Beethoven1.wav". Beethoven2.wma => Beethoven1.wav Could not find "Beethoven2.wav".
and then the prompt.
Strange. I guess quitting and restarting XMMS constantly is inevitable. #!/bin/bash CFG=~/.xmms/config mv "$CFG" "$CFG".orig || { echo "Couldn't back up $CFG" 1>&2 ; exit 1 ; } sed 's/libOSS.so/libdisk_writer.so/g' "$CFG".orig > "$CFG" for src in *.wma ; do base="${src%.wmv}" temp="$base".wav echo "$src => $temp" xmms "$src" while xmmsctrl playing ; do sleep 1 ; done xmmsctrl quit lame "$temp" "$base".mp3 && rm "$temp" done mv "$CFG".orig "$CFG" Say, do you have MPlayer? That would make things much simpler, since you could decode files without monkeying with an X11 application that wasn’t intended for non-interactive use: #!/bin/bash for src in *.wma ; do base="${src%.wmv}" temp="$base".wav echo "$src => $temp" mplayer -really-quiet -novideo -ao pcm:filename="$temp" "$src" \ && lame "$temp" "$base".mp3 \ && rm "$temp" done Which makes me think, you can make either incarnation of the script more useful by changing the loop to the following: for src in "$@" ; do base="${src%.*}" You can then invoke it explicitly with a list of filenames, eg. if the script is called `to-mp3`, you’d say `to-mp3 *.wma`. By chaning `${src%.wma}` to `${src%.*}`, it will remove *any* extension from the file, regardless of what it is, so you can also say `to-mp3 *.ogg *.ra` to convert Ogg Vorbis and RealAudio files (well, XMMS can’t play RealAudio, but MPlayer can). Carter’s Compass: I know I’m on the right track when by deleting something I’m adding functionality. (Okay, in this case, it wasn’t really any deletion, but in most cases I’ve found that scripts and utilities become more useful the more code you delete outside the invariants.) Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>
participants (3)
-
A. Pagaltzis
-
Leslie Katz
-
Simon Annear