Merge branch 'experimental' of ssh://gitea.elara.ws:2222/music-kraken/music-kraken-core into experimental
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
commit
5179c64161
@ -1,5 +1,5 @@
|
|||||||
import mutagen
|
import mutagen
|
||||||
from mutagen.id3 import ID3, Frame, APIC
|
from mutagen.id3 import ID3, Frame, APIC, USLT
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
import logging
|
import logging
|
||||||
@ -7,6 +7,7 @@ from PIL import Image
|
|||||||
|
|
||||||
from ..utils.config import logging_settings, main_settings
|
from ..utils.config import logging_settings, main_settings
|
||||||
from ..objects import Song, Target, Metadata
|
from ..objects import Song, Target, Metadata
|
||||||
|
from ..objects.metadata import Mapping
|
||||||
from ..connection import Connection
|
from ..connection import Connection
|
||||||
|
|
||||||
LOGGER = logging_settings["tagging_logger"]
|
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(),
|
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)
|
mutagen_file = mutagen.File(target.file_path)
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class Mapping(Enum):
|
|||||||
key = attribute.value
|
key = attribute.value
|
||||||
|
|
||||||
if key[0] == 'T':
|
if key[0] == 'T':
|
||||||
# a text fiel
|
# a text field
|
||||||
return cls.get_text_instance(key, value)
|
return cls.get_text_instance(key, value)
|
||||||
if key[0] == "W":
|
if key[0] == "W":
|
||||||
# an url field
|
# an url field
|
||||||
@ -355,7 +355,12 @@ class Metadata:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
list_data = self.id3_dict[field]
|
list_data = self.id3_dict[field]
|
||||||
|
#correct duplications
|
||||||
|
correct_list_data = list()
|
||||||
|
for data in list_data:
|
||||||
|
if data not in correct_list_data:
|
||||||
|
correct_list_data.append(data)
|
||||||
|
list_data = correct_list_data
|
||||||
# convert for example the time objects to timestamps
|
# convert for example the time objects to timestamps
|
||||||
for i, element in enumerate(list_data):
|
for i, element in enumerate(list_data):
|
||||||
# for performance’s sake I don't do other checks if it is already the right type
|
# for performance’s sake I don't do other checks if it is already the right type
|
||||||
@ -395,6 +400,5 @@ class Metadata:
|
|||||||
"""
|
"""
|
||||||
# set the tagging timestamp to the current time
|
# set the tagging timestamp to the current time
|
||||||
self.__setitem__(Mapping.TAGGING_TIME, [ID3Timestamp.now()])
|
self.__setitem__(Mapping.TAGGING_TIME, [ID3Timestamp.now()])
|
||||||
|
|
||||||
for field in self.id3_dict:
|
for field in self.id3_dict:
|
||||||
yield self.get_mutagen_object(field)
|
yield self.get_mutagen_object(field)
|
||||||
|
@ -69,7 +69,7 @@ dependencies = [
|
|||||||
"toml~=0.10.2",
|
"toml~=0.10.2",
|
||||||
"typing_extensions~=4.7.1",
|
"typing_extensions~=4.7.1",
|
||||||
|
|
||||||
"python-sponsorblock~=0.0.dev1",
|
"python-sponsorblock~=0.1.dev1",
|
||||||
"youtube_dl",
|
"youtube_dl",
|
||||||
]
|
]
|
||||||
dynamic = [
|
dynamic = [
|
||||||
|
Loading…
Reference in New Issue
Block a user