Skip to content

Instantly share code, notes, and snippets.

@annesteenbeek
Created January 5, 2016 14:12
Show Gist options
  • Save annesteenbeek/fa9449c9b67f3b790f39 to your computer and use it in GitHub Desktop.
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
#!/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