What does beets do with already existing .lrc files?

Just thought I’d give an update on my solution, this does exactly what I need for synced lyrics specifically. It utilizes bash on Linux (my library is stored on a machine running Ubuntu Server).

I’ve optimized it to match lyrics to media instead of media to lyrics (find .lrc files first, then looks for media that matches it.)

#!/bin/bash
# Allow matching entire directory tree, case insensitive matching.
shopt -s globstar nocaseglob

# Loop through all directories
for lyric in **/*.lrc; do
    # Filepath without extension.
    base="${lyric%.*}"
    # Find all files with same basename
    for media in "$base".*; do
        # Ensure identified file is not the synced lyrics file.
        if [[ "$media" != "$lyric" ]]; then
            # Add "_temp" to filename for output. 
            temp_file="${media%.*}_temp.${media##*.}"
            # Embed lyrics to media file.
            ffmpeg -i "$media" -map 0 -c copy -metadata LYRICS="$(cat "$lyric")" "$temp_file"
            # Replace original file with updated file
            mv "$temp_file" "$media"
            # Remove .lrc file (it's embedded in the media, no longer needed)
            rm "$lyric"
            # Lets you know which file has synced lyrics now.
            echo "Lyrics embedded into $media"
        fi
    done
done
1 Like