Skip to content

Commit

Permalink
Merge pull request #50 from unifi-toolbox/danielfernau/v2.0.2/49-fix-…
Browse files Browse the repository at this point in the history
…sync-command

fix 'sync' command not working with updated 'ProtectClient'
  • Loading branch information
danielfernau authored May 9, 2021
2 parents 0d392a0 + 980bc37 commit 7b9cfae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
12 changes: 8 additions & 4 deletions protect_archiver/cli/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -67,7 +71,7 @@
def sync(
dest,
address,
port,
not_unifi_os,
username,
password,
verify_ssl,
Expand All @@ -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,
Expand All @@ -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)
3 changes: 2 additions & 1 deletion protect_archiver/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import dateutil.parser

from .client import ProtectClient
from .downloader import Downloader
from .utils import calculate_intervals, json_encode


Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 7b9cfae

Please sign in to comment.