-
Senior Member
registered user
help with menu script
I need help making a simple MENU which contains choices of 5 streaming audio websites to play via MPLAYER using the KONSOLE.
I have a sub-directory in /home called "streamscripts" which contains 5 script files. They are "cbc.sh" "rock.sh", "rock2.sh", "jazz.sh", and "jazz2.sh".
I bring up konsole, type in, for example "./ jazz.sh" and mplayer starts and goes to the URL for that particular jazz music stream. It loads and then plays. I quit by typing a "Q"......
I would like a very simple menu, similar to this:
"What would you like to hear?"
------------------------------------
jazz
jazz2
rock
rock2
cbc
-----------------------------------
And thats about as far as I can figure.....how do I call the chosen script from the "streamscripts" directory? If I chose "jazz" for example, how do I associate the menu choice to the actual script file? I can do this in DOS easily but do not know how to do it in LINUX!
Please help! bob
-
Senior Member
registered user
Refer to your last post. I already show you how to create script to invoke xmms.
I have a sub-directory in /home called "streamscripts" which contains 5 script files. They are "cbc.sh" "rock.sh", "rock2.sh", "jazz.sh", and "jazz2.sh".
You don't have to put that .sh extension. If you do put it, you only able to run it from konsole. You only need to name it as cbc, rock, jazz and jazz2; and make that file executable.
If you do this way, you can easily create a menu and submenu using menu editor.
ex:
save that file as music in your home/streamscript/.
Right click on that file----->properties------->permission-->tick executable.
Better use xmms because that script will open xmms.
If you use mplayer, it will run in background and you will have dificulty to quit mplayer unless you use kill command.
Then open menu editing tools and create your own menu with all the submenu you want....you can even set it to run in tray.
-
Senior Member
registered user
I think he wants a script that will hsow a menu of the options, then start what he wants to hear.
-
Senior Member
registered user
I don't have a script, but this little C program should do the trick.
Code:
#include <stdio.h>
main()
{
int pick;
system("clear");
while(1)
{
pick=0;
printf("\"What would you like to hear?\"\n");
printf("------------------------------------\n");
printf("1 - jazz\n");
printf("2 - jazz2\n");
printf("3 - rock\n");
printf("4 - rock2\n");
printf("5 - cbc\n");
printf("6 - quit\n");
printf("------------------------------------\n");
scanf("%d",&pick);
switch(pick)
{
case 1:
system("xmms http://jazz adress");
exit(1);
break;
case 2:
system("xmms http://jazz2 adress");
exit(1);
break;
case 3:
system("xmms http://rock adress");
exit(1);
break;
case 4:
system("xmms http://rock2 adress");
exit(1);
break;
case 5:
system("xmms http://cbc adress");
exit(1);
break;
case 6:
exit(1);
break;
default:
printf("Enter a choice from above.\n\n\n");
sleep(1);
exit(1);
}
}
return(0);
}
Save it as music.c and then change the xmms http://something adress to whatever command you use to open up the music in your scripts. Or you could change it to your scripts. ex: /home/user/jazz.sh
Then save and type
cc music.c in the same directory as the file.
You'll probably get something called a.out Change the name to you suiting.
Then just open a terminal and type the name.
(Anyone know how to just click on it to make it work?)
-
Senior Member
registered user
help with script
WOAH!!!! I will try to attempt to do what firebird and shah suggested.....looks pretty deep to me, but I will give it a shot. I will use xmms instead of mplayer....good idea. and i thought a script file had to have the "sh" extension to work? I can make the files executable without the "sh" extension? OK I will try that......I will post back in couple days to let you know how I did...thank you for good ideas...bob
-
Senior Member
registered user
Re: help with script

Originally Posted by
bob58
WOAH!!!! I will try to attempt to do what firebird and shah suggested.....looks pretty deep to me, but I will give it a shot. I will use xmms instead of mplayer....good idea. and i thought a script file had to have the "sh" extension to work? I can make the files executable without the "sh" extension? OK I will try that......I will post back in couple days to let you know how I did...thank you for good ideas...bob
Yea, its more complicated then it looks, most of the stuff can be figured out even if you don't know C though.
-
Senior Member
registered user
scripts
OK I tried what Firebird suggested but it would not work.....I did as you suggested, saved the file as music.c and saved it in the same directory as my script files.....i typed cc music.c and the response i get is: music.c:1: include file 'stdio.h' not found. There is a reference to 'stdio.h' at top of file.
Then I did it again and it came back: bash: music.c: command not found
I entered in the URL's of each of the streaming audio sites like you said.....in the file you sent.
So maybe i did something wrong? bob
-
Senior Member
registered user
Very weird, knoppix should include the header files.
What version are you useing.
-
Senior Member
registered user
I did try firebird10 C code and it works.
It will create a.out executable.
Create an application link to this file on desktop and in advanced tab, tick run in terminal. This way you can just click.
The problem is, when you close the konsole, xmms will close too, vice versa..
Bob...can you share the link? The first one is very nice....
-
Senior Member
registered user
I am using KNOPPIX version 3.7
I don't understand why that program wouldnt run. Maybe 3.7 has a problem with it. I can try it again tonite when i get home from work. I do have version 3.4 on my desktop....maybe i will try to run the C program on that computer. I will post back later with results....thanks for the help
...bob
Similar Threads
-
Replies: 13
Last Post: 05-26-2006, 03:35 PM
-
By maxmartin in forum Customising & Remastering
Replies: 0
Last Post: 02-19-2006, 06:19 PM
-
By garyng in forum General Support
Replies: 3
Last Post: 06-05-2004, 03:51 AM
-
By fab1976 in forum General Support
Replies: 2
Last Post: 01-29-2004, 04:37 AM
-
By Sigmatador in forum Customising & Remastering
Replies: 5
Last Post: 04-10-2003, 10:02 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

KNOPPIX 9.1 Linux Install & Live DVD 32bit & 64bit
$19.99

Windows XP, Vista, 8.1, Linux Knoppix, Office XP, (6 CDS)
$12.00

KNOPPIX USB DVD OS , BEST OF ALL HIGHLY RECOMENDED
$11.99

Knoppix Live GNU Linux System 9.1 on Bootable CD / DVD / USB Flash Drive
$5.99

Knoppix NSM 1.2
$8.00

VINTAGE SOFTWARE | KNOPPIX STD 0.1 (SECURITY TOOLS DISTRIBUTION)
$7.97

Hamshack Live DVD-ROM
$7.00

Vintage Linux DVD - Knoppix 5.2 - c't Magazine - 7 / 2007 - Software Collection 2
$8.03

Knoppix 5.0.1 ULTRA RARE Linux DVD - Linux Pro Extra August 2006
$34.38