コード例 #1
0
ファイル: motiondetector.py プロジェクト: freedom27/PiGuard
    def analyze_status(self, status: Status) -> [Event]:

        if "motion" not in status.keys():
            if "picture" in status.keys():
                picture = status["picture"]
                if self._detect_motion(picture):
                    status["motion"] = True
                else:
                    status["motion"] = False
            else:
                return []

        if status["motion"]:
            return [Event.motionDetected]
        else:
            return []
コード例 #2
0
ファイル: motiondetector.py プロジェクト: freedom27/PiGuard
    def analyze_status(self, status: Status) -> [Event]:

        if "motion" not in status.keys():
            if "picture" in status.keys():
                picture = status["picture"]
                if self._detect_motion(picture):
                    status["motion"] = True
                else:
                    status["motion"] = False
            else:
                return []

        if status["motion"]:
            return [Event.motionDetected]
        else:
            return []
コード例 #3
0
def _prepare_json_status(status: Status) -> JSON:
    json_status = dict()

    for item in status.items():
        key, value = item
        if key == "timestamp":
            value = str(value)
        elif key == "picture":
            value = _get_file_name(status["timestamp"])

        json_status[key] = value

    return json_status
コード例 #4
0
ファイル: datasaver.py プロジェクト: freedom27/PiGuard
def _prepare_json_status(status: Status) -> JSON:
    json_status = dict()

    for item in status.items():
        key, value = item
        if key == "timestamp":
            value = str(value)
        elif key == "picture":
            value = _get_file_name(status["timestamp"])

        json_status[key] = value

    return json_status