Launching mplayer from within Links2 using a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Launching mplayer from within Links2 using a shell script
# 1  
Old 10-25-2018
Launching mplayer from within Links2 using a shell script

I'm using the Links2 console web browser in graphical mode (the "-g" argument), and launching a shell script
that invokes MPlayer from within it. MPlayer works fine. No problem there. The problem, is that I have no
control over the MPlayer process. I would like to be able to exit MPlayer whenever i'd like, without having to
press Ctrl-C. Which terminates both MPlayer and Links2. It seems whenever I input anything on the keyboard,
it affects Links2, rather than MPlayer. Below is my shell script.

Thank you for your time.

Code:
#!/bin/sh

#save videos here
viddir=/root/video

killall mpg123; killall mplayer; killall movgrab

vidlink=$(sed -e s/https/http/g ${1} | head -1)
vidname=$(echo ${vidlink} | cut -d "=" -f 2)
viddata=`movgrab -st 30 -T ${vidlink} -o - 2>&1`
vidtitle=$(echo ${viddata} | grep "TEST MODE" | cut -d "'" -f 2)

mkfifo /tmp/vidfifo
vidname=/tmp/vidfifo

format=3gp:400x240

available=$(echo ${viddata} | grep -e ${format})

if [ -z "$available" ]; then
    format=3gp:176x144
fi


(movgrab -q -st 30 -b -f $format ${vidlink} -o ${vidname} 2>/dev/null &) &

  mplayer -vo fbdev "${vidname}"

killall movgrab; rm "${vidname}"


Last edited by ignatius; 10-26-2018 at 12:15 PM..
# 2  
Old 10-26-2018
It might be as simple as mplayer -vo fbdev "${vidname}" < /dev/tty > /dev/tty to give it access to the terminal.
# 3  
Old 10-26-2018
Thank you for that. But, it doesn't appear to be working. I think the problem may be that i'm running LInks2 in SDL mode. And I am unable, for some reason, to run it with
Code:
-driver fb

.

Last edited by ignatius; 10-26-2018 at 02:24 PM..
# 4  
Old 10-26-2018
If you don't have a console, you won't have a keyboard.

I take it you're running without any window manager or proper console device. The main reason we have those is to share the screen and keyboard with different programs. Operating without means it comes down to whatever SDL driver you're using and whatever it's communicating with.

So you'll probably have to tell us a lot more about what you're doing Smilie Sorry.

Last edited by Corona688; 10-26-2018 at 04:44 PM..
# 5  
Old 10-26-2018
Ok. First of all, thank you for not being a jerk. Like _a lot_ of people on stackoverflow.com or unix.stackexchange.com.. It's appreciated. I'm actually running this script off of a
Zipit Z2 (a very cool palmtop computer). At the moment, i'm running Debian "Wheezy" on it. With a lot of custom modifications. Anyway... No, I do not run any kind of
window managers or anything GUI-like on it. I use the console on it, for everything. I actually compiled Links2 with an SDL patch. To allow SDL screen rendering. Which is nice,
but, at the same time detrimental. In that, programs like chvt do not work. So, i'm stuck using the current console, or TTY. However you look at it. Ultimately, what i'd like to
achieve, is launching MPlayer from Links2, to watch YouTube videos. It works in its current state, it's just that, like I said, I have no keyboard control over MPlayer at all.
I've done a bit of research, and it seems that the best way to approach this, is to use fifos. I know there has to be an easier/better way than that. I guess redirecting things to STDIN
doesn't work. Probably, again, the SDL issue. So, yes, i'd like to control MPlayer from the current console within Links2. I hope i'm being assertive enough here.
If you need any more information, please don't hesitate to ask me.

Thank you.
This User Gave Thanks to ignatius For This Post:
# 6  
Old 10-28-2018
SDL is a go-between library which supports a lot of different backends, so it's not that helpful to know you're using SDL. I'm guessing SDL is ultimately using raw framebuffer or something like it here. If you can tell me what exact graphics module SDL is using internally that'd be great, I can look that up and find out if it has any relevant options.

Are you saying chvt doesn't work in links? Or doesn't work in mplayer? Or both?

does chvt work when you run mplayer manually, as opposed to links running it?

mplayer and links should probably be in different virtual terminals. Without a WM, graphics can't really share.

Either way it'll be a kludge, either to shoehorn some sideband input into mplayer, or to push it onto a different terminal and switch your terminal to it.

Last edited by Corona688; 10-28-2018 at 02:57 PM..
# 7  
Old 10-30-2018
I have no idea which backend it is using. But, yes, it is using the framebuffer. Links2 is compiled against SDL, which uses the framebuffer device.
chvt doesn't work in Links2, no. Not within Links2 in SDL mode, at least. Yes, it works when running MPlayer manually. Yes, exactly. That's the problem... it doesn't change to another terminal to run MPlayer. That's my problem. I'm currently investigating ways of working around this SDL limitation, which i'm assuming it is. I'm trying to get Links2 to run in "fbdev" mode, as opposed to SDL mode. DirectFB is not an option, because it requires that the screen be rotated. Which the version i'm using doesn't support. And, it's too much of a hassle to compile the new/updated source code. I hope this information is sufficient.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Statement returning error only launching the sh script via crontab

hi all, I created a sh script to import some tables from mysql to hive. No problem launching it manually, but if I schedule via crontab it returns me an error in the following part: #create an array containing all the tables for $dbname query="SELECT table_name FROM information_schema.tables'... (10 Replies)
Discussion started by: mfran2002
10 Replies

2. UNIX for Advanced & Expert Users

[Solved] Crontab not launching script

Hi all, i have the following script #!/bin/sh for i in `ps -leaf --cols 1024 | grep LogUser | grep -v grep | awk '{print $4}'`; do echo $i kill -15 $i; done; but it seems that the crontab its sciping this script,i configured corntab as following */30 * * * root... (2 Replies)
Discussion started by: charli1
2 Replies

3. Red Hat

Help in launching firefox.

Hi, -- I am new to linux, please bear with my tech terms. I am using Red Hat 4.1.2-48 (Linux version 2.6.18-194.11.1.el5) for the project. This is a remote server and I do not use any GUI. Now I need to install a product that requires me to launch firefox from linux. when i am trying... (3 Replies)
Discussion started by: vj8436
3 Replies

4. OS X (Apple)

[Solved] links2 --enable-graphics from source, configure error: no graphics driver found.

Howdy I am trying to install links2 with graphics support on snow leopard 10.6.8 (xcode installed). I have had the program running last year, also installed from source - but then I had installed some image libraries with mac ports and fink - cannot reproduce that setup. Plus I would like to not... (6 Replies)
Discussion started by: butterbaerchen
6 Replies

5. Shell Programming and Scripting

Launching shell from another

hi, I have shell script ( say A.sh) that launches another shell script ( say B.sh) on the server. In shell script A.sh, if i call B.sh as . B.sh <-- it doesnt work, err file not found . ./B.sh <-- it doesnt work, err file not found ./B.sh <-- works why so? BTW the file exists at the... (4 Replies)
Discussion started by: sjc
4 Replies

6. Shell Programming and Scripting

Launching shell scripts from different dirs

Hi, General question, if I have a shell script whcih I launch from anywhere on the system vis the PATH env var, how can I get the script to echo where I launch this from? i.e. /my/home/script/myscript BUT I launch this from /my/otherarea/somewherelse via the env variable. I would... (1 Reply)
Discussion started by: cyberfrog
1 Replies

7. Shell Programming and Scripting

Launching a C program that needs input from a shell script

hi there, i need some help, i am trying to run a script to launch a C program and a Java program but before running both I want to get a user input and then invoke both programs with input received. In the programs the inputs are not command line arguments. This is the code, after the java... (4 Replies)
Discussion started by: momal
4 Replies

8. UNIX for Dummies Questions & Answers

launching script via REXEC

Hi folks! my client uses an winapplication which is launching shell-scripts remotely on a HP-Unix Machine via Rexec. The application-configuration is launching the script (which is in the home directory of connecting user) like: rexec host user pass shell.sh So far so good, everything... (3 Replies)
Discussion started by: JohnMurdoch
3 Replies

9. Shell Programming and Scripting

Launching Several Shells....

Hi, I need to create a shell that launches several shells named for example svspush (that does nothing but wait) and record their pid in a file. Any inputs please. Thanks, Marconi (1 Reply)
Discussion started by: marconi
1 Replies

10. Shell Programming and Scripting

Launching a new bash shell

I'm new to programming on unix and have a really simple question (google hasn't been my friend today). I have a bash shell running on a remote machine. I'm looking at it from a windows PC using Exceed. Is there a command I can use from the shell which will launch another bash shell? Thanks! (3 Replies)
Discussion started by: gsd
3 Replies
Login or Register to Ask a Question