dotfiles/.bin/bpm-rename
2023-02-22 08:31:38 +01:00

37 lines
549 B
Bash
Executable File

#!/bin/sh -x
# rename files so the filename includes the BPM
usage() {
printf "Usage: $0 <srcfolder> <dstfolder>\n"
exit 2
}
test -z "$1" && usage
test -z "$2" && usage
_src="$(readlink -f "$1")"
_dst="$(readlink -f "$2")"
myread() {
read p
}
find "$_src" -type f \
| while read _file
do
printf 'Playing file %s...\n' "$(basename "$_file")"
mpv --really-quiet --no-video "$_file" &
_pid="$!"
bpm-tag -m $(($v - 20)) -x $(($v + 20)) -n -f "$_file"
case $d in
"[yY]") echo rename; ;;
*) ;;
esac
kill $_pid
done