diff --git a/librespot/audio/AudioKeyManager.py b/librespot/audio/AudioKeyManager.py index 2f10285..6342713 100644 --- a/librespot/audio/AudioKeyManager.py +++ b/librespot/audio/AudioKeyManager.py @@ -3,7 +3,7 @@ from librespot.common import Utils from librespot.core import Session from librespot.core.PacketsReceiver import PacketsReceiver from librespot.crypto import Packet -from librespot.standard import BytesInputStream, BytesOutputStream +from librespot.standard import BytesInputStream, ByteArrayOutputStream import logging import queue import threading @@ -30,13 +30,13 @@ class AudioKeyManager(PacketsReceiver): seq = self._seqHolder self._seqHolder += 1 - out = BytesOutputStream() - out.write(file_id) - out.write(gid) - out.write_int(seq) - out.write(self._ZERO_SHORT) + 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(self._ZERO_SHORT)) - self._session.send(Packet.Type.request_key, out.buffer) + self._session.send(Packet.Type.request_key, out.to_bytes()) callback = AudioKeyManager.SyncCallback(self) self._callbacks[seq] = callback diff --git a/librespot/core/Session.py b/librespot/core/Session.py index 10c9bf3..5285b05 100644 --- a/librespot/core/Session.py +++ b/librespot/core/Session.py @@ -233,8 +233,8 @@ class Session(Closeable, SubListener, DealerClient.MessageListener): self._LOGGER.info("Connection successfully!") - def authenticate(self, - credentials: Authentication.LoginCredentials) -> None: + def _authenticate(self, + credentials: Authentication.LoginCredentials) -> None: self._authenticate_partial(credentials, False) with self._authLock: @@ -707,7 +707,7 @@ class Session(Closeable, SubListener, DealerClient.MessageListener): self.device_id), ApResolver.get_random_accesspoint()) session._connect() - session.authenticate(self.login_credentials) + session._authenticate(self.login_credentials) return session class Configuration: