[MPlayer-users] Binding keys to mplayer?
Torinthiel
torinthiel at megapolis.pl
Wed Aug 25 15:31:16 CEST 2004
On Wed, Aug 25, 2004 at 02:26:10PM +0200, Jesse F. Hughes wrote:
> ,----[ mplayer-wrapper ]
> |
> | fifo="/tmp/$$.fifo"
> | mkfifo $fifo
> | mplayer $@ <$fifo &
> | echo -n " ">>$fifo
> |
> | mplpid=$!
> |
> | IFS=""
> | while [ -e /proc/"$mplpid" ]
> | do
> | if read -s -t1 -n1 i
> | then
> | echo -n -e "$i" >>$fifo;
> | fi
> | done
> |
> | rm $fifo
> |
> `----
You know what? This is called active-waiting, and is BAD.
But I don't see any better option.
> This creates a fifo in /tmp and echos all the input from stdin to that
> fifo. When mplayer dies, the fifo is killed.
>
> Then I wrote a simple script for finding the fifo name. The fifos are
> named <PID>.fifo, and I arbitrarily chose to return the smallest PID.
>
> ,----[ find-fifo.sh ]
> | find /tmp -maxdepth 1 -regex "/tmp/[0-9]*\.fifo" -printf "%f\n"| sort -n| head -n 1
> `----
>
> I use this script in a script I call echo-pause.
>
> ,----[ echo-pause.sh ]
> |
> | fifo=`/home/jesse/bin/find-fifo.sh`
> | if [ -n "$fifo" ] && [ -e "/tmp/$fifo" ];
> | then
> | echo -n " ">/tmp/$fifo;
> | else
> | xmms -t;
> | fi
> `----o
I would consider putting find-fifo's content's into echo-pause. It saves
one bash startup ;)
> If there is an existing fifo for mplayer, then this file echos a space
> into that fifo. Otherwise, it calls xmms with -t (play/pause flag),
> on the assumption that if I hit pause and there is no mplayer, then I
> want to start/pause my cdplayer.
Well, something really good would be to pause everything on echo-pause.
I mean detect ALL MPlayers, pause these that are running (No idea how).
and pause xmms as well. This would be closer to 'incoming call, let's
make everything quiet'
Torinthiel
--
Waclaw "Torinthiel" Schiller GG#: 542916, 3073512
torinthiel(at)megapolis(dot)pl
gpg: B06901F1 fpr: FAA3 559F CAE9 34DE CDC8 7346 2B6E 39F2 B069 01F1
"No classmates may be used during this examination"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-users/attachments/20040825/f4bf3145/attachment.pgp>
More information about the MPlayer-users
mailing list