Fix "Failed reading packet!" #16

This commit is contained in:
kokarare1212
2021-04-25 08:57:15 +09:00
parent cdb2437161
commit 2b40b47992
2 changed files with 6 additions and 4 deletions

View File

@@ -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())