Last active
August 12, 2016 10:33
-
-
Save Wohlstand/d531e9c891591c234ec6d7edc137a45e to your computer and use it in GitHub Desktop.
A simple sequential playlist to change playing music every 3 minutes or by key-press (looking for making shuffle)
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 | |
MAXTIME=180 | |
PLAYER=/your/path/here/pge_musplay | |
PLAYDIR=$PWD/*.mid | |
ord() { | |
LC_CTYPE=C printf '%d' "'$1" | |
} | |
for f in $PLAYDIR; do | |
echo "================================================================================" | |
echo "PLAY $f..." | |
$PLAYER "$f"; | |
echo "================================================================================" | |
TIME="0" | |
echo | |
while [ $TIME != $MAXTIME ]; | |
do | |
printf "\e[33m\r$TIME/$MAXTIME\e[0m" | |
if read -r -s -n 1 -t 1 key | |
then | |
Akey=$(ord $key) | |
if ((Akey == 112)) ; then | |
printf "\rpaused" | |
read -n 1 | |
printf "\r " | |
else | |
TIME=$MAXTIME | |
fi | |
else | |
TIME=$(($TIME+1)) | |
fi | |
done | |
printf "\r " | |
sleep 1s | |
printf "\n\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment