From 57262c9fff666f48090bd62513b9af4c0625cab8 Mon Sep 17 00:00:00 2001 From: Daniel Fernau Date: Sun, 9 May 2021 12:07:46 +0200 Subject: [PATCH 1/2] bump package version to 2.0.2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e227b67..6d1022a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "protect-archiver" -version = "2.0.1" +version = "2.0.2" description = "" authors = ["Daniel Fernau", "David Cramer"] license = "MIT" From 980bc37502054234d1e54c3bbfe4c275bf81a4f5 Mon Sep 17 00:00:00 2001 From: Daniel Fernau Date: Sun, 9 May 2021 12:08:45 +0200 Subject: [PATCH 2/2] fix 'sync' command not working with updated 'ProtectClient' --- protect_archiver/cli/sync.py | 12 ++++++++---- protect_archiver/sync.py | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/protect_archiver/cli/sync.py b/protect_archiver/cli/sync.py index 40ce099..facd133 100644 --- a/protect_archiver/cli/sync.py +++ b/protect_archiver/cli/sync.py @@ -20,7 +20,11 @@ help="CloudKey IP address or hostname", ) @click.option( - "--port", default=7443, show_default=True, help="UniFi Protect service port" + "--not-unifi-os", + is_flag=True, + default=False, + show_default=True, + help="Use this for systems without UniFi OS", ) @click.option( "--username", @@ -67,7 +71,7 @@ def sync( dest, address, - port, + not_unifi_os, username, password, verify_ssl, @@ -86,7 +90,7 @@ def sync( client = ProtectClient( address=address, - port=port, + not_unifi_os=not_unifi_os, username=username, password=password, verify_ssl=verify_ssl, @@ -106,4 +110,4 @@ def sync( process = ProtectSync(client=client, destination_path=dest, statefile=statefile) process.run(camera_list, ignore_state=ignore_state) - print_download_stats() + print_download_stats(client) diff --git a/protect_archiver/sync.py b/protect_archiver/sync.py index e181e88..3307640 100644 --- a/protect_archiver/sync.py +++ b/protect_archiver/sync.py @@ -7,6 +7,7 @@ import dateutil.parser from .client import ProtectClient +from .downloader import Downloader from .utils import calculate_intervals, json_encode @@ -52,7 +53,7 @@ def run(self, camera_list: list, ignore_state: bool = False): ) end = datetime.now().replace(minute=0, second=0, microsecond=0) for interval_start, interval_end in calculate_intervals(start, end): - self.client.download_footage(interval_start, interval_end, camera) + Downloader.download_footage(self.client, interval_start, interval_end, camera) state["cameras"][camera.id] = { "last": interval_end, "name": camera.name,