From be843f2c10d175b4e38a86420ef187b4f162680d Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Tue, 30 Apr 2024 17:43:00 +0200 Subject: [PATCH] draft: improved debug even more --- music_kraken/objects/collection.py | 4 +++- music_kraken/objects/parents.py | 4 ++++ music_kraken/objects/song.py | 2 +- music_kraken/objects/source.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/music_kraken/objects/collection.py b/music_kraken/objects/collection.py index ec43ab3..46b0be1 100644 --- a/music_kraken/objects/collection.py +++ b/music_kraken/objects/collection.py @@ -50,7 +50,7 @@ class Collection(Generic[T]): self.extend(data) def __repr__(self) -> str: - return f"Collection({id(self)})" + return f"Collection({' | '.join(self._collection_for.values())} {id(self)})" def _map_element(self, __object: T, from_map: bool = False): self._unmap_element(__object.id) @@ -111,6 +111,8 @@ class Collection(Generic[T]): if __object is None: return + object_trace(f"Appending {__object.option_string} {__object.id} to {self}") + existing_object, map_to = self._find_object(__object, no_push_to=kwargs.get("no_push_to", False)) if map_to is self: diff --git a/music_kraken/objects/parents.py b/music_kraken/objects/parents.py index c0669c0..15aed6b 100644 --- a/music_kraken/objects/parents.py +++ b/music_kraken/objects/parents.py @@ -243,6 +243,10 @@ class OuterProxy: return r + @property + def option_string(self) -> str: + return self.title_string + INDEX_DEPENDS_ON: List[str] = [] @property diff --git a/music_kraken/objects/song.py b/music_kraken/objects/song.py index ee9f689..59c67a4 100644 --- a/music_kraken/objects/song.py +++ b/music_kraken/objects/song.py @@ -348,7 +348,7 @@ class Album(Base): @property def option_string(self) -> str: - r = OPTION_FOREGROUND.value + self.title + BColors.ENDC.value + OPTION_BACKGROUND.value + r = OPTION_FOREGROUND.value + self.title_string + BColors.ENDC.value + OPTION_BACKGROUND.value r += get_collection_string(self.artist_collection, " by {}") r += get_collection_string(self.label_collection, " under {}") diff --git a/music_kraken/objects/source.py b/music_kraken/objects/source.py index d20d571..b7e483a 100644 --- a/music_kraken/objects/source.py +++ b/music_kraken/objects/source.py @@ -30,7 +30,7 @@ class Source: def __post_init__(self): self.referrer_page = self.referrer_page or self.page_enum - @cached_property + @property def parsed_url(self) -> ParseResult: return urlparse(self.url)