ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
577 stars 25 forks source link

Feature Request: Customizable Folder Layout #30

Closed ircmaxell closed 2 years ago

ircmaxell commented 2 years ago

Description

Presently, the backup script syncs with a folder structure of /{camera_name}/{date}/video_file. While this is great from an archival purpose, it's less ideal for other usages (correlating events, etc).

I'd love an option to flatten the structure by date and potentially time. So something like: /{date}/{hour}/{YYYY-MM-DDTHH:mm:ss}_{camera_name}_{event_type}.mp4 or potentially without the hour-resolution sub-folder.

One alternative to this would be to templatize the naming format with the appropriate variables to allow users to customize the filesystem layout.

ep1cman commented 2 years ago

Hi, thanks for the feature request. I've taken a stab at allowing the file path to be templated and this is available on the dev branch/container depending on how you use the tool. I would appreciate if you could test it out and see if its suitable.

Docs can be found here: https://github.com/ep1cman/unifi-protect-backup/tree/dev#file-path-formatting

ircmaxell commented 2 years ago

Successfully implemented and working well. Thanks for the quick implementation!

One note, the ENV var for the docker container isn't documented. Could be worth tossing FILE_STRUCTURE_FORMAT into the docs for it as well. Otherwise, working well!

ep1cman commented 2 years ago

It is listed in the README.md file, are you referring to the fact its not in the dockerfile?

ircmaxell commented 2 years ago

Whoops, I had missed that. I looked for it and didn't notice, so went and looked at the commit to find it. It was there all along.

Thanks again for the support, and the rapid turn around here! I'll go ahead a close since this is implemented. Thanks!

ep1cman commented 2 years ago

I will create a new release with this and the fixes for your other issue shortly