DSL Ideas and Suggestions :: XMMS Improvements



I think it is related to that, since xmms needs to be finished with its business before you should kill it, but I don't know how to get its pid without backgrounding it.


Code Sample
xmms "$i" &
xmmspid=$!
wait for xmms to finish writing (how to tell?)
kill $xmmspid

Does "pidof xmms" get xmms's pid(s) without backgrounding xmms?

I opened xmms by clicking on its icon on the desktop. I then opened a terminal, typed pidof xmms and pressed Enter and got as output: 1189 1190 1191 1192.

Of course, I may not be understanding what backgrounding is.

The kill-process.sh I mentioned earlier relied on pidof, but when I tried to adapt it, I got nowhere.

Quote (mikshaw @ May 22 2006,00:46)
Code Sample
xmms "$i" &
xmmspid=$!
wait for xmms to finish writing (how to tell?)
kill $xmmspid

I didn't know how to check when xmms finished writing and
that's why I suggested xmmsctrl and this little script:

Code Sample


#!/bin/sh

# check if xmms if running and quit if it is running
xmmsctrl running && xmmsctrl quit

<change output plugin command goes here>

if [ "$1" = "" ]; then
FILEDIR="path/to/wma/dir/or/single/wma"
else
FILEDIR="$@"

# launch xmms
xmmsctrl launch

# this command will load single file or files from a directory to xmms

xmmsctrl dir "$FILEDIR"
# multiple dirs : xmmsctrl dir BEGIN dir1 dir2 END
# maybe without BEGIN and END it'll also work

# now you have to tell xmms to start playing/converting
xmmsctrl play

# this loop checks if xmms is playing/converting
# and if yes it checks the playlist length in seconds
# and sleeps for that amount of seconds

while `xmmsctrl playing`
do
P=0
 for i in `xmmsctrl print "%*S%n"`  # checks the length of playlist in seconds
 do
   P=$(( P + $i ))
 done
sleep $P
done

# when the loop ends it means that xmms stopped playing/converting and now you can kill xmms with this command:

xmmsctrl quit

<restore config file command goes here>

# if you have xmmsctrl in your PATH environemental (?) variable
# you can add some lines to this script to change the xmms config file and it should convert your wma's

# You can also consider putting this somewhere in the beginning :

sed -i 's/shuffle=TRUE/shuffle=FALSE/;s/repeat=TRUE/repeat=FALSE/' ~/.xmms/config



I've also created some .tar.gz's with output plugins and xmmsctrl to install via mydsl, they can be found here

If someone finds them useful and can put them in a more persistant location, please do so.

Thank You for your attention :)

Quote (lesliek @ May 22 2006,01:28)
Does "pidof xmms" get xmms's pid(s) without backgrounding xmms?

I opened xmms by clicking on its icon on the desktop. I then opened a terminal, typed pidof xmms and pressed Enter and got as output: 1189 1190 1191 1192.

Of course, I may not be understanding what backgrounding is.

Backgrounding is necessary from a script if you need to continue on to do something else while the previous command is still running.  In this case, xmms must be put into the background (xmms &) so that the next command (pidof xmms) can run. Otherwise pidof will not run until xmms is closed, and then it's too late to get its pid.  You successfully got the pid when you did it manually because you opened a new shell while xmms was running, but you can't do that from a script unless you background xmms.  As I said before, xmms isn't the most appropriate tool with which to do a batch process, since it requires interaction with the user (unless you add more software as jot suggested).

jot: submit mydsl extensions to extensions(at)damnsmalllinux(dot)org

The penny's finally dropped for me about my trying to kill xmms. (I think I can hear, even here in Australia, mikshaw and jot both shouting "About bloody time!")

I've now got xmmsctrl installed, though I cheated a bit to do so. I downloaded an RPM containing it to my computer which runs Fedora. (The RPM was actually created for Mandriva.) I then extracted all the files from the RPM using a built-in extractor in Fedora. I found xmmsctrl among the extracted files and copied just that to my computer running DSL. It works.

With xmmsctrl working, I hope I'll be able to bring this saga to an end later today.

Once again, thanks to mikshaw and to jot.

Next Page...
original here.