cap.sh (750B)
1 #!/bin/bash 2 3 # Path to your music directory 4 music_dir="Music/Dead_Kennedys/Dead_Kennedys_-_Give_Me_Convenience_Or_Give_Me_Death" 5 6 # Loop through all FLAC files in the directory (sorted by name) 7 find "$music_dir" -type f -name "*.flac" | sort | while read -r file; do 8 # Extract the base filename without extension 9 base_name=$(basename "$file" .flac) 10 11 # Format the title by replacing underscores with spaces and capitalizing the first letters 12 title=$(echo "$base_name" | sed -e 's/_/ /g' -e 's/^\(.\)/\U\1/' -e 's/\b\(.\)/\U\1/g') 13 14 # Remove the original TITLE tag 15 metaflac --remove-tag=TITLE "$file" 16 17 # Set the new TITLE tag 18 metaflac --set-tag=TITLE="$title" "$file" 19 20 echo "Updated title for: $file -> $title" 21 done 22