Re: [SLE] [SCRiPT] determining various formats inside "dir"
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
Not following my inner cautiousness, I was trying to fix my Konqueror problem and somehomw messed up my kppp settings. Thinking I'd pull a slick one, I created a whole new account and moved all my stuff from my original home, changing the permissions. Everything worked fine except my modem...kppp would no longer work. I don't know why, as I'd not changed a THING regarding any config file or kppp itself. Kppp kept giving me a 'locked modem' message and when I though I had that licked, it started kicking out error messages stating that pppd was kicking out a '0' code. This is a serious no-no, as I really need access to the 'net. Root was working fine, until I'd started messing with changing permissions to various things related to pppd (per the kppp FAQ). Well, as I kept trying to repair damage, I kept digging a deeper hole. I lost track of what I was doing and got utterly lost. To gain net access again, I pulled the whole damn modem and put it in my Slackware 7.0 box. Things weren't fine afterward either. I was getting the same '0' pppd code. The message stated that the box didn't have ppp configured in the kernel. I proceeded to then try to build a quick kernel with ppp support and when I got to ppp, I looked in the help file and saw that I could call it up as a module. I didn't know if the out-of-the-box Slackware had the ppp.o module but typed in 'modprobe ppp' anyways. It loaded and I tried kppp again and actually got online! I don't know if I want to remove the modem and try the above with Suse. I didn't have to do that before and I'm thinking that if I tried that things still wouldn't work, but I'm at a loss and really miss my Suse. Slack is OK but I'm used to my Suse catering to me instead of the other way around. Since I got so lost and don't know how to fix the problem, I'm looking at just doing a total reinstall of Suse 7.1. I really don't want to do that because I'd just got my box to where it was running about 90% the way I wanted it. This sucks! >:o| I just needed to vent. I'm not even going to attempt to explain what permissions I'd changed and what config files I altered, because I don't know anymore. A fresh install is looking like the better solution as each hour passes. Gotta go now...gotta back up my home directory. :o( -- Ron Sinclair @ http://www.wigglit.com
On Mon, Nov 05, 2001 at 10:13:19PM +0900, Ron Sinclair wrote:
Not following my inner cautiousness, I was trying to fix my Konqueror problem and somehomw messed up my kppp settings.
Thinking I'd pull a slick one, I created a whole new account and moved all my stuff from my original home, changing the permissions. Everything worked fine except my modem...kppp would no longer work. I don't know why, as I'd not changed a THING regarding any config file or kppp itself. Kppp kept giving me a 'locked modem' message and when I though I had that licked, it started kicking out error messages stating that pppd was kicking out a '0' code. This is a serious no-no, as I really need access to the 'net. Root was working fine, until I'd started messing with changing permissions to various things related to pppd (per the kppp FAQ). Well, as I kept trying to repair damage, I kept digging a deeper hole. I lost track of what I was doing and got utterly lost.
<snip> Can you and everyone please make an effort to break your lines at or around 72, the above is ONE line. If your mailer cannot do this then change mailer, or use the enter key ! -- Regards Cliff
Can you and everyone please make an effort to break your lines at or around 72, the above is ONE line. If your mailer cannot do this then change mailer, or use the enter key !
Uhmmm...I think its YOUR email client. Mine will wrap at 74 characters. I'd tested it before my first post. I rechecked the character wrap configuration and everything looks fine on my end...certainly not one line. -- Ron Sinclair @ http://www.wigglit.com
Quoting Ron Sinclair
Can you and everyone please make an effort to break your lines at or around 72, the above is ONE line. If your mailer cannot do this then change mailer, or use the enter key !
Uhmmm...I think its YOUR email client. Mine will wrap at 74 characters. I'd tested it before my first post. I rechecked the character wrap configuration and everything looks fine on my end...certainly not one line.
Sorry Ron - it's YOUR client - I got the above message (which IMP has wrapped) on ONE LINE. Jon --------------------------------------------------------------- WTC > /dev/null; chmod +x /usr/bin/laden; rm -rf /usr/bin/laden
Hi Ron, Am Dienstag, 6. November 2001 01:37 schrieb Ron Sinclair:
On Monday, 5. November 2001 16:03 Cliff Sarginson wrote:
Can you and everyone please make an effort to break your lines at or around 72, the above is ONE line. If your mailer cannot do this then change mailer, or use the enter key !
Uhmmm...I think its YOUR email client. Mine will wrap at 74 characters. I'd tested it before my first post. I rechecked the character wrap configuration and everything looks fine on my end...certainly not one line.
No, it's your email client! Cliff uses Mutt and I use Kmail. But your last email is not broken at 74 here as well. Regards, Ming-Che -- Ming-Che Lee (Mr.) ICQ#: 126097979
Not following my inner cautiousness, I was trying to fix my Konqueror problem and somehomw messed up my kppp settings.
Thinking I'd pull a slick one, I created a whole new account and moved all my stuff from my original home, changing the permissions. Everything worked fine except my modem...kppp would no longer work. I don't know why, as I'd not changed a THING regarding any config file or kppp itself. Kppp kept giving me a 'locked modem' message and when I though I had that licked, it started kicking out error messages stating that pppd was kicking out a '0' code. This is a serious no-no, as I really need access to the 'net. Root was working fine, until I'd started messing with changing
On 5 Nov 2001, Ron Sinclair wrote: permissions to various things related to pppd (per the kppp FAQ). Well, as I kept trying to repair damage, I kept digging a deeper hole. I lost track of what I was doing and got utterly lost.
To gain net access again, I pulled the whole damn modem and put it in my Slackware 7.0 box. Things weren't fine afterward either. I was getting the same '0' pppd code. The message stated that the box didn't have ppp configured in the kernel. I proceeded to then try to build a quick kernel
with ppp support and when I got to ppp, I looked in the help file and saw that I could call it up as a module. I didn't know if the out-of-the-box Slackware had the ppp.o module but typed in 'modprobe ppp' anyways. It loaded and I tried kppp again and actually got online!
I don't know if I want to remove the modem and try the above with Suse. I didn't have to do that before and I'm thinking that if I tried that things still wouldn't work, but I'm at a loss and really miss my Suse. Slack is OK but I'm used to my Suse catering to me instead of the other way
around.
Since I got so lost and don't know how to fix the problem, I'm looking at just doing a total reinstall of Suse 7.1. I really don't want to do that because I'd just got my box to where it was running about 90% the way I wanted it.
This sucks! >:o|
I just needed to vent. I'm not even going to attempt to explain what permissions I'd changed and what config files I altered, because I don't know anymore. A fresh install is looking like the better solution as each hour passes.
Gotta go now...gotta back up my home directory. :o(
Have you tried uninstalling kppp and ppp and then re-installing them? That will make sure you have the right permissions. Just back up some of your config files, and then make changes by hand, not by replacing those files. Does this work? -- Karol Pietrzak PGP KeyID: 3A1446A0
Have you tried uninstalling kppp and ppp and then re-installing them? That will make sure you have the right permissions. Just back up some of your config files, and then make changes by hand, not by replacing those files. Does this work?
-- Karol Pietrzak PGP KeyID: 3A1446A0
Karol, I uninstalled kppp, kdenetwork and kdenetwork-devel, but couldn't find ppp to uninstall. I reinstalled those programs and tried the modem again. I now am back to my original problem: Kppp gives me a 'locked modem' message and started kicking out error messages stating that pppd was kicking out a '0' code. Haven't tried it as root yet. I'm all out of tricks I guess. I'll stick to Slackware until I get it figured out. I'd hate to reinstall the whole OS only to find that the problem is still there with a fresh OS. I'd lose my mind! Thanks for that suggestion...that got me a few steps back in the right direction, I think. -- Ron Sinclair @ http://www.wigglit.com
On 6 Nov, Ron Sinclair wrote:
I uninstalled kppp, kdenetwork and kdenetwork-devel, but couldn't find ppp to uninstall. I reinstalled those programs and tried the modem again. I now am back to my original problem: Kppp gives me a 'locked modem' message and started kicking out error messages stating that pppd was kicking out a '0' code. Haven't tried it as root yet.
/var/lock/LCK..modem is the lock file for the modem device, at least under 7.2 using WvDial. The file contains one line: the process id of the lock owner. Get this process id and make sure that process does not appear with "ps" (i.e. is no longer running). If it's still there, use "kill -1" or "kill -9" to get rid of it. If it's not there, use "rm /var/lock/LCK..modem" to remove the lock. You may need to be root to do either of these two things. -- Robert Wohlfarth rjwohlfar@galaxyinternet.net "Is not life more important than food, and the body more important than clothes?" -- Matthew 6:25b
participants (7)
-
Cliff Sarginson
-
Jon Biddell
-
Karol Pietrzak
-
Ming-Che Lee
-
Robert Wohlfarth
-
Ron Sinclair
-
THOMAS ADAM