summaryrefslogtreecommitdiff
path: root/files/config/mpd/scripts/cap.sh
blob: 62d19443a2e7655d03e0823d5762ab8cc00ea26d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

# Path to your music directory
music_dir="Music/Dead_Kennedys/Dead_Kennedys_-_Give_Me_Convenience_Or_Give_Me_Death"

# Loop through all FLAC files in the directory (sorted by name)
find "$music_dir" -type f -name "*.flac" | sort | while read -r file; do
    # Extract the base filename without extension
    base_name=$(basename "$file" .flac)

    # Format the title by replacing underscores with spaces and capitalizing the first letters
    title=$(echo "$base_name" | sed -e 's/_/ /g' -e 's/^\(.\)/\U\1/' -e 's/\b\(.\)/\U\1/g')

    # Remove the original TITLE tag
    metaflac --remove-tag=TITLE "$file"

    # Set the new TITLE tag
    metaflac --set-tag=TITLE="$title" "$file"

    echo "Updated title for: $file -> $title"
done