fix for lyrics
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
Luna 2024-05-08 12:27:56 +02:00
parent 709c5ebaa8
commit e3e7aea959
3 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import mutagen
from mutagen.id3 import ID3, Frame, APIC
from mutagen.id3 import ID3, Frame, APIC, USLT
from pathlib import Path
from typing import List
import logging
@ -7,6 +7,7 @@ from PIL import Image
from ..utils.config import logging_settings, main_settings
from ..objects import Song, Target, Metadata
from ..objects.metadata import Mapping
from ..connection import Connection
LOGGER = logging_settings["tagging_logger"]
@ -105,6 +106,11 @@ def write_metadata_to_target(metadata: Metadata, target: Target, song: Song):
data=converted_target.read_bytes(),
)
)
id3_object.frames.delall("USLT")
uslt_val = metadata.get_id3_value(Mapping.UNSYNCED_LYRICS)
id3_object.frames.add(
USLT(encoding=3, lang=u'eng', desc=u'desc', text=uslt_val)
)
mutagen_file = mutagen.File(target.file_path)

View File

@ -32,7 +32,7 @@ class FormattedText:
if self.is_empty and other.is_empty:
return True
return self.doc == other.doc
return self.html == other.html
@property
def markdown(self) -> str:

View File

@ -92,7 +92,7 @@ class Mapping(Enum):
key = attribute.value
if key[0] == 'T':
# a text fiel
# a text field
return cls.get_text_instance(key, value)
if key[0] == "W":
# an url field
@ -381,7 +381,7 @@ class Metadata:
"""
if field.value[0].upper() == "T" and field.value.upper() != "TXXX":
return self.NULL_BYTE.join(list_data)
return list_data[0]
def get_mutagen_object(self, field):