30 lines
550 B
Plaintext
30 lines
550 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
if [ $# -ne 1 ]; then
|
||
|
echo -e "\033[31;1merror:\033[0m this script expects a single playlsit argument"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
play() {
|
||
|
index=1
|
||
|
count=$(ls $1 | wc -l)
|
||
|
ls $1 | sort -R | while read music; do
|
||
|
echo Playing $music "($index / $count)"
|
||
|
index=$(($index+1))
|
||
|
mplayer "$1/$music" < /dev/tty > /dev/null 2>&1
|
||
|
if [ $? -ne 0 ]; then
|
||
|
return 1
|
||
|
fi
|
||
|
done
|
||
|
}
|
||
|
|
||
|
set -o pipefail
|
||
|
|
||
|
|
||
|
while true; do
|
||
|
play ~/Music/Relax/$1
|
||
|
if [ $? -ne 0 ]; then
|
||
|
exit
|
||
|
fi
|
||
|
done
|