Compare commits
No commits in common. "542d59562a8c8bcf6c55920b8ecb1d1fc231c805" and "ed8cc914bec7456eb2a9fd8133af25ce20d15fce" have entirely different histories.
542d59562a
...
ed8cc914be
@ -88,9 +88,6 @@ class Collection(Generic[T]):
|
||||
def _find_object(self, __object: T, **kwargs) -> Optional[T]:
|
||||
self._remap()
|
||||
|
||||
if __object.id in self._indexed_from_id:
|
||||
return self._indexed_values["id"][__object.id]
|
||||
|
||||
for name, value in __object.indexing_values:
|
||||
if value in self._indexed_values[name]:
|
||||
return self._indexed_values[name][value]
|
||||
@ -141,6 +138,7 @@ class Collection(Generic[T]):
|
||||
:return:
|
||||
"""
|
||||
|
||||
|
||||
if other is None:
|
||||
return
|
||||
if other.id in self._indexed_from_id:
|
||||
@ -148,6 +146,13 @@ class Collection(Generic[T]):
|
||||
|
||||
object_trace(f"Appending {other.option_string} to {self}")
|
||||
|
||||
# switching collection in the case of push to
|
||||
for c in self.push_to:
|
||||
r = c._find_object(other)
|
||||
if r is not None:
|
||||
output("found push to", r, other, self, color=BColors.RED, sep="\t")
|
||||
return c.append(other, **kwargs)
|
||||
|
||||
|
||||
for c in self.pull_from:
|
||||
r = c._find_object(other)
|
||||
@ -158,13 +163,6 @@ class Collection(Generic[T]):
|
||||
break
|
||||
|
||||
existing_object = self._find_object(other)
|
||||
|
||||
# switching collection in the case of push to
|
||||
for c in self.push_to:
|
||||
r = c._find_object(other)
|
||||
if r is not None:
|
||||
output("found push to", r, other, self, color=BColors.RED, sep="\t")
|
||||
return c.append(other, **kwargs)
|
||||
|
||||
if existing_object is None:
|
||||
self._append_new_object(other, **kwargs)
|
||||
@ -197,8 +195,8 @@ class Collection(Generic[T]):
|
||||
if other_collections is None:
|
||||
return
|
||||
|
||||
for other_object in other_collections:
|
||||
self.append(other_object, **kwargs)
|
||||
for __object in other_collections:
|
||||
self.append(__object, **kwargs)
|
||||
|
||||
@property
|
||||
def data(self) -> List[T]:
|
||||
|
@ -60,13 +60,6 @@ class InnerData:
|
||||
self._fetched_from.update(__other._fetched_from)
|
||||
|
||||
for key, value in __other.__dict__.copy().items():
|
||||
if key.startswith("_"):
|
||||
continue
|
||||
|
||||
if hasattr(value, "__is_collection__") and key in self.__dict__:
|
||||
self.__getattribute__(key).__merge__(value, **kwargs)
|
||||
continue
|
||||
|
||||
# just set the other value if self doesn't already have it
|
||||
if key not in self.__dict__ or (key in self.__dict__ and self.__dict__[key] == self._default_values.get(key)):
|
||||
self.__setattr__(key, value)
|
||||
@ -74,8 +67,9 @@ class InnerData:
|
||||
|
||||
# if the object of value implemented __merge__, it merges
|
||||
existing = self.__getattribute__(key)
|
||||
if hasattr(existing, "__merge__"):
|
||||
if hasattr(type(existing), "__merge__"):
|
||||
existing.__merge__(value, **kwargs)
|
||||
continue
|
||||
|
||||
|
||||
class OuterProxy:
|
||||
|
@ -690,6 +690,13 @@ class Musify(Page):
|
||||
new_song = self._parse_song_card(card_soup)
|
||||
album.song_collection.append(new_song)
|
||||
|
||||
if stop_at_level > 1:
|
||||
song: Song
|
||||
for song in album.song_collection:
|
||||
sources = song.source_collection.get_sources(self.SOURCE_TYPE)
|
||||
for source in sources:
|
||||
song.merge(self.fetch_song(source=source))
|
||||
|
||||
album.update_tracksort()
|
||||
|
||||
return album
|
||||
|
Loading…
Reference in New Issue
Block a user