ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
635 stars 31 forks source link

Add option to supply extra args to rclone #11

Closed Sticklyman1936 closed 2 years ago

Sticklyman1936 commented 2 years ago

Some users have slower internet connections, and therefore don't wish to fully saturate upload bandwidth whenever a new camera event is triggered. However, rclone provides the --bwlimit arg which allows one to specify global/download/upload bandwidth limits (and schedules).

By default this limit is disabled, however if --rclone-bw-limit is set, or the corresponding RCLONE_BW_LIMIT environment variable is set, then this is passed directly through to rclone.

ep1cman commented 2 years ago

Thanks for the contribution, great idea :D

A couple of notes 1) Could you update the usage and env vars etc. in the readme.md 2) Just to check does rclone work with command specified as follows:

rclone rcat -vv '{destination}' --bwlimit={bw_limit}

or does it need to be:

rclone rcat -vv --bwlimit={bw_limit} '{destination}' 
Sticklyman1936 commented 2 years ago

Could you update the usage and env vars etc. in the readme.md

Oops, my bad!

Just to check does rclone work with command...

Good question - yes, it works fine, but maybe we want it in the other order for clarity. What are your thoughts?

As an alternative, maybe this whole change should be reformated to accept "--rclone-extra-args" or similar?

ep1cman commented 2 years ago

About having the args before the output path, I think that would be the clearest way to do it.

On the idea of changing it to be a generic args feature, I'm in two minds. I really like that this currently explicitly calls out bandwidth as a settings, but at the same time it feels redundant to include it along side generic arguments. Maybe a happy medium would be having it be a generic aguments field, but document some commonly used ones in examples?

Sticklyman1936 commented 2 years ago

The commit has been changed to instead provide --rclone-args and RCLONE_ARGS the values of which are passed verbatim to rclone rcat.