Created
January 5, 2016 14:12
-
-
Save annesteenbeek/fa9449c9b67f3b790f39 to your computer and use it in GitHub Desktop.
small shell script to make sure the living room computer can only play christmas music
This file contains 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/bash | |
while true | |
do | |
hasChristmasSpirit=false; | |
curSong=$(spotify-control getTitle) | |
declare -a whitelist=("christmas" "Lord" "Winter" "Xmas" "snow" "rudolph" "cold" "sleigh" "frosty"); | |
## loop trough array of christmas spirit | |
for i in "${whitelist[@]}" | |
do | |
if echo $curSong | grep -iq $i | |
then | |
hasChristmasSpirit=true | |
fi | |
done | |
if $hasChristmasSpirit | |
then | |
echo "christmas spirit found!" | |
else | |
spotify-control next | |
echo "no christmas spirit found" | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment