posix complain

This commit is contained in:
2021-07-09 15:25:06 +02:00
parent 31aede8e95
commit c3ea47b305

7
md
View File

@ -2,7 +2,8 @@
checkMetadata() { checkMetadata() {
ffprobe "$1" 2>&1 | grep -e artist -e title ffprobe "$1" 2>&1 | grep -e artist -e title
while true; do while true; do
read -p "correct metadata? [Y] | [n]: " yn printf "correct metadata? [Y] | [n]: "
read -r yn < /dev/tty
case "$yn" in case "$yn" in
[Yy]* ) return 0;; [Yy]* ) return 0;;
[Nn]* ) return 1;; [Nn]* ) return 1;;
@ -10,7 +11,7 @@ checkMetadata() {
esac esac
done done
} }
cd ~/Medien/Musik/2020 cd ~/Medien/Musik/2020 || exit
download_dir="$(mktemp -d)" download_dir="$(mktemp -d)"
file_name="$(youtube-dl "ytsearch:$1 lyrics" \ file_name="$(youtube-dl "ytsearch:$1 lyrics" \
--extract-audio \ --extract-audio \
@ -25,7 +26,7 @@ r128gain "$file_name" 2> /dev/null
temp_dir="$(mktemp -d)" temp_dir="$(mktemp -d)"
temp_file="$temp_dir/0.mp3" temp_file="$temp_dir/0.mp3"
cp "$file_name" "$temp_file" cp "$file_name" "$temp_file"
idntag "$temp_file" idntag "$temp_file" > /dev/null
temp_file=$(echo "$temp_dir"/*) temp_file=$(echo "$temp_dir"/*)
if checkMetadata "$temp_file"; then if checkMetadata "$temp_file"; then
mv "$temp_file" . mv "$temp_file" .