Hello friends, and just another time I have some ideas to do something using CONSOLE-ONLY-environment.
The scenario: As said, on console-ONLY, I want to play all the audio -===========- files in dir "/audio"
The formats: The formats are: .WAV .MP3 .S3M .MOD .XM, which can be -==========- easily played using mpg123, modplay and so forth.
The script: The script shall read out file names in "dir", one each -=========- and then play THAT ONE file like below for .MP3s and now the second problem: As soon as I insert an AUDiO CD into the CDROM, it shall detect that, stop playing
the list
(of course after finishing that very tune)
and then start
playing the inserted autio cd.
How to do this? Note like:
copy all filenames of dir "/audio" into
(1) read out ONE file name each from "playlist.tmp" check for file extension to determine format play it, for instance mp3blaster -f file.mp3 for .mp3 files check for "cd inserted???" if yes, play cd not inserted then go and read next one (1)
the structure should read ok. But I am no good at bash
file "playlist.tmp" programming,
who could help? Lawson? You there?
#!/bin/bash #Script Created by Thomas Adam #Declare Variables...... TMP=/tmp/audiofiles.tmp #Change to dir and copy all files to cd /audio #Touch temp file touch $TMP #copy all filesnames to temp list echo $(ls *.MP3 *.WAV *.S3M *.MOD *.XM) >> $TMP #Now for each file, play them using the commands.... while read audiofiles; do case $audiofiles in *.MP3 ) mp3blaster -f $audiofiles ;; *.WAV ) mp3blaster -f $audiofiles ;; *.S3M ) mp3blaster -f $audiofiles ;; *.MOD ) mp3blaster -f $audiofiles ;; *.XM ) mp3blaster -f $audiofiles ;; esac done < /tmp/audiofiles.tmp ----------------------------------------------------------- The above script should work for playing the files in "/audio". N.B. You'll have to substitute the name of the program if it does not support the types listed above. I shall have to think how'll you'll check for CD Insertion. I get the feeling that you might have to write a "C" function for that. I cannot think of a way of using BASH for this. N.B. Also, this script is off the top of my head, and I have not had time to test it. HTH, Thomas Adam