30 lines
518 B
Bash
Executable File
30 lines
518 B
Bash
Executable File
#!/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))
|
|
mpv "$1/$music"
|
|
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
|