starkillerOG / reolink_aio

Reolink NVR/camera API PyPI package
MIT License
68 stars 13 forks source link

search_vod_files eats usefull info on error. #21

Closed xannor closed 1 year ago

xannor commented 1 year ago

Describe the bug request_vod_files throws an error when search returns no results. This has the side effect of "eating" the search status which provides the possible ranges with in the specified search, making any search that exceeds existing recordings fail with no way to narrow the search progamatically.

To Reproduce search outside the current storage window (i.e. a month prior to first recording)

Expected behavior A way to keep the status results so search window can be narrowed intelligently.

Screenshots N/A

Environment: Please provide useful information about your environment, like:

Additional context I am creating the issue so I can provide and submit a pull request to fix it.

starkillerOG commented 1 year ago

@xannor thanks for figuring this out!

I have verifyed this bug and fixed it by simply not raising the error and returning an empty list. Indeed if a start/end datetime is used in which no recordings are available, the "File" will not be present in the response.

I also changed the request_vod_files function, to now use the new VOD_file class, that gives easy acces to the properties needed in HomeAssistant. If more is needed in this class, please feel free to add them in a PR.