I used to have a script which basically, returned the current temperature from a website. This was done with wget then awk to return the "Temperature" as a variable then I used sox to create a file saying the Temperature is etc.
The website has changed and I am having trouble re-writing it.
This is what I have:
URL='https://wttr.in/rhyl'
temp="wget -q -O- "$URL" | awk -F\' 'data-value/{print $1 }'| head -1)"
sox -V1 -c 1 silence.wav base.wav $temp.wav temp-dry.wav
sox -V1 -m temp-bed2.wav temp-dry.wav tempfx.wav
sox -V1 tempfx.wav tempfx+15db.wav vol 9 db
sox -V1 temp-dry.wav temp-dry+10db.wav vol 10 db
I'm happy with the sox bit so far, I just cant seem to return the variable i.e. "12" from the temperature section of wttr.in
The desired output of $temp is just number no special characters i.e $temp = 12
This is a version bash file that updates and audio file for the current temperature, for the radio station jingle.
#/////Get weather for where you want thanks to User3439894 and Bengamin W. /////
temp="$(curl -s https://wttr.in/rhyl?format=%t | grep -Eo [0-9]+)"
# ////use sox to make the dry file outof pre-defind wav files/////
sox -V1 -c 1 silence.wav base.wav $temp.wav temp-dry.wav
# //// Here I use sox again to create a wav file with start and end jingle /////
sox -V1 -m temp-bed2.wav temp-dry.wav tempfx.wav
# //// Using sox again I boost the audio by what is required 15db and 10 db///
sox -V1 tempfx.wav tempfx+15db.wav vol 9 db
sox -V1 temp-dry.wav temp-dry+10db.wav vol 10 db
I then use crontab to run this bash script as a cronjob.
thanks everyone
Alex