add camsutil
This commit is contained in:
parent
82f12e7083
commit
076d397762
43
README.md
43
README.md
|
@ -1,8 +1,51 @@
|
||||||
# utils
|
# utils
|
||||||
|
|
||||||
|
* [camsutil](https://git.hmp.today/pavel.muhortov/utils#camsutil)
|
||||||
* [ffmpeger.py](https://git.hmp.today/pavel.muhortov/utils#ffmpeger-py)
|
* [ffmpeger.py](https://git.hmp.today/pavel.muhortov/utils#ffmpeger-py)
|
||||||
* [procutil.py](https://git.hmp.today/pavel.muhortov/utils#procutil-py)
|
* [procutil.py](https://git.hmp.today/pavel.muhortov/utils#procutil-py)
|
||||||
* [sendmail.py](https://git.hmp.today/pavel.muhortov/utils#sendmail-py)
|
* [sendmail.py](https://git.hmp.today/pavel.muhortov/utils#sendmail-py)
|
||||||
|
____
|
||||||
|
## camsutil
|
||||||
|
**Description:** Creation of a request to the camera API based on the prepared template
|
||||||
|
**Dependencies:** Python 3 (tested version 3.9.5)
|
||||||
|
|
||||||
|
| PARAMETERS | DESCRIPTION | DEFAULT|
|
||||||
|
|-------------|-------------|--------|
|
||||||
|
|**--host**|hostname or ip address|**REQUIRED**|
|
||||||
|
|**--user**|valid user|**REQUIRED**|
|
||||||
|
|**--password**|valid password|**REQUIRED**|
|
||||||
|
|**--template**|the name of an existing template|**REQUIRED**|
|
||||||
|
|**[-h]**|print help and exit||
|
||||||
|
|**[--protocol]**|http, https, etc.|http|
|
||||||
|
|**[--port]**|port number|80|
|
||||||
|
|**[--channel]**|ptz channel number|101|
|
||||||
|
|**[--vid]**|video channel id|1|
|
||||||
|
|**[--x]**|horizontal positioning: azimuth, pan|0|
|
||||||
|
|**[--y]**|vertical positioning: elevation, tilt|0|
|
||||||
|
|**[--z]**|zoom direction, absolute zoom|0|
|
||||||
|
|**[--speed]**|positioning speed: from 1 to 7|1|
|
||||||
|
|**[--time]**|momentary duration, max 100000ms|100000|
|
||||||
|
|**[--text]**|overlay text content|`None`|
|
||||||
|
|**[--enabled]**|enabled (true) or disabled (false) overlay text|true|
|
||||||
|
|
||||||
|
Example usage in terminal with Python:
|
||||||
|
```shell
|
||||||
|
python3 ./ptz.py --host HOST --user USER --password PASS --template Hikvision_GetCapabilities.html
|
||||||
|
```
|
||||||
|
Example usage in terminal with make the script executable:
|
||||||
|
```shell
|
||||||
|
chmod u+x ./ptz.py
|
||||||
|
ptz.py --host HOST --user USER --password PASS --template Hikvision_PtzPreset.html --vid 2 --speed 5
|
||||||
|
```
|
||||||
|
Example usage in Python:
|
||||||
|
```Python
|
||||||
|
from camsutil import ptz
|
||||||
|
|
||||||
|
data = ptz.API(host='HOST', user='USER', password='PASS', template='Hikvision_GetJPEG.html', x=1920, y=1080).call()
|
||||||
|
with open('img.jpg', 'wb') as output:
|
||||||
|
output.write(data)
|
||||||
|
```
|
||||||
|
|
||||||
____
|
____
|
||||||
## ffmpeger.py
|
## ffmpeger.py
|
||||||
**Description:** FFmpeg management from Python
|
**Description:** FFmpeg management from Python
|
||||||
|
|
|
@ -12,7 +12,7 @@ class API:
|
||||||
def __init__(self, host: str, user: str, password: str, template: str,
|
def __init__(self, host: str, user: str, password: str, template: str,
|
||||||
protocol: str = 'http', port: int = 80, channel: int = 101, vid: int = 1,
|
protocol: str = 'http', port: int = 80, channel: int = 101, vid: int = 1,
|
||||||
x: int = 0, y: int = 0, z: int = 0, speed: int = 1, time: int = 100000,
|
x: int = 0, y: int = 0, z: int = 0, speed: int = 1, time: int = 100000,
|
||||||
text: str = '', enabled: str = 'true'):
|
text: str = None, enabled: str = 'true'):
|
||||||
"""
|
"""
|
||||||
Object constructor
|
Object constructor
|
||||||
:param host: hostname or ip address
|
:param host: hostname or ip address
|
||||||
|
@ -129,7 +129,7 @@ if __name__ == "__main__":
|
||||||
help='positioning speed: from 1 to 7')
|
help='positioning speed: from 1 to 7')
|
||||||
args.add_argument('--time', type=int, default=100000, required=False,
|
args.add_argument('--time', type=int, default=100000, required=False,
|
||||||
help='momentary duration, max 100000ms')
|
help='momentary duration, max 100000ms')
|
||||||
args.add_argument('--text', type=str, default='', required=False,
|
args.add_argument('--text', type=str, default=None, required=False,
|
||||||
help='overlay text content')
|
help='overlay text content')
|
||||||
args.add_argument('--enabled', type=str, default='true', required=False,
|
args.add_argument('--enabled', type=str, default='true', required=False,
|
||||||
help='enabled (true) or disabled (false) overlay text')
|
help='enabled (true) or disabled (false) overlay text')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user