diff --git a/development/actual_donwload.py b/development/actual_donwload.py index 65d07f9..6c17dd5 100644 --- a/development/actual_donwload.py +++ b/development/actual_donwload.py @@ -7,8 +7,7 @@ logging.getLogger().setLevel(logging.DEBUG) if __name__ == "__main__": commands = [ "s: #a Happy Days", - "7", - "9", + "d: 7", ] diff --git a/music_kraken/objects/collection.py b/music_kraken/objects/collection.py index 9fd9f90..b058630 100644 --- a/music_kraken/objects/collection.py +++ b/music_kraken/objects/collection.py @@ -153,6 +153,8 @@ class Collection(Generic[T]): if other is None: return + if not other._inner._has_data: + return if other.id in self._indexed_from_id: return diff --git a/music_kraken/objects/formatted_text.py b/music_kraken/objects/formatted_text.py index b1891b6..8f9fc52 100644 --- a/music_kraken/objects/formatted_text.py +++ b/music_kraken/objects/formatted_text.py @@ -32,7 +32,7 @@ class FormattedText: if self.is_empty and other.is_empty: return True - return self.doc == other.doc + return self.html == other.html @property def markdown(self) -> str: diff --git a/music_kraken/objects/parents.py b/music_kraken/objects/parents.py index b4f867a..725e2c9 100644 --- a/music_kraken/objects/parents.py +++ b/music_kraken/objects/parents.py @@ -30,6 +30,8 @@ class InnerData: _refers_to_instances: set = None _is_in_collection: set = None + + _has_data: bool = False """ Attribute versions keep track, of if the attribute has been changed. """ @@ -48,9 +50,19 @@ class InnerData: for key, value in kwargs.items(): if hasattr(value, "__is_collection__"): value._collection_for[self] = key - + self.__setattr__(key, value) + if self._has_data: + continue + + def __setattr__(self, key: str, value): + if self._has_data or not hasattr(self, "_default_values"): + return super().__setattr__(key, value) + + super().__setattr__("_has_data", not (key in self._default_values and self._default_values[key] == value)) + return super().__setattr__(key, value) + def __hash__(self): return self.id diff --git a/music_kraken/objects/song.py b/music_kraken/objects/song.py index 33f68a0..beccb2d 100644 --- a/music_kraken/objects/song.py +++ b/music_kraken/objects/song.py @@ -111,7 +111,7 @@ class Song(Base): "album_collection": Collection, "feature_artist_collection": Collection, - "title": lambda: "", + "title": lambda: None, "unified_title": lambda: None, "isrc": lambda: None, "genre": lambda: None,