LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   newbie: trying to use pipe or awk to work with mplayer (https://www.linuxquestions.org/questions/linux-newbie-8/newbie-trying-to-use-pipe-or-awk-to-work-with-mplayer-788567/)

sirpelidor 02-11-2010 07:43 PM

newbie: trying to use pipe or awk to work with mplayer
 
Hi,

I have a text file containing the URL I wanted for mplayer to play. Currently, I play those in commend line using the following steps:

1)cat playlist
2)use mouse to highlight the link
3)type: mplayer then click both left/right mouse button

I was hoping if I can do this in comment line without mouse. I've tried the following without luck

(assume there's only 1 address in the text file)

1) cat playlist |mplayer
2) cat playlist |awk '{print $1}'| mplayer

Thank you.

Tinkster 02-11-2010 08:12 PM

Hard to say w/o knowing the structure of the playlist ....
something like


cat playlist | xargs -i mplayer {}


may work

sirpelidor 02-12-2010 02:13 AM

Hi Tinkster,

cat playlist | xargs -i mplayer {} works like champs!

One thing I noticed, however, mplayer appeared to play in the background hence I was unable to end the stream with the "q" key (had to use ctrl-C then you will see mplayer's PID stuck in ps and can't be kill). Have you experienced that issue?

As for the structure of the playlist, consider the following example:

Code:

tux@esceo:~$ cat playlist
http://scfire-dtc-aa01.stream.aol.com/stream/1005
tux@esceo:~$

Thank you.

Tinkster 02-12-2010 03:41 AM

Can't say I've used mplayer to play urls at all, I'm afraid, so
wouldn't know how it handles this. Does mplayer terminate when
you invoke that individually from the command-line? E.g.,
mplayer http://scfire-dtc-aa01.stream.aol.com/stream/1005

sirpelidor 02-12-2010 11:19 AM

Yea, in commend line, if you do mplayer <whatever>, you should be able to terminate the program by hitting the "q" key.

Seems like this is mplayer issue more then command line issue, I guess I will figure that out somewhere else :)

Thank you very much, Tinkster.


All times are GMT -5. The time now is 02:54 AM.