Prepare V0.2

This commit is contained in:
unknown
2025-12-18 20:21:21 +01:00
parent 3f0f402b14
commit 7054dc1dfe
3 changed files with 77 additions and 59 deletions

View File

@@ -327,6 +327,17 @@ class AudioKeyManager(PacketsReceiver, Closeable):
spoticlub_loaded_logged = True
print(f"\n[SpotiClub API] Plugin Loaded! Welcome {spoticlub_user}\n")
# Try to show a Zotify loader while we fetch the remote audio key.
# The import is done lazily here to avoid hard circular imports.
loader = None
try:
from zotify.loader import Loader # type: ignore
from zotify.termoutput import PrintChannel # type: ignore
loader = Loader(PrintChannel.PROGRESS_INFO, "Fetching audio key...")
loader.start()
except Exception:
loader = None
payload = {
"gid": util.bytes_to_hex(gid),
"file_id": util.bytes_to_hex(file_id),
@@ -339,6 +350,7 @@ class AudioKeyManager(PacketsReceiver, Closeable):
tries = 0
last_err: typing.Optional[Exception] = None
try:
while True:
tries += 1
try:
@@ -406,6 +418,12 @@ class AudioKeyManager(PacketsReceiver, Closeable):
raise RuntimeError(
"Failed fetching Audio Key from API for gid: {}, fileId: {} (last error: {})".format(
util.bytes_to_hex(gid), util.bytes_to_hex(file_id), last_err))
finally:
if loader is not None:
try:
loader.stop()
except Exception:
pass
class Callback:

Binary file not shown.