From 80ad2727de22762641b06f3c39a1cfd6eb5a68f4 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Wed, 15 May 2024 17:14:01 +0200 Subject: [PATCH] fix: stream retry --- music_kraken/connection/connection.py | 2 +- music_kraken/objects/song.py | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/music_kraken/connection/connection.py b/music_kraken/connection/connection.py index 44fdd5f..31e4b8a 100644 --- a/music_kraken/connection/connection.py +++ b/music_kraken/connection/connection.py @@ -317,7 +317,7 @@ class Connection: name = kwargs.pop("description") if progress > 0: - headers = dict() if headers is None else headers + headers = kwargs.get("headers", dict()) headers["Range"] = f"bytes={target.size}-" r = self.request( diff --git a/music_kraken/objects/song.py b/music_kraken/objects/song.py index 8b5953b..8e30a9a 100644 --- a/music_kraken/objects/song.py +++ b/music_kraken/objects/song.py @@ -155,9 +155,6 @@ class Song(Base): self.main_artist_collection.extend_object_to_attribute = { "main_album_collection": self.album_collection } - self.feature_artist_collection.append_object_to_attribute = { - "feature_song_collection": self - } self.feature_artist_collection.push_to = [self.main_artist_collection] self.main_artist_collection.pull_from = [self.feature_artist_collection] @@ -464,7 +461,6 @@ class Artist(Base): source_collection: SourceCollection contact_collection: Collection[Contact] - feature_song_collection: Collection[Song] main_album_collection: Collection[Album] label_collection: Collection[Label] @@ -479,7 +475,6 @@ class Artist(Base): "general_genre": lambda: "", "source_collection": SourceCollection, - "feature_song_collection": Collection, "main_album_collection": Collection, "contact_collection": Collection, "label_collection": Collection, @@ -511,14 +506,10 @@ class Artist(Base): Base.__init__(**real_kwargs) - DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = ("main_album_collection", "feature_song_collection") + DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = ("main_album_collection",) UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("label_collection",) def __init_collections__(self): - self.feature_song_collection.append_object_to_attribute = { - "feature_artist_collection": self - } - self.main_album_collection.append_object_to_attribute = { "artist_collection": self } @@ -530,7 +521,6 @@ class Artist(Base): def _add_other_db_objects(self, object_type: Type[OuterProxy], object_list: List[OuterProxy]): if object_type is Song: # this doesn't really make sense - # self.feature_song_collection.extend(object_list) return if object_type is Artist: @@ -628,8 +618,6 @@ class Artist(Base): if len(self.main_album_collection) > 0: r += f" with {len(self.main_album_collection)} albums" - if len(self.feature_song_collection) > 0: - r += f" featured in {len(self.feature_song_collection)} songs" r += BColors.ENDC.value return r