Home

mp3 tags edit

#!/bin/bash

# SCRIPT: fix_artist.sh
# DESCRIPTION: Sets the Artist tags to "KęKę" for all MP3 files in the current directory.

# The correct artist name to set for all files.
# Using a variable makes the script cleaner and easier to change later.
CORRECT_ARTIST="KęKę"

echo "Starting tag update for all MP3 files in this directory..."
echo "New Artist Name will be set to: $CORRECT_ARTIST"

# 1. Loop through every file that ends with .mp3
# The quotes around "*.mp3" are important to handle filenames with spaces!
for mp3_file in *.mp3; do
    
    # 2. Check if the file is a real file (not a folder or if no .mp3 files were found)
    if [ -f "$mp3_file" ]; then
        
        # 3. Print a message to show which file is currently being processed
        echo ""
        echo "--> Processing file: $mp3_file"
        
        # 4. Use id3v2 to set three different tag fields to the correct value:
        # -a: Sets the ID3v1 Artist tag (which was "KK")
        # -A: Sets the ID3v2 Album Artist tag (TPE2 frame, which was "KeKe")
        # -tpe1: Sets the ID3v2 Lead Performer tag (TPE1 frame, which was "KęKę" - 
        # we set it again just in case)
        
        # NOTE: You only need to change the parts inside the double quotes for the
        #       Artist name. The other parts (-a, -A, -tpe1, etc.) are commands/flags.
        id3v2 -a "$CORRECT_ARTIST" -B "$CORRECT_ARTIST" -tpe1 "$CORRECT_ARTIST" "$mp3_file"
        
        # 5. You can uncomment the line below to verify the changes immediately
        # id3v2 -l "$mp3_file"

    fi
done

echo ""
echo "Script finished. All relevant artist tags have been set to $CORRECT_ARTIST."

Tools to edit mp3 tags

Tags: Mp3, Linux, Bash, Music