Skip to content

Instantly share code, notes, and snippets.

@dgalling
Created July 13, 2014 00:56
Show Gist options
  • Save dgalling/304d46524f80239ced60 to your computer and use it in GitHub Desktop.
Save dgalling/304d46524f80239ced60 to your computer and use it in GitHub Desktop.
iTunes stopped working again. I wrote a simple music queue/player.
#!/usr/bin/env sh
TIMEOUT=0
while true; do
AUDIO_FILE=$(redis-cli BLPOP "$MUSIC_QUEUE" $TIMEOUT | grep --max-count=1 '^/')
afplay "$AUDIO_FILE"
done
#!/usr/bin/env sh
set -e
MUSIC_DIR="/Volumes/Store/iTunes Media/Music"
pushd "$MUSIC_DIR"
AUDIO_FILE=$(find . -type f | selecta)
redis-cli RPUSH "$MUSIC_QUEUE" "$(realpath "$MUSIC_DIR/$AUDIO_FILE")"
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment