diff --git a/librespot/audio/AudioKeyManager.py b/librespot/audio/AudioKeyManager.py index 3e8f1fa..d320477 100644 --- a/librespot/audio/AudioKeyManager.py +++ b/librespot/audio/AudioKeyManager.py @@ -1,4 +1,7 @@ from __future__ import annotations + +import struct + from librespot.common import Utils from librespot.core import Session from librespot.core.PacketsReceiver import PacketsReceiver @@ -34,7 +37,7 @@ class AudioKeyManager(PacketsReceiver): out = ByteArrayOutputStream() out.write(buffer=bytearray(file_id)) out.write(buffer=bytearray(gid)) - out.write(buffer=bytearray(Utils.to_byte_array(seq))) + out.write(buffer=bytearray(struct.pack(">i", seq))) out.write(buffer=bytearray(self._ZERO_SHORT)) self._session.send(Packet.Type.request_key, out.to_bytes()) diff --git a/librespot/core/Session.py b/librespot/core/Session.py index d97ca41..bb5a4d4 100644 --- a/librespot/core/Session.py +++ b/librespot/core/Session.py @@ -852,7 +852,7 @@ class Session(Closeable, SubListener, DealerClient.MessageListener): class SpotifyAuthenticationException(Exception): def __init__(self, login_failed: Keyexchange.APLoginFailed): - super().__init__(login_failed.error_code.name) + super().__init__(Keyexchange.ErrorCode.Name(login_failed.error_code)) class Accumulator: buffer: bytes = bytes() @@ -974,12 +974,11 @@ class Session(Closeable, SubListener, DealerClient.MessageListener): self.session._LOGGER.fatal( "Failed reading packet! {}".format(ex)) # noinspection PyProtectedMember - self.session._reconnect() + # self.session._reconnect() break if not self.running: break - if cmd == Packet.Type.ping: # noinspection PyProtectedMember if self.session._scheduledReconnect is not None: