Created
July 18, 2019 14:28
-
-
Save mhzawadi/6dc7b2e0b506f490bf63631d88c81998 to your computer and use it in GitHub Desktop.
control Subsonic jukebox on the command line
This file contains hidden or 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/sh | |
SubADDR="" | |
SubAPI="rest/jukeboxControl.view" | |
SubUSER="" | |
SubPASS="" | |
SubSALT="" | |
SubVER="1.16.1" | |
SubCLI="curl" | |
SubAction=$1 | |
case "${SubAction}" in | |
add) | |
IDS="" | |
sub_song.sh 10 | awk '{print $2}' |grep "id" | awk -F'=' '{print $2}' | | |
while read ID | |
do | |
ID=`echo $ID | sed 's/"//g'` | |
curl "${SubADDR}${SubAPI}?&u=${SubUSER}&t=${SubPASS}&s=${SubSALT}&v=${SubVER}&c=${SubCLI}&action=${SubAction}&id=${ID}" | |
done | |
curl "${SubADDR}${SubAPI}?u=${SubUSER}&t=${SubPASS}&s=${SubSALT}&v=${SubVER}&c=${SubCLI}&action=start" | |
;; | |
stop) | |
curl "${SubADDR}${SubAPI}?u=${SubUSER}&t=${SubPASS}&s=${SubSALT}&v=${SubVER}&c=${SubCLI}&action=stop" | |
curl "${SubADDR}${SubAPI}?u=${SubUSER}&t=${SubPASS}&s=${SubSALT}&v=${SubVER}&c=${SubCLI}&action=clear" | |
;; | |
skip) | |
curl "${SubADDR}${SubAPI}?u=${SubUSER}&t=${SubPASS}&s=${SubSALT}&v=${SubVER}&c=${SubCLI}&action=skip&index=$2" | |
;; | |
clear) | |
curl "${SubADDR}${SubAPI}?u=${SubUSER}&t=${SubPASS}&s=${SubSALT}&v=${SubVER}&c=${SubCLI}&action=clear" | |
;; | |
*) | |
echo "Usage: $0 {add|stop|skip <INDEX>|clear}" | |
curl "${SubADDR}${SubAPI}?u=${SubUSER}&t=${SubPASS}&s=${SubSALT}&v=${SubVER}&c=${SubCLI}&action=status" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment