diff --git a/development/__init__.py b/development/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/development/objects_collection.py b/development/objects_collection.py new file mode 100644 index 0000000..170edb0 --- /dev/null +++ b/development/objects_collection.py @@ -0,0 +1,26 @@ +import music_kraken +from music_kraken.objects import Song, Album, Artist, Collection + +if __name__ == "__main__": + artist: Artist = Artist( + name="artist", + main_album_list=[ + Album( + title="album", + song_list=[ + Song( + title="song", + album_list=[ + Album(title="album", albumsort=123), + ], + ), + ] + ), + Album(title="album", barcode="1234567890123"), + ] + ) + + print(artist.main_album_collection[0].barcode) + print(artist.main_album_collection[0].albumsort) + + print(artist.main_album_collection._indexed_values) \ No newline at end of file diff --git a/music_kraken/objects/parents.py b/music_kraken/objects/parents.py index 80bd237..689c7cc 100644 --- a/music_kraken/objects/parents.py +++ b/music_kraken/objects/parents.py @@ -177,6 +177,8 @@ class OuterProxy: _ = "debug" return + print(__other) + self._inner.__merge__(__other._inner, override=override) __other._inner = self._inner diff --git a/music_kraken/objects/song.py b/music_kraken/objects/song.py index c9c8c96..93bd9a2 100644 --- a/music_kraken/objects/song.py +++ b/music_kraken/objects/song.py @@ -119,7 +119,7 @@ class Song(Base): def indexing_values(self) -> List[Tuple[str, object]]: return [ ('id', self.id), - ('title', self.unified_title), + ('title', unify(self.unified_title)), ('isrc', self.isrc), *[('url', source.url) for source in self.source_collection] ] @@ -265,7 +265,7 @@ class Album(Base): def indexing_values(self) -> List[Tuple[str, object]]: return [ ('id', self.id), - ('title', self.unified_title), + ('title', unify(self.title)), ('barcode', self.barcode), *[('url', source.url) for source in self.source_collection] ] @@ -530,7 +530,7 @@ class Artist(Base): def indexing_values(self) -> List[Tuple[str, object]]: return [ ('id', self.id), - ('name', self.unified_name), + ('name', unify(self.name)), *[('url', source.url) for source in self.source_collection], *[('contact', contact.value) for contact in self.contact_collection] ] @@ -643,7 +643,7 @@ class Label(Base): def indexing_values(self) -> List[Tuple[str, object]]: return [ ('id', self.id), - ('name', self.unified_name), + ('name', unify(self.name)), *[('url', source.url) for source in self.source_collection] ] diff --git a/music_kraken/utils/string_processing.py b/music_kraken/utils/string_processing.py index f499f9c..570d18e 100644 --- a/music_kraken/utils/string_processing.py +++ b/music_kraken/utils/string_processing.py @@ -16,9 +16,12 @@ def unify(string: str) -> str: """ returns a unified str, to make comparisons easy. a unified string has the following attributes: - - is lowercase + - is lowercase """ + if string is None: + return None + try: string = translit(string, reversed=True) except LanguageDetectionError: