1234567891011121314151617181920 |
- #! /bin/sh
- ## Dependencies: foo_beefweb for foobar2000, wmctrl, coreutils, grep, curl
- ## +x rights for this file
- case "$1" in
- "--help"|"-h") cat $0 ;;
- "--pause-toggle"|"-pt") curl -d "" "http://localhost:8880/api/player/pause/toggle" ;;
- "--play"|"-pl") curl -d "" "http://localhost:8880/api/player/play" ;;
- "--stop"|"-st") curl -d "" "http://localhost:8880/api/player/stop" ;;
- "--previous"|"-pv") curl -d "" "http://localhost:8880/api/player/previous" ;;
- "--next"|"-nx") curl -d "" "http://localhost:8880/api/player/next" ;;
- "--volume"|"-v") curl -d "{\"volume\":-`echo "100.0 - $2" | bc -l`}" "http://localhost:8880/api/player" ;; #Volume is in 1000db - XdB.
- # "--title"|"-t") xwininfo -root -children | grep "\[foobar2000\]" ;; ## Alternative
- "--title"|"-t") wmctrl -l | grep "\[foobar2000\]" | cut --complement -d' ' -f 1,2,3,4 | awk 'NF{NF--;};1' ;;
- *) echo "Invalid arguments, exitting..." && exit 1 ;;
- esac
- exit 0
|