More info: https://github.com/daniel-j/omxradio
Demo: https://www.youtube.com/watch?v=HrgPvr6pDV0


Jim Ford wrote:I'm trying to write a simple bash script for controlling omxplayer from a command line. I'm a rubbish programmer, particularly with bash. This is what I've got so far:
But it doesn't really work as expected.Code: Select all
#!/bin/bash # if [ ! -e /tmp/omxplayer.pipe ] then mkfifo /tmp/omxplayer.pipe fi # ( /usr/bin/omxplayer -n -o hdmi $1 < /tmp/omxplayer.pipe & ) # echo -n . /tmp/omxplayer.pipe clear while true do echo p for play/pause echo q for quit echo b for back 30 echo B for back 600 echo f for forward 30 echo F for forward 600 echo z for info echo 1 for slower echo 2 for faster echo j for previous audio track echo k for next audio track echo + for volume up echo - for volume down echo i for previous chapter echo o for next chapter echo n for previous subtitle track echo m for next subtitle track echo s for toggle subtitles read inp clear case $inp in p|z|1|2|j|k|+|-|i|o|n|m|s) echo -n $inp > /tmp/omxplayer.pipe ;; q) echo "Quiting" echo -n q > /tmp/omxplayer.pipe rm /tmp/omxplayer.pipe break ;; b) echo -n $'\x1b\x5b\x44' > /tmp/omxplayer.pipe ;; B) echo -n $'\x1b\x5b\x41' > /tmp/omxplayer.pipe ;; f) echo -n $'\x1b\x5b\x43' > /tmp/omxplayer.pipe ;; F) echo -n $'\x1b\x5b\x42' > /tmp/omxplayer.pipe ;; *) echo "Please select from above only" ;; esac done
I'd welcome suggestions , please!
Jim
Code: Select all
#!/bin/sh -
\rm /tmp/command_pipe
mkfifo /tmp/command_pipe
xbindkeys
omxplayer -o hdmi $* < /tmp/command_pipe &
PID=$!
echo . > /tmp/command_pipe
wait $PID
\rm /tmp/command_pipe
killall -9 xbindkeys
Code: Select all
"echo -n p > /tmp/command_pipe"
b:1
"echo -n q > /tmp/command_pipe"
b:3
"echo -n ^[[A > /tmp/command_pipe"
b:4
"echo -n ^[[B > /tmp/command_pipe"
b:5
"echo -n ^[[D > /tmp/command_pipe"
b:6
"echo -n ^[[C > /tmp/command_pipe"
b:7