Skip to content

Commit

Permalink
Merge pull request #18 from tchellomello/docs
Browse files Browse the repository at this point in the history
Updated Readme file
  • Loading branch information
tchellomello authored Nov 24, 2016
2 parents 3fbf7f6 + 6f39969 commit 851a2f0
Showing 1 changed file with 29 additions and 32 deletions.
61 changes: 29 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit 851a2f0

Please sign in to comment.