Skip to content

Instantly share code, notes, and snippets.

@mhzawadi
Created July 18, 2019 14:28
Show Gist options
  • Save mhzawadi/6dc7b2e0b506f490bf63631d88c81998 to your computer and use it in GitHub Desktop.
Save mhzawadi/6dc7b2e0b506f490bf63631d88c81998 to your computer and use it in GitHub Desktop.
control Subsonic jukebox on the command line
#!/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