bin-extra/playlist

30 lines
518 B
Plaintext
Raw Normal View History

2022-06-21 14:02:24 +02:00
#!/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))
2023-07-03 17:10:06 +02:00
mpv "$1/$music"
2022-06-21 14:02:24 +02:00
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