From 8a7335c7411d91ba71680fa64e1f8b972d4eecd4 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Fri, 13 Jan 2023 12:05:44 +0100 Subject: [PATCH] das --- src/music_kraken/database/objects/metadata.py | 10 +++++--- src/music_kraken/database/objects/song.py | 22 ++++++++++++++++++ test.db | Bin 69632 -> 69632 bytes 3 files changed, 29 insertions(+), 3 deletions(-) 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 5a22c6745441db675cf1abc861c05327f558fffe..b3393308953ba9f3a1cdef97ba963903b2495829 100644 GIT binary patch delta 2354 zcmd5-O^X~=6z%Ssju|0S&LW6JoIwT?7%#k!`|7<1>L@N;Bq0e>OOf}P2@W%XX(41` zWi^ZJq`>unOBWrd!F7Is=+=b`w*evf2a{X9PzN&PEnPG;Mb+WlbI&>V(ecWozV1;Hv4E$Yyu*k9Uszr$=rP8mTtbh8T?ygnsxMbLBc(G*I$Egg$=<%zRwqCV0;~%bm`^I@=uNVw|7GU`R)RWcH>u}K?H22|f2{8ef|L+n3R1%5m;u^lH9xyXI6yu<=GC)0K`YP04dpfaFo zFM!ELu*O;tQqp6g8fVgfjq>?go*U57gGB8O^g;{%Wg7S$$q7YU(%k?ZB&eDF#dJbsiH`iOu zGh;C;;L#wUZyN9}aB4&0Qc#&CjI-Tzm^S;T^LMvOkWZdGuDg<{mRl~FYPsbSrbCfc z_1>sntUleXI~8THfojJ~ElAoV!R6f0fsh=9ZXn>81zcAIVu^UhiD4ILv4jH1kVrla6cJ45%z^e=vYXZlrr zG`N5BR^88UO}hd{)1l4^;Ms-c#VBAsAz7}`Z#4S;hmDiJep~BGN~VOujcTQBFP5O4 z*+qBGGHy%=uIOZ)fjbXvJdk^(WzSr0DyxE77pKqn>aOG{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