Fornoth / spotify-connect-web

MIT License
436 stars 66 forks source link

Volume control from bash? #142

Open tatoosh opened 6 years ago

tatoosh commented 6 years ago

Hello,

is there a way to volume control from a bash script like curl with port 4000? Maybe you have a snippet for me to increase or decrease volume!?

Thx

dusatvoj commented 6 years ago

!/bin/bash

VOL=3 if [ $1 = '+' ] then amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+${VOL}]%

elif [ $1 = '-' ] then amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]%|sed 's/%//')-${VOL}]% elif [[ $1 =~ [gG][eE][tT] ]] then VOLLVL=$(amixer get PCM | grep -E '%' | awk '{print $4, $5}') echo "Volume level = ${VOLLVL}" else echo "Bad input parameter (+/-/GET)" fi

This could be solution, when you want to controll volume from bash. I'm using Raspberry SSH android app and I'm using this script for it.