Lyrics are incorrect after using tagger Picard

Unsure how that happened; I don’t use lyrics but wondered if this is normal?

No, this doesn’t sound normal. But I’d need more information to understand what is happening.

In which way are the lyrics incorrect? Do you set the lyrics in Picard, or are those existing lyrics in the file tags? Do the lyrics show up in Picard and, if yes, are they correct there?

1 Like

I used picard for tagging; and it’s incorrect. Other records I have do it as well. May have been there before? but im unsure. I used Picard and it either a) gave me the incorrect ones or b) didn’t overwrite them.

Picard itself doesn’t fetch lyrics. But there have been plugins that are able to get lyrics. Do you have any lyrics plugin enabled?

The only one available from the official plugin repository is the “Musixmatch Lyrics” plugin, which can only fetch incomplete lyrics (30% of the lyrics for a song).

If you have a lyrics plugin enabled, disable it. If not, this is not a Picard problem and the lyrics in your files are coming from somewhere else.

I made a Picard plugin that imports local lyrics into metadata, and it requires the lyrics lrc file to have the same name as the song file. :yum:
raw:

# -*- coding: utf-8 -*-

PLUGIN_NAME = "Import Lyrics from File"
PLUGIN_AUTHOR = "kk"
PLUGIN_DESCRIPTION = "Import lyrics from local .lrc files into the lyrics tag."
PLUGIN_VERSION = "1.0.0"
PLUGIN_API_VERSIONS = ["2.0"]

import os
from PyQt5 import QtCore, QtWidgets
from picard.album import Album
from picard.file import File
from picard.ui.itemviews import BaseAction, register_album_action, register_file_action

class ImportLocalLyrics(BaseAction):
    NAME = "Import &Local Lyrics"

    def callback(self, objs):
        for obj in objs:
            if isinstance(obj, File):
                self.import_lyrics(obj)
            elif isinstance(obj, Album):
                self.import_lyrics_for_album(obj)

    def import_lyrics(self, file):
        if not isinstance(file, File):
            print("Object is not a file")
            return

        audio_file_path = file.filename
        audio_file_dir, audio_file_name = os.path.split(audio_file_path)
        audio_file_base_name, _ = os.path.splitext(audio_file_name)
        lrc_file_name = audio_file_base_name + '.lrc'
        lrc_file_path = os.path.join(audio_file_dir, lrc_file_name.lower())

        # 检查文件是否存在,忽略大小写
        # Check if a file exists, ignoring case
        for file_name in os.listdir(audio_file_dir):
            if file_name.lower() == lrc_file_name.lower():
                lrc_file_path = os.path.join(audio_file_dir, file_name)
                break

        print(f"Checking LRC file: {lrc_file_path}")

        if os.path.exists(lrc_file_path):
            print(f"LRC file found: {lrc_file_path}")
            with open(lrc_file_path, 'r', encoding='utf-8') as f:
                lyrics = f.read()
                print(f"Lyrics imported: {lyrics[:100]}...")
                file.metadata['lyrics'] = lyrics
                file.update()
        else:
            print(f"LRC file not found: {lrc_file_path}")

    def import_lyrics_for_album(self, album):
        if not isinstance(album, Album):
            print("Object is not an album")
            return

        print(f"Processing album: {album}")
        for track in album.tracks:
            for file in track.linked_files:
                self.import_lyrics(file)


file_action = ImportLocalLyrics()
register_file_action(file_action)


album_action = ImportLocalLyrics()
register_album_action(album_action)
2 Likes