@@ -493,7 +493,7 @@ def main():
493
493
if len (config .sections ()) > 1 and not args .camera :
494
494
print ("More than 1 camera found at %s. "
495
495
"Append the --camera option." % AMCREST_CONF )
496
- return
496
+ sys . exit ( - 1 )
497
497
498
498
if args .camera :
499
499
section = args .camera
@@ -510,7 +510,7 @@ def main():
510
510
args .password = getpass .getpass ()
511
511
except (NoSectionError , NoOptionError ) as e :
512
512
print ("ERROR! %s found at %s" % (e , AMCREST_CONF ))
513
- return
513
+ sys . exit ( - 1 )
514
514
515
515
amcrest = AmcrestCamera (
516
516
args .hostname ,
@@ -526,18 +526,15 @@ def main():
526
526
print (("Looks like amcrest device: {0}" .format (ret )))
527
527
else :
528
528
print ("No devices found, try again later!" )
529
- return
530
529
531
530
if args .username and args .hostname and args .password :
532
531
533
532
if args .telnet_config == - 1 :
534
533
print ((camera .telnet_config ))
535
- return
536
534
537
535
elif args .mjpg_stream :
538
536
if not args .save :
539
537
print ("This option requires --save" )
540
- return
541
538
542
539
timer_capture = float (args .mjpg_stream [0 ])
543
540
@@ -553,15 +550,12 @@ def main():
553
550
554
551
print ((camera .mjpg_stream (
555
552
channelno , typeno , path_file = args .save )))
556
- return
557
553
558
554
elif args .reboot :
559
555
print ((camera .reboot ()))
560
- return
561
556
562
557
elif args .shutdown :
563
558
print ((camera .shutdown ()))
564
- return
565
559
566
560
elif args .audio_send_stream :
567
561
if len (args .audio_send_stream ) <= 3 :
@@ -574,12 +568,10 @@ def main():
574
568
codec = args .audio_send_stream [3 ]
575
569
576
570
camera .audio_send_stream (httptype , channel , filename , codec )
577
- return
578
571
579
572
elif args .audio_stream_capture :
580
573
if not args .save :
581
574
print ("This option requires --save" )
582
- return
583
575
584
576
if len (args .audio_stream_capture ) <= 2 :
585
577
print ("Requires arguments: httptype, channel, timer_capture!" )
@@ -598,36 +590,30 @@ def main():
598
590
camera .audio_stream_capture (httptype , channel )
599
591
600
592
elif args .play_wav :
601
- return camera .play_wav (path_file = args .play_wav )
593
+ camera .play_wav (path_file = args .play_wav )
602
594
603
595
elif args .wlan_config :
604
596
print ((camera .wlan_config ))
605
- return
606
597
607
598
elif args .scan_wlan_devices :
608
599
print ((camera .scan_wlan_devices (args .scan_wlan_devices )))
609
- return
610
600
611
601
elif args .telnet_config :
612
602
camera .telnet_config = args .telnet_config
613
- return
614
603
615
604
elif args .ptz_config :
616
605
print ((camera .ptz_config ))
617
- return
618
606
619
607
elif args .ptz_auto_movement :
620
608
print ((camera .ptz_auto_movement ))
621
- return
622
609
623
610
elif args .ptz_presets_list :
624
611
print ((camera .ptz_presets_list ()))
625
- return
626
612
627
613
elif args .ptz_goto_preset :
628
614
if len (args .ptz_goto_preset ) < 2 :
629
615
print ("Requires arguments: channel preset_point_number" )
630
- return
616
+ sys . exit ( - 1 )
631
617
632
618
action = 'start'
633
619
channel = args .ptz_goto_preset [0 ]
@@ -636,104 +622,73 @@ def main():
636
622
637
623
elif args .log_clear_all :
638
624
print ((camera .log_clear_all ))
639
- return
640
625
641
626
elif args .video_standard == - 1 :
642
627
print ((camera .video_standard ))
643
- return
644
628
645
629
elif args .video_standard :
646
630
camera .video_standard = args .video_standard
647
- return
648
631
649
632
elif args .coordinates_current_window :
650
633
print ((camera .coordinates_current_window (
651
634
args .coordinates_current_window )))
652
- return
653
635
654
636
elif args .video_widget_config :
655
637
print ((camera .video_widget_config ))
656
- return
657
638
658
639
elif args .video_input_capability :
659
640
print ((camera .video_input_capability ))
660
- return
661
641
662
642
elif args .video_in_options :
663
643
print ((camera .video_in_options ))
664
- return
665
644
666
645
elif args .video_out_options :
667
646
print ((camera .video_out_options ))
668
- return
669
647
670
648
elif args .video_max_remote_input_channels :
671
649
print ((camera .video_max_remote_input_channels ))
672
- return
673
650
674
651
elif args .video_output_channels_device_supported :
675
652
print ((camera .video_output_channels_device_supported ))
676
- return
677
653
678
654
elif args .video_input_channels_device_supported :
679
655
print ((camera .video_input_channels_device_supported ))
680
- return
681
656
682
657
elif args .video_channel_title :
683
658
print ((camera .video_channel_title ))
684
- return
685
659
686
660
elif args .encode_region_interested :
687
661
print ((camera .encode_region_interested ))
688
- return
689
662
690
663
elif args .encode_media :
691
664
print ((camera .encode_media ))
692
- return
693
665
694
666
elif args .encode_config_capability :
695
667
print ((camera .encode_config_capability ))
696
- return
697
668
698
669
elif args .encode_capability :
699
670
print ((camera .encode_capability ))
700
- return
701
671
702
672
elif args .video_max_extra_stream :
703
673
print ((camera .video_max_extra_stream ))
704
- return
705
674
706
675
elif args .video_color_config :
707
676
print ((camera .video_color_config ))
708
- return
709
677
710
678
elif args .factory_create :
711
679
print ((camera .factory_create ))
712
- return
713
680
714
681
elif args .record_capability :
715
682
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
725
683
726
684
elif args .record_config == - 1 :
727
685
print ((camera .record_config ))
728
- return
729
686
730
687
elif args .record_config is not None :
731
688
camera .record_config = args .record_config
732
- return
733
689
734
690
elif args .media_global_config :
735
691
print ((camera .media_global_config ))
736
- return
737
692
738
693
elif args .audio_input_channels_numbers :
739
694
print ((camera .audio_input_channels_numbers ))
@@ -806,7 +761,7 @@ def main():
806
761
if len (args .add_user ) <= 2 :
807
762
print ("This option requires at least: "
808
763
"username, password and group" )
809
- return
764
+ sys . exit ( - 1 )
810
765
811
766
user = args .add_user [0 ]
812
767
pwd = args .add_user [1 ]
@@ -829,33 +784,30 @@ def main():
829
784
830
785
print ((camera .add_user (user , pwd , grp ,
831
786
sharable , reserved , memo )))
832
- return
833
787
834
788
elif args .modify_user :
835
789
if len (args .modify_user ) <= 2 :
836
790
print ("This option requires at least: "
837
791
"username, attribute and new value" )
838
- return
792
+ sys . exit ( - 1 )
839
793
840
794
user = args .modify_user [0 ]
841
795
attr = args .modify_user [1 ]
842
796
newvalue = args .modify_user [2 ]
843
797
844
798
print ((camera .modify_user (user , attr , newvalue )))
845
- return
846
799
847
800
elif args .modify_password :
848
801
if len (args .modify_password ) <= 2 :
849
802
print ("This option requires at least: "
850
803
"username, new password and old password" )
851
- return
804
+ sys . exit ( - 1 )
852
805
853
806
user = args .modify_password [0 ]
854
807
newpwd = args .modify_password [1 ]
855
808
oldpwd = args .modify_password [2 ]
856
809
857
810
print ((camera .modify_password (user , newpwd , oldpwd )))
858
- return
859
811
860
812
elif args .delete_user :
861
813
print ((camera .delete_user (args .delete_user )))
@@ -904,23 +856,18 @@ def main():
904
856
905
857
elif args .upnp_config == - 1 :
906
858
print ((camera .upnp_config ))
907
- return
908
859
909
860
elif args .upnp_config is not None :
910
861
camera .upnp_config = args .upnp_config
911
- return
912
862
913
863
elif args .upnp_status == - 1 :
914
864
print ((camera .upnp_status ))
915
- return
916
865
917
866
elif args .ntp_config == - 1 :
918
867
print ((camera .ntp_config ))
919
- return
920
868
921
869
elif args .ntp_config is not None :
922
870
camera .ntp_config = args .ntp_config
923
- return
924
871
925
872
elif args .network_interfaces :
926
873
print ((camera .network_interfaces ))
0 commit comments