danielfernau / unifi-protect-video-downloader

Tool for downloading footage from a local UniFi Protect system
https://ui-protect-dl-docs.danielfernau.com/
MIT License
469 stars 53 forks source link

This can be None #427

Open drozzy opened 4 months ago

drozzy commented 4 months ago

data can be none (as set by the code within exception clause above). This failed on me already.

https://github.com/danielfernau/unifi-protect-video-downloader/blob/530299dddb96554a75eacc74576b674ad9295f1a/protect_archiver/downloader/download_file.py#L86

danielfernau commented 4 months ago

Hi and thanks for reporting. You have created a PR but deleted it afterwards - is this issue still relevant and you just wanted to try something that didn't work? Let me know if you need me to have another look at it.

drozzy commented 4 months ago

I deleted that by mistake. But PR was just a single line change in download_file.py. This:

try:
    data = json.loads(response.content)
except Exception:
    data = None

Becomes this:

try:
    data = json.loads(response.content)
except Exception:
    data = {}
danielfernau commented 4 months ago

Alright, yes, that makes sense. Will add it later and bundle an update. Thanks!