pyHik 0.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyhik/__init__.py +53 -0
- pyhik/constants.py +77 -0
- pyhik/hikvision.py +1528 -0
- pyhik/isapi.py +859 -0
- pyhik/watchdog.py +38 -0
- pyhik-0.4.4.dist-info/METADATA +35 -0
- pyhik-0.4.4.dist-info/RECORD +10 -0
- pyhik-0.4.4.dist-info/WHEEL +5 -0
- pyhik-0.4.4.dist-info/licenses/LICENSE.txt +22 -0
- pyhik-0.4.4.dist-info/top_level.txt +1 -0
pyhik/__init__.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""pyhik - Python library for Hikvision camera/NVR events."""
|
|
2
|
+
|
|
3
|
+
from pyhik.hikvision import (
|
|
4
|
+
HikCamera,
|
|
5
|
+
inject_events_into_camera,
|
|
6
|
+
get_video_channels,
|
|
7
|
+
Recording,
|
|
8
|
+
RecordingDay,
|
|
9
|
+
VideoChannel,
|
|
10
|
+
)
|
|
11
|
+
from pyhik.constants import __version__, VALID_NOTIFICATION_METHODS
|
|
12
|
+
from pyhik.isapi import (
|
|
13
|
+
ISAPIClient,
|
|
14
|
+
ISAPIError,
|
|
15
|
+
ISAPIConnectionError,
|
|
16
|
+
ISAPIAuthError,
|
|
17
|
+
ISAPINotFoundError,
|
|
18
|
+
StorageDevice,
|
|
19
|
+
AlarmServerInfo,
|
|
20
|
+
StreamInfo,
|
|
21
|
+
CameraInfo,
|
|
22
|
+
OutputPort,
|
|
23
|
+
InputPort,
|
|
24
|
+
EventState,
|
|
25
|
+
DeviceCapabilities,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
# Legacy event-based API
|
|
30
|
+
'HikCamera',
|
|
31
|
+
'inject_events_into_camera',
|
|
32
|
+
'get_video_channels',
|
|
33
|
+
'Recording',
|
|
34
|
+
'RecordingDay',
|
|
35
|
+
'VideoChannel',
|
|
36
|
+
'VALID_NOTIFICATION_METHODS',
|
|
37
|
+
'__version__',
|
|
38
|
+
# ISAPI client
|
|
39
|
+
'ISAPIClient',
|
|
40
|
+
'ISAPIError',
|
|
41
|
+
'ISAPIConnectionError',
|
|
42
|
+
'ISAPIAuthError',
|
|
43
|
+
'ISAPINotFoundError',
|
|
44
|
+
# Data classes
|
|
45
|
+
'StorageDevice',
|
|
46
|
+
'AlarmServerInfo',
|
|
47
|
+
'StreamInfo',
|
|
48
|
+
'CameraInfo',
|
|
49
|
+
'OutputPort',
|
|
50
|
+
'InputPort',
|
|
51
|
+
'EventState',
|
|
52
|
+
'DeviceCapabilities',
|
|
53
|
+
]
|
pyhik/constants.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
pyhik.constants
|
|
3
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
4
|
+
Constants list
|
|
5
|
+
Copyright (c) 2016-2021 John Mihalic <https://github.com/mezz64>
|
|
6
|
+
Licensed under the MIT license.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
MAJOR_VERSION = 0
|
|
10
|
+
MINOR_VERSION = 4
|
|
11
|
+
SUB_MINOR_VERSION = 3
|
|
12
|
+
__version__ = '{}.{}.{}'.format(
|
|
13
|
+
MAJOR_VERSION, MINOR_VERSION, SUB_MINOR_VERSION)
|
|
14
|
+
|
|
15
|
+
CONNECT_TIMEOUT = 10
|
|
16
|
+
READ_TIMEOUT = 60
|
|
17
|
+
SNAPSHOT_TIMEOUT = 10
|
|
18
|
+
RECORDING_SEARCH_TIMEOUT = 30
|
|
19
|
+
DOWNLOAD_TIMEOUT = 300
|
|
20
|
+
|
|
21
|
+
DEFAULT_PORT = 80
|
|
22
|
+
DEFAULT_RTSP_PORT = 554
|
|
23
|
+
XML_ENCODING = 'UTF-8'
|
|
24
|
+
XML_NAMESPACE = 'http://www.hikvision.com/ver20/XMLSchema'
|
|
25
|
+
|
|
26
|
+
DEFAULT_HEADERS = {
|
|
27
|
+
'Content-Type': "application/xml; charset='UTF-8'",
|
|
28
|
+
'Accept': "*/*"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
SENSOR_MAP = {
|
|
32
|
+
'vmd': 'Motion',
|
|
33
|
+
'linedetection': 'Line Crossing',
|
|
34
|
+
'fielddetection': 'Field Detection',
|
|
35
|
+
'videoloss': 'Video Loss',
|
|
36
|
+
'tamperdetection': 'Tamper Detection',
|
|
37
|
+
'shelteralarm': 'Tamper Detection',
|
|
38
|
+
'defocus': 'Tamper Detection',
|
|
39
|
+
'diskfull': 'Disk Full',
|
|
40
|
+
'diskerror': 'Disk Error',
|
|
41
|
+
'nicbroken': 'Net Interface Broken',
|
|
42
|
+
'ipconflict': 'IP Conflict',
|
|
43
|
+
'illaccess': 'Illegal Access',
|
|
44
|
+
'videomismatch': 'Video Mismatch',
|
|
45
|
+
'badvideo': 'Bad Video',
|
|
46
|
+
'pir': 'PIR Alarm',
|
|
47
|
+
'facedetection': 'Face Detection',
|
|
48
|
+
'scenechangedetection': 'Scene Change Detection',
|
|
49
|
+
'io': 'I/O',
|
|
50
|
+
'unattendedbaggage': 'Unattended Baggage',
|
|
51
|
+
'attendedbaggage': 'Attended Baggage',
|
|
52
|
+
'recordingfailure': 'Recording Failure',
|
|
53
|
+
'regionexiting': "Exiting Region",
|
|
54
|
+
'regionentrance': "Entering Region",
|
|
55
|
+
'duration': "Ongoing Events",
|
|
56
|
+
'thermometry': "Thermometry"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# The name 'id' should always be last
|
|
60
|
+
CHANNEL_NAMES = ['dynVideoInputChannelID', 'videoInputChannelID',
|
|
61
|
+
'dynInputIOPortID', 'inputIOPortID',
|
|
62
|
+
'id']
|
|
63
|
+
|
|
64
|
+
ID_TYPES = ['channelID', 'dynChannelID', 'inputIOPortID',
|
|
65
|
+
'dynInputIOPortID']
|
|
66
|
+
|
|
67
|
+
CAM_DEVICE = 'CAM'
|
|
68
|
+
NVR_DEVICE = 'NVR'
|
|
69
|
+
|
|
70
|
+
CONTEXT_INFO = 'INFO'
|
|
71
|
+
CONTEXT_TRIG = 'TRIGGERS'
|
|
72
|
+
CONTEXT_ALERT = 'ALERTS'
|
|
73
|
+
CONTEXT_MOTION = 'MOTION'
|
|
74
|
+
|
|
75
|
+
# Notification methods that indicate the event is active/configured
|
|
76
|
+
# Expanded from original list of just 'center' and 'HTTP' to support NVRs
|
|
77
|
+
VALID_NOTIFICATION_METHODS = {'center', 'HTTP', 'record', 'email', 'beep'}
|