starkillerOG / reolink_aio

Reolink NVR/camera API PyPI package
MIT License
79 stars 16 forks source link

Fix for search VOD no files error #22

Closed xannor closed 1 year ago

xannor commented 1 year ago

This fix will add an additional Error class that provides a statuses attribute, and the raise will use that error passing in the retrieved statuses, this will allow the code to function as expected, but provide a trappable means I can use to adjust hard limits.

closes #21

starkillerOG commented 1 year ago

Thanks for this possible solution, but as indeed the returned data does not include the "File" if there was no recording in that period, I chose to simply return a empty list. Besides I already did some of the parsing in this library using the new VOD_file class. Please have a look at it, and add properties if you need more in a PR. It is available in the just released reolink_aio v0.5.13

My simple test code:

vod_files = await host.request_vod_files(channel=0, start=datetime.now() - timedelta(days=2), end=datetime.now(), stream="sub")
for file in vod_files[1]:
        print(file)
        print(file.file_name)