LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   xterm -e doesn't get associated with transfer protocol mms. (http://www.linuxquestions.org/questions/slackware-14/xterm-e-doesnt-get-associated-with-transfer-protocol-mms-885666/)

stf92 06-10-2011 05:33 PM

xterm -e doesn't get associated with transfer protocol mms.
 
Kernel 2.6.21.5, Slackware 12.0
Desktop environment= Xfce 4.4.1
(Mozilla) Firefox 2.0.0.4

Hi:
Writing about:config in the address bar of the web browser (Firefox) I get
Code:

network.protocol-handler.app.mms          /usr/local/bin/mplayer
network.protocol-handler.external.mms    true

These lines were added by me and this way all's fine: when I click on a link associated with an mms://... URL mplayer gets in charge. However, I have not mplayer compiled with a graphical front-end (and wouldn't wish to do so). If I had it, I presume mplayer's audio console would appear drawn on the screen. What happens is that mplayer opens in no terminal, graphical or text, and I lose interaction with it (e.g., I won't be able to press the 'p' key to make it pause). If I want mplayer to stop (cancel execution) I must kill it.

I tried two remedies: as a value for network.protocol-handler.app.mms I substituted /usr/bin/xterm -e /usr/local/bin/mplayer for the value shown above. This made firefox to notify, when I clicked on an audio stream link (mms), there was no program associated with the mms protocol.

That having proved unsuccessful, I tried this: I made a script, sc2.sh, namely,
Code:

#!/usr/bin/sh
/usr/bin/xterm -e /usr/local/bin/mplayer

Then, as the value for network.protocol-handler.app.mms, I put /home/semoi/sc2.sh. This time, firefox didn't complain but xterm must have exited immediately, if it ran at all, 'cause ps did not find it.

When you run xterm with the -e option, xterm opens a window, runs the program in the window and, when the program ends execution, xterm exits. If the program is mplayer playing a 30m long file, I can see mplayer's output to stdout, and mplayer will accept input from stdin. Which, for me, is the ideal scenario.

But I am unable to produce this scenario and I'm not even sure it can be done. Any suggestion would be welcome.

shanek54 06-11-2011 02:15 AM

Have you considered using /usr/bin/screen? I have no idea if it would work, and can't test at the moment, but I use it as a "disconnected" terminal all the time...

stf92 06-11-2011 05:04 AM

Kind of you, shanek54, to have posted back. I was considering your proposition, when a doubt assaulted me. I clicked the link, and payed very careful attention to see what happened on the screen. To my surprise, I could verify sc2.sh (second code block above) got executed and, with it, mplayer. And then, xterm immediately exited.

Then I understood it was the natural thing to happen: mplayer has no argument in its command line! As a consequence, it displays its version number, usage and exits, as it would do if invoked directly from a console. What I have to do is to rewrite the script so that it accepts an input argument. I hope this will do. Regards.

stf92 06-11-2011 05:46 AM

Before, sc2.sh was
Code:

#!/usr/bin/sh
/usr/bin/xterm -e /usr/local/bin/mplayer

Now, it is
Code:

#!/usr/bin/sh
/usr/bin/xterm -e /usr/local/bin/mplayer $1

And the whole thing is working just fine. Kind regards.


All times are GMT -5. The time now is 02:32 PM.