Multimedia :: setting up "mp3 box" using mpg123



hi!

i just installed DSL on a little maschine without any IDE devices, so its runnig from USB, booted from floppy disk. soundcard and network card plugged in, for the moment a graphic card is installed to, will be removed after configuration. Well, what i want to do now, is write a script to read pressed keys and control mpg123, in the way that the script reads all mp3s from a predefined folder, and when i press, lets say, the "P" key, it starts playing the first one, on key press "N" the next one in the directory.

i searched a bit and also found something that worked on my main maschine, but it uses "screen" that is not avaible on DSL

so i aks you, do you have any idea how this could be made??
i hope so :P

Greetings ShiZzl3

-------------
PS: i'm not running X, if it is for any interest
PS2: i'm german, so i apologize for my bad english :P

sudo su
apt-get install screen

Or maybe start up Synaptic and choose to install screen.

I've made a screen.dsl you can find it under mydsl->wm_apps. It works for me. I'm using it also for a headless mp3-box. But I use it to control via ssh a program called mp3blaster. With screen I don't have to keep a session open. If you succeed to let your script work on dsl I'll be interessed.
i finally gave up trying to  find a solution with mpg123...it would be too much scripting work at all...although i managed to install screen,thx for the mydsl plugin!

even if i didnt want to take it cause of my old maschine, i installed the mplayer.dsl and wrote a very simple script to create a playlist for it. mplayer itselfs includes everything i need like play/pause, skip and volume controls via keyboard.

so i put this script into $PATH and are now able to search mp3s and play them or whole folders etc.
Code Sample
#check if one commandline option is given, else exit
if [ -z "$1" ]; then
echo usage: $0 directory [searchstring] [shuffle] [add]
exit
fi

#Pre define Folder and NULL files
DIR=$1

#check if searchstring is * , cause * cant be as normal opperator, must be Space
if [ "$2" = "*" ];then
SS=""
else
SS=$2
fi

FILES=""

#get mp3 file list
if [ "$4" = "add" ];then # if add=true,add to preexisting file, else create new one
find $DIR -name \*$SS*.mp3 >> files.txt
else
find $DIR -name \*$SS*.mp3 > files.txt
fi

#create string to hand over to mplayer though handing over filelist wont work
while read FILENAME
do
 FILES=$FILES" "$FILENAME
done < files.txt

#execute mplayer with found files
if [ "$3" = "shuffle" ];then #shuffle requested??
mplayer -z $FILES
else  
mplayer $FILES
fi

and yes..i found some very interestings frontends for mpg123 that looked quite the same than your mp3blaster, but the problem is that i want to use it headless, and without another maschine, so i want to control it without seeing any graphical output...thats why such a frontend doesnt work for me.

thx for your help...i think i will install mp3blaster , too.....for later use maybe :P

Greetz
ShiZzl3

PS: dont wonder about the script, its not perfect at all...i started writing scripts in bash some days ago :D

Ik think you can use mp3blaster without seeing anything. Just remember that "5" is play and "6" is next and ">" is volume up. But how do you create your playlist without seeing what you're doing? I never wrote a bash-script so maybe I just don't understand the sript. I think what you're trying is the same as I've in mind with my mp3box. So I hope you can keep me informed about your progress?
Next Page...
original here.