Skip to content

Instantly share code, notes, and snippets.

@urcadox
Created April 24, 2013 16:30
Show Gist options
  • Save urcadox/5453502 to your computer and use it in GitHub Desktop.
Save urcadox/5453502 to your computer and use it in GitHub Desktop.
#!/bin/bash
SLEEP=`echo "$1*3600" | bc`
echo "Alarm triggered in $1 hours"
sleep $SLEEP > /dev/null
echo "Starting playing"
mpc volume 50 > /dev/null
mpc play > /dev/null
mpcfade.sh 50 65 0
mpcfade.sh 65 75 1
echo "Turning on TV and switching input to me"
(echo "as" | cec-client -s -d 5) &
mpcfade.sh 75 82 2
mpcfade.sh 82 90 4
echo "Full volume, have a good day!"
#!/bin/bash
VOL=$1
TO=$2
SLEEP=$3
echo "Fading from $VOL% to $TO% (step: $SLEEP second(s))"
mpc volume $VOL > /dev/null
if [ $VOL -lt $TO ]
then
while [ $VOL -lt $TO ]
do
sleep $SLEEP > /dev/null
VOL=$[$VOL+1]
mpc volume $VOL > /dev/null
done
else
while [ $VOL -gt $TO ]
do
sleep $SLEEP > /dev/null
VOL=$[$VOL-1]
mpc volume $VOL > /dev/null
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment