Skip to content

Commit a5a03ed

Browse files
authored
Merge pull request #96 from tchellomello/version_1_2_2
Version 1.2.2
2 parents 3962240 + 81713b1 commit a5a03ed

16 files changed

+112
-67
lines changed

README.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,18 @@ Supportability Matrix
136136
+-------------------------+---------------+----------+-----------------+
137137
| IP2M-841B/841W/842W | Yes | working | |
138138
+-------------------------+---------------+----------+-----------------+
139+
| IP3M-956B | Yes | working | |
140+
+-------------------------+---------------+----------+-----------------+
139141
| IP3M-956E | Yes | working | |
140142
+-------------------------+---------------+----------+-----------------+
143+
| IP3M-956W | Yes | working | |
144+
+-------------------------+---------------+----------+-----------------+
141145
| IPM-HX1B | Yes | working | |
142146
+-------------------------+---------------+----------+-----------------+
143-
147+
| IP3M-941 | Yes | working | |
148+
+-------------------------+---------------+----------+-----------------+
149+
| IP3M-HX2 | Yes (partial) | working | |
150+
+-------------------------+---------------+----------+-----------------+
144151
If you have different model, feel fee to contribute and report your results.
145152

146153

cli/amcrest-cli

+7-60
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def main():
493493
if len(config.sections()) > 1 and not args.camera:
494494
print("More than 1 camera found at %s. "
495495
"Append the --camera option." % AMCREST_CONF)
496-
return
496+
sys.exit(-1)
497497

498498
if args.camera:
499499
section = args.camera
@@ -510,7 +510,7 @@ def main():
510510
args.password = getpass.getpass()
511511
except (NoSectionError, NoOptionError) as e:
512512
print("ERROR! %s found at %s" % (e, AMCREST_CONF))
513-
return
513+
sys.exit(-1)
514514

515515
amcrest = AmcrestCamera(
516516
args.hostname,
@@ -526,18 +526,15 @@ def main():
526526
print(("Looks like amcrest device: {0}".format(ret)))
527527
else:
528528
print("No devices found, try again later!")
529-
return
530529

531530
if args.username and args.hostname and args.password:
532531

533532
if args.telnet_config == -1:
534533
print((camera.telnet_config))
535-
return
536534

537535
elif args.mjpg_stream:
538536
if not args.save:
539537
print("This option requires --save")
540-
return
541538

542539
timer_capture = float(args.mjpg_stream[0])
543540

@@ -553,15 +550,12 @@ def main():
553550

554551
print((camera.mjpg_stream(
555552
channelno, typeno, path_file=args.save)))
556-
return
557553

558554
elif args.reboot:
559555
print((camera.reboot()))
560-
return
561556

562557
elif args.shutdown:
563558
print((camera.shutdown()))
564-
return
565559

566560
elif args.audio_send_stream:
567561
if len(args.audio_send_stream) <= 3:
@@ -574,12 +568,10 @@ def main():
574568
codec = args.audio_send_stream[3]
575569

576570
camera.audio_send_stream(httptype, channel, filename, codec)
577-
return
578571

579572
elif args.audio_stream_capture:
580573
if not args.save:
581574
print("This option requires --save")
582-
return
583575

584576
if len(args.audio_stream_capture) <= 2:
585577
print("Requires arguments: httptype, channel, timer_capture!")
@@ -598,36 +590,30 @@ def main():
598590
camera.audio_stream_capture(httptype, channel)
599591

600592
elif args.play_wav:
601-
return camera.play_wav(path_file=args.play_wav)
593+
camera.play_wav(path_file=args.play_wav)
602594

603595
elif args.wlan_config:
604596
print((camera.wlan_config))
605-
return
606597

607598
elif args.scan_wlan_devices:
608599
print((camera.scan_wlan_devices(args.scan_wlan_devices)))
609-
return
610600

611601
elif args.telnet_config:
612602
camera.telnet_config = args.telnet_config
613-
return
614603

615604
elif args.ptz_config:
616605
print((camera.ptz_config))
617-
return
618606

619607
elif args.ptz_auto_movement:
620608
print((camera.ptz_auto_movement))
621-
return
622609

623610
elif args.ptz_presets_list:
624611
print((camera.ptz_presets_list()))
625-
return
626612

627613
elif args.ptz_goto_preset:
628614
if len(args.ptz_goto_preset) < 2:
629615
print("Requires arguments: channel preset_point_number")
630-
return
616+
sys.exit(-1)
631617

632618
action = 'start'
633619
channel = args.ptz_goto_preset[0]
@@ -636,104 +622,73 @@ def main():
636622

637623
elif args.log_clear_all:
638624
print((camera.log_clear_all))
639-
return
640625

641626
elif args.video_standard == -1:
642627
print((camera.video_standard))
643-
return
644628

645629
elif args.video_standard:
646630
camera.video_standard = args.video_standard
647-
return
648631

649632
elif args.coordinates_current_window:
650633
print((camera.coordinates_current_window(
651634
args.coordinates_current_window)))
652-
return
653635

654636
elif args.video_widget_config:
655637
print((camera.video_widget_config))
656-
return
657638

658639
elif args.video_input_capability:
659640
print((camera.video_input_capability))
660-
return
661641

662642
elif args.video_in_options:
663643
print((camera.video_in_options))
664-
return
665644

666645
elif args.video_out_options:
667646
print((camera.video_out_options))
668-
return
669647

670648
elif args.video_max_remote_input_channels:
671649
print((camera.video_max_remote_input_channels))
672-
return
673650

674651
elif args.video_output_channels_device_supported:
675652
print((camera.video_output_channels_device_supported))
676-
return
677653

678654
elif args.video_input_channels_device_supported:
679655
print((camera.video_input_channels_device_supported))
680-
return
681656

682657
elif args.video_channel_title:
683658
print((camera.video_channel_title))
684-
return
685659

686660
elif args.encode_region_interested:
687661
print((camera.encode_region_interested))
688-
return
689662

690663
elif args.encode_media:
691664
print((camera.encode_media))
692-
return
693665

694666
elif args.encode_config_capability:
695667
print((camera.encode_config_capability))
696-
return
697668

698669
elif args.encode_capability:
699670
print((camera.encode_capability))
700-
return
701671

702672
elif args.video_max_extra_stream:
703673
print((camera.video_max_extra_stream))
704-
return
705674

706675
elif args.video_color_config:
707676
print((camera.video_color_config))
708-
return
709677

710678
elif args.factory_create:
711679
print((camera.factory_create))
712-
return
713680

714681
elif args.record_capability:
715682
print((camera.record_capability))
716-
return
717-
718-
elif args.record_mode == -1:
719-
print((camera.record_mode))
720-
return
721-
722-
elif args.record_mode is not None:
723-
camera.record_mode = args.record_mode
724-
return
725683

726684
elif args.record_config == -1:
727685
print((camera.record_config))
728-
return
729686

730687
elif args.record_config is not None:
731688
camera.record_config = args.record_config
732-
return
733689

734690
elif args.media_global_config:
735691
print((camera.media_global_config))
736-
return
737692

738693
elif args.audio_input_channels_numbers:
739694
print((camera.audio_input_channels_numbers))
@@ -806,7 +761,7 @@ def main():
806761
if len(args.add_user) <= 2:
807762
print("This option requires at least: "
808763
"username, password and group")
809-
return
764+
sys.exit(-1)
810765

811766
user = args.add_user[0]
812767
pwd = args.add_user[1]
@@ -829,33 +784,30 @@ def main():
829784

830785
print((camera.add_user(user, pwd, grp,
831786
sharable, reserved, memo)))
832-
return
833787

834788
elif args.modify_user:
835789
if len(args.modify_user) <= 2:
836790
print("This option requires at least: "
837791
"username, attribute and new value")
838-
return
792+
sys.exit(-1)
839793

840794
user = args.modify_user[0]
841795
attr = args.modify_user[1]
842796
newvalue = args.modify_user[2]
843797

844798
print((camera.modify_user(user, attr, newvalue)))
845-
return
846799

847800
elif args.modify_password:
848801
if len(args.modify_password) <= 2:
849802
print("This option requires at least: "
850803
"username, new password and old password")
851-
return
804+
sys.exit(-1)
852805

853806
user = args.modify_password[0]
854807
newpwd = args.modify_password[1]
855808
oldpwd = args.modify_password[2]
856809

857810
print((camera.modify_password(user, newpwd, oldpwd)))
858-
return
859811

860812
elif args.delete_user:
861813
print((camera.delete_user(args.delete_user)))
@@ -904,23 +856,18 @@ def main():
904856

905857
elif args.upnp_config == -1:
906858
print((camera.upnp_config))
907-
return
908859

909860
elif args.upnp_config is not None:
910861
camera.upnp_config = args.upnp_config
911-
return
912862

913863
elif args.upnp_status == -1:
914864
print((camera.upnp_status))
915-
return
916865

917866
elif args.ntp_config == -1:
918867
print((camera.ntp_config))
919-
return
920868

921869
elif args.ntp_config is not None:
922870
camera.ntp_config = args.ntp_config
923-
return
924871

925872
elif args.network_interfaces:
926873
print((camera.network_interfaces))

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# GNU General Public License for more details.
1111
define([VERSION_MAJOR], [1])
1212
define([VERSION_MINOR], [2])
13-
define([VERSION_FIX], [1])
13+
define([VERSION_FIX], [2])
1414
define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
1515
define([VERSION_SUFFIX], [_master])
1616

docs/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ Supportability Matrix
130130
+-------------------------+---------------+----------+-----------------+
131131
| IP2M-841B/841W/842W | Yes | working | |
132132
+-------------------------+---------------+----------+-----------------+
133+
| IP3M-956B | Yes | working | |
134+
+-------------------------+---------------+----------+-----------------+
133135
| IP3M-956E | Yes | working | |
134136
+-------------------------+---------------+----------+-----------------+
135137
| IPM-HX1B | Yes | working | |

examples/home-assitant/README

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Example of configuration for Home Assitant (https://home-assistant.io)
2+
3+
More info:
4+
https://home-assistant.io/components/amcrest/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Example of configuration for Home Assistant
2+
# ~/.homeassistant/configuration.yaml
3+
amcrest:
4+
- host: 192.168.1.5
5+
name: LivingRoom
6+
username: admin
7+
password: super-password
8+
9+
- host: 192.168.1.6
10+
name: Garage
11+
username: admin
12+
password: super-password

examples/zoom-in.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, version 2 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful,
8+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
# GNU General Public License for more details.
11+
#
12+
# vim:sw=4:ts=4:et
13+
import time
14+
from amcrest import AmcrestCamera
15+
16+
amcrest = AmcrestCamera('192.168.1.5', 80, 'admin', 'super-password')
17+
18+
amcrest.camera.zoom_in("start")
19+
time.sleep(0.5)
20+
amcrest.camera.zoom_in("stop")
21+
22+
# Snapshot
23+
amcrest.camera.snapshot(path_file="/tmp/snapshot.jpg")

examples/zoom-out.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, version 2 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful,
8+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
# GNU General Public License for more details.
11+
#
12+
# vim:sw=4:ts=4:et
13+
import time
14+
from amcrest import AmcrestCamera
15+
16+
amcrest = AmcrestCamera('192.168.1.6', 80, 'admin', 'super-password')
17+
18+
amcrest.camera.zoom_out("start")
19+
time.sleep(0.5)
20+
amcrest.camera.zoom_out("stop")
21+
22+
# Snapshot
23+
amcrest.camera.snapshot(path_file="/tmp/snapshot.jpg")
418 KB
Binary file not shown.

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from setuptools import setup, find_packages
33

44
setup(name='amcrest',
5-
version='1.2.1',
5+
version='1.2.2',
66
description='Python wrapper implementation for Amcrest cameras.',
77
author='Douglas Schilling Landgraf, Marcelo Moreira de Mello',
88

src/amcrest/Makefile.am

+3
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@ pycrest_PYTHON = \
3434
log.py \
3535
ptz.py \
3636
special.py \
37+
utils.py \
38+
nas.py \
39+
storage.py \
3740
$(NULL)

0 commit comments

Comments
 (0)