fix: dynamic unified title
This commit is contained in:
parent
92495f73fd
commit
29e2b4616e
26
development/objects_collection.py
Normal file
26
development/objects_collection.py
Normal file
@ -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)
|
@ -177,6 +177,8 @@ class OuterProxy:
|
|||||||
_ = "debug"
|
_ = "debug"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
print(__other)
|
||||||
|
|
||||||
self._inner.__merge__(__other._inner, override=override)
|
self._inner.__merge__(__other._inner, override=override)
|
||||||
__other._inner = self._inner
|
__other._inner = self._inner
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class Song(Base):
|
|||||||
def indexing_values(self) -> List[Tuple[str, object]]:
|
def indexing_values(self) -> List[Tuple[str, object]]:
|
||||||
return [
|
return [
|
||||||
('id', self.id),
|
('id', self.id),
|
||||||
('title', self.unified_title),
|
('title', unify(self.unified_title)),
|
||||||
('isrc', self.isrc),
|
('isrc', self.isrc),
|
||||||
*[('url', source.url) for source in self.source_collection]
|
*[('url', source.url) for source in self.source_collection]
|
||||||
]
|
]
|
||||||
@ -265,7 +265,7 @@ class Album(Base):
|
|||||||
def indexing_values(self) -> List[Tuple[str, object]]:
|
def indexing_values(self) -> List[Tuple[str, object]]:
|
||||||
return [
|
return [
|
||||||
('id', self.id),
|
('id', self.id),
|
||||||
('title', self.unified_title),
|
('title', unify(self.title)),
|
||||||
('barcode', self.barcode),
|
('barcode', self.barcode),
|
||||||
*[('url', source.url) for source in self.source_collection]
|
*[('url', source.url) for source in self.source_collection]
|
||||||
]
|
]
|
||||||
@ -530,7 +530,7 @@ class Artist(Base):
|
|||||||
def indexing_values(self) -> List[Tuple[str, object]]:
|
def indexing_values(self) -> List[Tuple[str, object]]:
|
||||||
return [
|
return [
|
||||||
('id', self.id),
|
('id', self.id),
|
||||||
('name', self.unified_name),
|
('name', unify(self.name)),
|
||||||
*[('url', source.url) for source in self.source_collection],
|
*[('url', source.url) for source in self.source_collection],
|
||||||
*[('contact', contact.value) for contact in self.contact_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]]:
|
def indexing_values(self) -> List[Tuple[str, object]]:
|
||||||
return [
|
return [
|
||||||
('id', self.id),
|
('id', self.id),
|
||||||
('name', self.unified_name),
|
('name', unify(self.name)),
|
||||||
*[('url', source.url) for source in self.source_collection]
|
*[('url', source.url) for source in self.source_collection]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ def unify(string: str) -> str:
|
|||||||
- is lowercase
|
- is lowercase
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if string is None:
|
||||||
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
string = translit(string, reversed=True)
|
string = translit(string, reversed=True)
|
||||||
except LanguageDetectionError:
|
except LanguageDetectionError:
|
||||||
|
Loading…
Reference in New Issue
Block a user