]> git.wh0rd.org Git - home.git/commitdiff
add helper for vlc shortcuts
authorMike Frysinger <vapier@gentoo.org>
Sat, 12 Nov 2011 06:41:53 +0000 (01:41 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:41 +0000 (15:36 -0400)
.bin/vlc-rc [new file with mode: 0755]

diff --git a/.bin/vlc-rc b/.bin/vlc-rc
new file mode 100755 (executable)
index 0000000..f52e6cf
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+exec 3<> /dev/tcp/vapier/8001
+send() { echo "$*" 1>&3 ; }
+recv() { local l; read l <&3; echo ${l%$'\r'} ; }
+
+case $1 in
+f|fullscreen)
+       send f $2
+       ;;
+help)
+       send $1
+       cat <&3
+       ;;
+pause|quit)
+       send $1
+       ;;
+vol)
+       shift
+       send vol$*
+       ;;
+seek)
+       off=( 0 5 15 30 60 )
+       [[ -z $2 || -n ${2//[-+]} ]] && exit 0
+       off=${off[${#2}]}
+       send get_time
+       curr=$(recv)
+       send seek $(( curr ${2:0:1} off ))
+       ;;
+*)
+       send "$@"
+       ;;
+esac
+
+exit 0