User Tools

Site Tools


linux:id3

This is an old revision of the document!


Mass ID3 edit

sudo apt-get install id3v2

bash script for search & replace in title tag:

## Iterate over all file/dir names ending in mp3
for file in /path/to/dir/with/mp3/files/*mp3; do 
    ## read the title and save in the variable $title
    title=$(id3v2 -l "$file" | grep -oP '^(Title\s*|TIT2\s*.*\)):\K(.*?)(?=Artist:)'); 
    ## check if this title matches ytversion
    if [[ "$title" =~ "ytversion" ]]; then 
        ## If it does, replace ytversion with mqversion and 
        ## save in the new variable $newTitle
        newTitle=$(sed 's/ytversion/mqversion/g' <<<"$title") 
        ## Set the tite tag for this file to the value in $newTitle
        id3v2 -t "$newTitle" "$file" 
    fi
done
linux/id3.1645482422.txt.gz · Last modified: 2023/05/29 11:53 (external edit)