diff --git a/src/music_kraken/database/objects/metadata.py b/src/music_kraken/database/objects/metadata.py index 2e1f112..7e0106f 100644 --- a/src/music_kraken/database/objects/metadata.py +++ b/src/music_kraken/database/objects/metadata.py @@ -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 diff --git a/src/music_kraken/database/objects/song.py b/src/music_kraken/database/objects/song.py index e3be420..1b7ccc1 100644 --- a/src/music_kraken/database/objects/song.py +++ b/src/music_kraken/database/objects/song.py @@ -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 diff --git a/test.db b/test.db index 5a22c67..b339330 100644 Binary files a/test.db and b/test.db differ