Prepare V0.2
This commit is contained in:
@@ -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:
|
||||
|
||||
|
||||
BIN
librespot/audio/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
librespot/audio/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user