JurajNyiri / pytapo

Python library for communication with Tapo Cameras
MIT License
277 stars 58 forks source link

Added condition when downloading record for notification with stream_status finished #102

Closed vitorsemeano closed 6 months ago

vitorsemeano commented 6 months ago

Closes https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/523

During the download of a record, the camera is sending a json response, notifying that the download finished.

Since the code is not ready for this notification, it never assumed a complete record, entering in a loop between retrying and downloading the same record.

This code prevents the situation, expecting to find the json response, and if such situation occurs, assumes that the download is finished.

For reference, the response to find is the following:

b'{"type":"notification", "params":{"event_type":"stream_status", "status":"finished"}}'

Also added missing dependency rtp for tox.

vitorsemeano commented 6 months ago

Thank you for your PR! Code changes look good, tested with my camera working. Just minor update needed. Let me know if you can do it or if not I can do it after merging your PR.

Sure, i will do the changes now and push shortly.

vitorsemeano commented 6 months ago

@JurajNyiri all done, if you need something else, just ask.

JurajNyiri commented 6 months ago

Thank you!

JurajNyiri commented 6 months ago

Released in https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/releases/tag/5.4.17