How to use the amcrest.AmcrestCamera function in amcrest

To help you get started, we’ve selected a few amcrest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tchellomello / python-amcrest / examples / get-files.py View on Github external
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# vim:sw=4:ts=4:et

import datetime
from amcrest import AmcrestCamera

amcrest = AmcrestCamera("192.168.1.10", 80, "admin", "super_password")
camera = amcrest.camera

end_time = datetime.datetime.now()
start_time = end_time - datetime.timedelta(hours=1)

for text in camera.find_files(start_time, end_time):
    for line in text.split("\r\n"):
        key, value = list(line.split("=", 1) + [None])[:2]
        if key.endswith(".FilePath"):
            print("Found file {}".format(value))
            if value.endswith(".jpg"):
                file_name = value

if file_name:
    print("Downloading {}...".format(file_name))
    with open("snapshot.jpg", "w") as file:
github tchellomello / python-amcrest / amcrest / amcrest_cli.py View on Github external
help='port to Amcrest camera. Default: 80')
    parser.add_argument('--get-current-time',
                        action='store_true',
                        help='Get camera current time')
    parser.add_argument('--motion-detection-status',
                        action='store_true',
                        help='Return motion detection status.')
    parser.add_argument('--enable-motion-detection',
                        action='store_true',
                        help='Enable motion detection.')
    parser.add_argument('--disable-motion-detection',
                        action='store_true',
                        help='Disable motion detection.')
    args = parser.parse_args()

    camera = AmcrestCamera(
        args.hostname,
        args.port,
        args.username,
        args.password
    )
    if args.get_current_time:
        print(camera.get_current_time())

    elif args.motion_detection_status:
        print(camera.is_motion_detection_enabled())

    elif args.enable_motion_detection:
        if camera.is_motion_detection_enabled():
            print("Nothing to do, motion detected, already enabled!")
            return
github tchellomello / python-amcrest / examples / get-logs.py View on Github external
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# vim:sw=4:ts=4:et

import datetime
from amcrest import AmcrestCamera

amcrest = AmcrestCamera("192.168.1.10", 80, "admin", "super_password")
camera = amcrest.camera

end_time = datetime.datetime.now()
start_time = end_time - datetime.timedelta(hours=1)

for text in camera.log_find(start_time, end_time):
    print(text)

amcrest

Python wrapper implementation for Amcrest cameras.

GPL-2.0
Latest version published 1 year ago

Package Health Score

50 / 100
Full package analysis