-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from tchellomello/docs
Updated Readme file
- Loading branch information
Showing
1 changed file
with
29 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,84 +9,81 @@ Tests executed with the following Amcrest models: | |
|
||
If you have different model, fell free to contribute. | ||
|
||
Installation | ||
============ | ||
## Installation | ||
|
||
|
||
PIP + GIT | ||
--------- | ||
- PIP | ||
|
||
```bash | ||
$ pip install git+https://github.com/tchellomello/python-amcrest | ||
$ pip install amcrest | ||
$ eval "$(register-python-argcomplete amcrest-cli)" | ||
``` | ||
|
||
To enable amcrest-cli autocomplete in the system: | ||
$ sudo vi /etc/profile.d/amcrest-cli-autocomplete.sh | ||
eval "$(register-python-argcomplete amcrest-cli)" | ||
* To enable amcrest-cli autocomplete in the system: | ||
```bash | ||
$ echo 'eval "$(register-python-argcomplete amcrest-cli)"' > /etc/profile.d/amcrest-cli-autocomplete.sh | ||
``` | ||
|
||
RPM | ||
--------- | ||
- RPM | ||
```bash | ||
$ git clone [email protected]:tchellomello/python-amcrest.git | ||
$ ./autogen.sh | ||
$ make rpm | ||
$ dnf/yum install amcrest-cli-NVR.rpm pythonX-amcrest-NVR.rpm | ||
``` | ||
|
||
Usage | ||
===== | ||
## Usage | ||
|
||
Module Examples | ||
--------------- | ||
- Module | ||
|
||
```python | ||
>>> from amcrest import AmcrestCamera | ||
|
||
>>> amcrest = AmcrestCamera('192.168.0.1', 80, 'admin', 'password') | ||
>>> camera = amcrest.camera | ||
|
||
Check software information | ||
#Check software information | ||
>>> camera.software_information | ||
'version=2.420.AC00.15.R\r\nBuildDate=2016-09-08' | ||
|
||
Capture snapshot | ||
#Capture snapshot | ||
>>> camera.snapshot(0, "/home/user/Desktop/snapshot00.jpeg") | ||
<requests.packages.urllib3.response.HTTPResponse object at 0x7f84945083c8> | ||
|
||
Capture audio | ||
#Capture audio | ||
>>> camera.audio_stream_capture(httptype="singlepart", channel=1, path_file="/home/user/Desktop/audio.aac") | ||
CTRL-C to stop the continuous audio flow or use a timer | ||
|
||
Move camera down | ||
#Move camera down | ||
>>> camera.ptz_control_command(action="start", code="Down", arg1=0, arg2=0, arg3=0))) | ||
|
||
Record realtime stream into a file | ||
#Record realtime stream into a file | ||
>>> camera.realtime_stream(path_file="/home/user/Desktop/myvideo") | ||
CTRL-C to stop the continuous video flow or use a timer | ||
$ mplayer /home/user/Desktop/myvideo | ||
|
||
|
||
``` | ||
|
||
Command Line | ||
------------ | ||
- Command Line | ||
```bash | ||
$ man amcrest-cli | ||
|
||
or | ||
|
||
$ amcrest-cli --help | ||
``` | ||
|
||
|
||
Reading credentials from a file: | ||
$ cat ~/camera1.cfg | ||
[camera1] | ||
hostname: camera1.example.com | ||
* Saving credentials to file. | ||
```bash | ||
$ vim ~/.config/amcrest.conf | ||
[patio] | ||
hostname: 192.168.0.20 | ||
username: admin | ||
password: 123456 | ||
port: 80 | ||
|
||
$ amcrest-cli --credentials ~/camera1.cfg --version-http-api | ||
[living_room] | ||
hostname: 192.168.0.21 | ||
username: admin | ||
password: secret | ||
port: 80 | ||
|
||
$ amcrest-cli --camera living_room --version-http-api | ||
version=1.40 | ||
``` |