This commit is contained in:
Lars Noack 2023-01-13 09:44:57 +01:00
parent ffcd626e5e
commit df749118d7
3 changed files with 14 additions and 6 deletions

View File

@ -1,5 +1,5 @@
from enum import Enum from enum import Enum
from typing import List from typing import List, Dict, Tuple
from mutagen import id3 from mutagen import id3
from .parents import ( from .parents import (
@ -98,11 +98,20 @@ class Metadata:
Shall only be read or edited via the Song object. Shall only be read or edited via the Song object.
call it like a dict to read/write values call it like a dict to read/write values
""" """
class FrameValue:
def __init__(self, values: list, modified_by: str) -> None:
"""
Parameters:
values (list): the values.
"""
pass
def __init__(self, data: dict = {}) -> None: def __init__(self, data: dict = {}) -> None:
# this is pretty self-explanatory # this is pretty self-explanatory
# the key is a 4 letter key from the id3 standards like TITL # the key is a 4 letter key from the id3 standards like TITL
self.id3_attributes: Dict[str, list] = {} self.id3_attributes: Dict[str, list] = {}
self.
# its a null byte for the later concatenation of text frames # its a null byte for the later concatenation of text frames
self.null_byte = "\x00" self.null_byte = "\x00"

View File

@ -208,18 +208,20 @@ class Song(DatabaseObject):
self.metadata[ID3_MAPPING.FILE_WEBPAGE_URL.value] = source_obj.url self.metadata[ID3_MAPPING.FILE_WEBPAGE_URL.value] = source_obj.url
def set_sources(self, source_list): def set_sources(self, source_list):
if source_list is None:
return
self._sources = source_list self._sources = source_list
for source in self._sources: for source in self._sources:
source.add_song(self) source.add_song(self)
# self.metadata[ID3_MAPPING.FILE_WEBPAGE_URL.value] = [s.url for s in self._sources]
self.metadata.add_many_id3_metadata_obj(self._sources) self.metadata.add_many_id3_metadata_obj(self._sources)
def set_album(self, album): def set_album(self, album):
if album is None: if album is None:
return return
self.metadata.add_many_id3_metadata_obj() self.metadata.add_id3_metadata_obj(album)
self._album = album self._album = album
def get_metadata(self): def get_metadata(self):
@ -228,9 +230,6 @@ class Song(DatabaseObject):
def has_isrc(self) -> bool: def has_isrc(self) -> bool:
return self._isrc is not None return self._isrc is not None
def add_source(self, source: Source):
pass
def get_artist_names(self) -> List[str]: def get_artist_names(self) -> List[str]:
return self.artist_names return self.artist_names

BIN
test.db

Binary file not shown.