Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
Use minimum days to 120 instead of 180 since it was being blocked by …
Browse files Browse the repository at this point in the history
…Arlo
  • Loading branch information
tchellomello committed Jun 2, 2018
1 parent 9f00765 commit 7d560e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pyarlo/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@
class ArloCamera(object):
"""Arlo Camera module implementation."""

def __init__(self, name, attrs, arlo_session):
def __init__(self, name, attrs, arlo_session, min_days_vdo_cache=120):
"""Initialize Arlo camera object.
:param name: Camera name
:param attrs: Camera attributes
:param arlo_session: PyArlo shared session
:param min_days_vdo_cache: Minium number of days to preload in video cache
"""
self.name = name
self._attrs = attrs
self._session = arlo_session
self._cached_videos = None
self._min_days_vdo_cache = min_days_vdo_cache

def __repr__(self):
"""Representation string of object."""
Expand Down Expand Up @@ -129,16 +131,20 @@ def last_video(self):
return self._cached_videos[0]
return None

def make_video_cache(self, days=180):
def make_video_cache(self, days=None):
"""Save videos on _cache_videos to avoid dups."""
if days is None:
days = self._min_days_vdo_cache
self._cached_videos = self.videos(days)

def videos(self, days=180):
def videos(self, days=None):
"""
Return all <ArloVideo> objects from camera given days range
:param days: number of days to retrieve
"""
if days is None:
days = self._min_days_vdo_cache
library = ArloMediaLibrary(self._session, preload=False)
try:
return library.load(only_cameras=[self], days=days)
Expand Down

0 comments on commit 7d560e2

Please sign in to comment.