This commit is contained in:
Lars Noack 2023-01-13 12:05:44 +01:00
parent df749118d7
commit 8a7335c741
3 changed files with 29 additions and 3 deletions

View File

@ -27,7 +27,6 @@ class Mapping(Enum):
PUBLISHER_URL = "WPUB"
PUBLISHER = "TPUB"
RATING = "POPM"
PAYMEMT_URL = "WPAY"
DISCNUMBER = "TPOS"
MOVEMENT_COUNT = "MVIN"
TOTALDISCS = "TPOS"
@ -66,6 +65,7 @@ class Mapping(Enum):
ARTIST_WEBPAGE_URL = "WOAR"
COPYRIGHT_URL = "WCOP"
COMMERCIAL_INFORMATION_URL = "WCOM"
PAYMEMT_URL = "WPAY"
MOVEMENT_INDEX = "MVIN"
MOVEMENT_NAME = "MVNM"
@ -111,7 +111,6 @@ class Metadata:
# the key is a 4 letter key from the id3 standards like TITL
self.id3_attributes: Dict[str, list] = {}
self.
# its a null byte for the later concatenation of text frames
self.null_byte = "\x00"
@ -126,7 +125,12 @@ class Metadata:
raise ValueError(f"can only set attribute to list, not {type(value)}")
if override_existing:
self.id3_attributes[key] = value
new_val = []
for elem in value:
if elem is not None:
new_val.append(elem)
if len(new_val) > 0:
self.id3_attributes[key] = new_val
else:
if key not in self.id3_attributes:
self.id3_attributes[key] = value

View File

@ -293,10 +293,23 @@ class Album(DatabaseObject, ID3Metadata):
self.title: str = title
self.copyright: str = copyright_
self.album_status: str = album_status
"""
TODO
MAKE SURE THIS IS IN THE CORRECT FORMAT
"""
self.language: str = language
"""
TODO
only store the date in a python date object and derive the
year from it
"""
self.year: str = year
self.date: str = date
self.country: str = country
"""
TODO
find out the id3 tag for barcode and implement it
"""
self.barcode: str = barcode
self.is_split: bool = is_split
self.albumsort: int | None = albumsort
@ -327,6 +340,15 @@ class Album(DatabaseObject, ID3Metadata):
song.tracksort = len(self.tracklist)
self.tracklist.append(song)
def get_id3_dict(self) -> dict:
return {
ID3_MAPPING.ALBUM: [self.title],
ID3_MAPPING.COPYRIGHT: [self.copyright],
ID3_MAPPING.LANGUAGE: [self.language],
ID3_MAPPING.ALBUM_ARTIST: [a.name for a in self.artists]
}
"""
All objects dependent on Artist

BIN
test.db

Binary file not shown.