fix/clean_feature_artists #38
@ -115,6 +115,7 @@ class Collection(Generic[T]):
|
||||
self._data.append(other)
|
||||
other._inner._is_in_collection.add(self)
|
||||
|
||||
"""
|
||||
for attribute, a in self.sync_on_append.items():
|
||||
# syncing two collections by reference
|
||||
b = other.__getattribute__(attribute)
|
||||
@ -133,6 +134,7 @@ class Collection(Generic[T]):
|
||||
a._collection_for[synced_with] = key
|
||||
|
||||
a.extend(b_data, **kwargs)
|
||||
"""
|
||||
|
||||
# all of the existing hooks to get the defined datastructures
|
||||
for collection_attribute, generator in self.extend_object_to_attribute.items():
|
||||
|
@ -148,7 +148,7 @@ class Song(Base):
|
||||
self.feature_artist_collection.push_to = [self.artist_collection]
|
||||
self.artist_collection.pull_from = [self.feature_artist_collection]
|
||||
|
||||
self.album_collection.sync_on_append = {
|
||||
self.album_collection.extend_object_to_attribute = {
|
||||
"artist_collection": self.artist_collection,
|
||||
}
|
||||
|
||||
@ -159,10 +159,6 @@ class Song(Base):
|
||||
"album_collection": self.album_collection
|
||||
}
|
||||
|
||||
self.album_collection.append_object_to_attribute = {
|
||||
"artist_collection": self
|
||||
}
|
||||
|
||||
def _add_other_db_objects(self, object_type: Type[OuterProxy], object_list: List[OuterProxy]):
|
||||
if object_type is Song:
|
||||
return
|
||||
@ -223,7 +219,7 @@ class Song(Base):
|
||||
r = OPTION_FOREGROUND.value + self.title_string + BColors.ENDC.value + OPTION_BACKGROUND.value
|
||||
r += get_collection_string(self.album_collection, " from {}", ignore_titles={self.title})
|
||||
r += get_collection_string(self.artist_collection, " by {}")
|
||||
r += get_collection_string(self.feature_artist_collection, " feat. {}")
|
||||
r += get_collection_string(self.feature_artist_collection, " feat. {}" if len(self.artist_collection) > 0 else " by {}")
|
||||
return r
|
||||
|
||||
@property
|
||||
@ -311,7 +307,7 @@ class Album(Base):
|
||||
self.song_collection.append_object_to_attribute = {
|
||||
"album_collection": self
|
||||
}
|
||||
self.song_collection.sync_on_append = {
|
||||
self.song_collection.extend_object_to_attribute = {
|
||||
"artist_collection": self.artist_collection
|
||||
}
|
||||
|
||||
@ -372,6 +368,7 @@ class Album(Base):
|
||||
def option_string(self) -> str:
|
||||
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.feature_artist_collection, " feat. {}" if len(self.artist_collection) > 0 else " by {}")
|
||||
r += get_collection_string(self.label_collection, " under {}")
|
||||
|
||||
if len(self.song_collection) > 0:
|
||||
@ -526,6 +523,10 @@ class Artist(Base):
|
||||
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("label_collection",)
|
||||
|
||||
def __init_collections__(self):
|
||||
self.album_collection.append_object_to_attribute = {
|
||||
"feature_artist_collection": self
|
||||
}
|
||||
|
||||
self.label_collection.append_object_to_attribute = {
|
||||
"current_artist_collection": self
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ if not load_dotenv(Path(__file__).parent.parent.parent / ".env"):
|
||||
|
||||
__stage__ = os.getenv("STAGE", "prod")
|
||||
|
||||
DEBUG = (__stage__ == "dev") and False
|
||||
DEBUG = (__stage__ == "dev") and True
|
||||
DEBUG_LOGGING = DEBUG and False
|
||||
DEBUG_TRACE = DEBUG and True
|
||||
DEBUG_OBJECT_TRACE = DEBUG and False
|
||||
DEBUG_OBJECT_TRACE = DEBUG and True
|
||||
DEBUG_OBJECT_TRACE_CALLSTACK = DEBUG_OBJECT_TRACE and False
|
||||
DEBUG_YOUTUBE_INITIALIZING = DEBUG and False
|
||||
DEBUG_PAGES = DEBUG and False
|
||||
|
Loading…
Reference in New Issue
Block a user