This repository has been archived on 2023-06-10. You can view files and clone it, but cannot push or open issues or pull requests.
homeassistant-config/deps/lib/python3.10/site-packages/pytapo/media_stream/temp.py
darthsandmann d1289421b9 updates
2023-02-11 19:37:07 +01:00

23 lines
922 B
Python

"""
if not self.sentAudio:
self.sentAudio = True
print("Read")
with open("sample.mp2", mode="rb") as file: # b is important -> binary
fileContent = file.read()
data = fileContent
headers = {}
headers[b"Content-Type"] = str("audio/mp2t").encode()
headers[b"X-Session-Id"] = str(session).encode()
headers[b"Content-Length"] = str(len(data)).encode()
await self._send_http_request(b"--" + self.client_boundary, headers)
chunk_size = 4096
for i in range(0, len(data), chunk_size):
print(data[i : i + chunk_size])
self._writer.write(data[i : i + chunk_size])
await self._writer.drain()
print("sending payload")
"""