Created
February 15, 2020 20:40
-
-
Save keizie/c3eff2d9ebb94ebbdec7ec3b25ccaa53 to your computer and use it in GitHub Desktop.
bash clone of python umpv from mpv package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FIFO="/tmp/mpvpipe" | |
TARGET=$1 | |
if [ "x--" = "x$TARGET" ]; then | |
TARGET=$2 | |
fi | |
PID=$(fuser $FIFO 2> /dev/null) | |
if [ $? -ne 0 ]; then | |
OPTS="" | |
exec mpv --player-operation-mode=pseudo-gui --idle=once --input-ipc-server=$FIFO $OPTS "$@" & | |
else | |
echo '{ "command": ["write-watch-later-config"] }' | socat - $FIFO | |
OPTS="" | |
#OPTS="video-rotate=0,video-zoom=0" | |
echo '{ "command": ["loadfile", "'$TARGET'", "replace", "'$OPTS'"] }' | socat - $FIFO | |
[ $? -eq 0 ] && wmctrl -p -l | grep $PID | cut -d\ -f1 | xargs wmctrl -iR | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment