This is my first post so there it goes 'Hello all'
lesliek if You wish I can help You with this script. Ok, so first thing, if You want to substitute the output plugin in 'config' file You can do it like this:
sed -i '/output_plugin/s/OSS/disk_writer/' /home/dsl/.xmms/config
then
xmms -p "$1"
when it ends You will have to close xmms manually
the next line :
lame "${1/wma/wav}" "${1/wma/mp3}"
to restore the old config :
sed -i '/output_plugin/s/disk_writer/OSS/' /home/dsl/.xmms/config
But i don't think you can fully automate it with just bare xmms... unless You use xmmsctrl , You can find rpm here: [url="http://rpm.pbone.net/index.php3/stat/4/idpl/1521354/com/xmmsctrl-1.8-1mdk.i586.rpm.html"]xmmsctrl RPMs[\url].
It gives you more commandline control over xmms.
I'll try to write a script with use of xmmsctrl and post it here.
If You have more questions, just ask.
@mikshaw : i know sed a bit , but the i option is new to me, and I'm glad You've mentioned it. Previousl I used:
sed 's/x/y' file > a ; mv a file
Now life will be easier Thanks
Quote (jot @ May 19 2006,18:30)
when it ends You will have to close xmms manually
Or you can add the command killall xmms to the script. This may be a harsh way to close it (i don't understand signals very well), but it works.Many thanks to both jot and mikshaw, whose posts I've just been able to read. I'm away from my DSL computer for the next 24 hours, but will get back to this as soon as I'm with the computer again.
LeslieWell, I've now had some time to play with this and have reached the following point:
#!/bin/bash
sed -i "s/libOSS.so/libdisk_writer.so/g" ~/.xmms/config
#process=xmms #t=`pidof $process`
for i in *.wma do filename=`basename "$i" .wma` echo "Ripping $i" xmms "$i" #kill $t killall xmms lame "${i/wma/wav}" "${i/wma/mp3}"
done
sed -i "s/libdisk_writer.so/libOSS.so/g" ~/.xmms/config
I already knew that the opening and closing lines worked properly to change the XMMS output plugin from OSS to Disk Writer and then back again and so I didn't try jot's alternative. I did, however, use his line for lame, changing the 1 to an i, since I'd already been using i.
The most serious problem I have with the rest of the script is that I can't yet stop XMMS from within the script. I tried mikshaw's suggestion of killall xmms (the way the script above is written). It didn't work for me.
I tried something else from a bash script I found on the Web called kill-process.sh, which I've commented out above, namely:
process=xmms t=`pidof $process` kill $t
It didn't work for me either and I don't understand enough about these things to know why not.
One other problem is less serious.
I'm left at the end of the process with three files, Beethoven.wma (a minute long extract I already had, which I'm using for test purposes), Beethoven.wav and Beethoven.mp3.
In his post, jot mentioned xmmsctrl. I had tried that, but with disastrous results. For a reason I've now repressed, I'd decided I couldn't try to get anything useful out of the rpm of it, so I thought I'd try to compile the source code. To do that, I needed to download a dsl (gcc?). After I'd done that and rebooted, I ran out of space while the extensions were being loaded at bootup and had to use a rescue disk to get rid of the new dsl before I could get things back on track.
I'd appreciate very much any advice about how I can stop xmms from within the script and also about how I can automatically get rid of any .wav files produced in the course of the conversion process.
Many thanks for the help already extended,
Leslie
PS As two of the lines in the script appear above, they're not quite correctly formatted. I can't figure out how to fix them in this post. Apologies for that.lame "${i/wma/wav}" "${i/wma/mp3}" && rm -f ${i/wma/wav}
I'm not sure why xmms is not closing. I know that getting the pid of an app before actually running it isn't going to work, but I don't know why killall doesn't force it to close.Next Page...
original here.