Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I feed mplayer with file list from another command:

beet ls somequery -p | xargs -d '\n' mplayer

When invoked this way, mplayer doesn't react on any standard keys, all I can do is to C-c interrupt it.

  1. Why does this happen?
  2. How to make mplayer behave (without writing any bigger code, no loops, regexp or multiple pipes)?
share|improve this question

1 Answer 1

Based on this answer which passes args from find, I came up with the following script:

$ beet ls QUERY | mplayer -playlist /dev/fd/3 3<&0 </dev/tty

Quick explanation as how I understand it: mplayer is told to read /dev/fd/3 as a playlist file. File descriptor 3 (/dev/fd/3) is filled by the standard input (3<&0) from the beet command. And input to mplayer is specified as the controlling terminal (</dev/tty). Because mplayer is reading from a file and not stdin, you can control it with the keyboard.

This works for me under Mac OS 10.8.3.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.