pyHik 0.2.5__tar.gz → 0.4.0__tar.gz

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.
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) John Mihalic 2016
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
pyhik-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyHik
3
+ Version: 0.4.0
4
+ Summary: Python API for Hikvision cameras and NVRs - event streaming, ISAPI access, and device control.
5
+ Home-page: https://github.com/mezz64/pyhik
6
+ Download-URL: https://github.com/mezz64/pyhik/tarball/0.4.0
7
+ Author: John Mihalic
8
+ Author-email: mezz64@users.noreply.github.com
9
+ License: MIT
10
+ Keywords: hik,hikvision,event stream,events,api wrapper,homeassistant,isapi,nvr,camera
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.9
20
+ License-File: LICENSE.txt
21
+ Requires-Dist: requests>=2.20.0
22
+ Provides-Extra: isapi
23
+ Requires-Dist: xmltodict>=0.13.0; extra == "isapi"
24
+ Dynamic: author
25
+ Dynamic: author-email
26
+ Dynamic: classifier
27
+ Dynamic: download-url
28
+ Dynamic: home-page
29
+ Dynamic: keywords
30
+ Dynamic: license
31
+ Dynamic: license-file
32
+ Dynamic: provides-extra
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
pyhik-0.4.0/README.md ADDED
@@ -0,0 +1,45 @@
1
+ [![PyPI](https://img.shields.io/pypi/v/pyHik.svg)](https://pypi.python.org/pypi/pyHik)
2
+
3
+ # Introduction
4
+
5
+ This is a python module aiming to expose common API events from a Hikvision IP camera or nvr. Most rebadged models work as well with full functionality.
6
+
7
+ Code is licensed under the MIT license.
8
+
9
+
10
+ # Requirements
11
+
12
+ If internal callback methods are used no external libraries are required, otherwise:
13
+ * [pyDispatcher] 2.0.5
14
+
15
+ # Installation
16
+
17
+ ```pip install pyhik```
18
+
19
+ # Usage
20
+
21
+ ```python
22
+ import pyhik.hikvision
23
+
24
+ camera = pyhik.hikvision.HikCamera('http://X.X.X.X', port=80, usr='admin', pwd='1234')
25
+ ```
26
+
27
+ # Available Methods
28
+
29
+ ### Callbacks
30
+ * add_update_callback(callback, msg) - used to register an update callback function.
31
+ ** msg should take the form: cam_id.event_type.channel
32
+
33
+ ### Properties
34
+ * get_id - returns unique camera/nvr id
35
+ * get_name - returns camera/nvr name
36
+ * current_event_states - returns the event state dictionary
37
+
38
+ ### Functions
39
+ * start_stream - initialzes the event stream processing thread
40
+ * disconnect - closes the http stream session and stops the processing thread
41
+
42
+ # TODO
43
+
44
+ * Support motion detection status and ability to turn on/off
45
+ * Support IR day/night status and ability to switch between day/night/auto
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyHik
3
+ Version: 0.4.0
4
+ Summary: Python API for Hikvision cameras and NVRs - event streaming, ISAPI access, and device control.
5
+ Home-page: https://github.com/mezz64/pyhik
6
+ Download-URL: https://github.com/mezz64/pyhik/tarball/0.4.0
7
+ Author: John Mihalic
8
+ Author-email: mezz64@users.noreply.github.com
9
+ License: MIT
10
+ Keywords: hik,hikvision,event stream,events,api wrapper,homeassistant,isapi,nvr,camera
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.9
20
+ License-File: LICENSE.txt
21
+ Requires-Dist: requests>=2.20.0
22
+ Provides-Extra: isapi
23
+ Requires-Dist: xmltodict>=0.13.0; extra == "isapi"
24
+ Dynamic: author
25
+ Dynamic: author-email
26
+ Dynamic: classifier
27
+ Dynamic: download-url
28
+ Dynamic: home-page
29
+ Dynamic: keywords
30
+ Dynamic: license
31
+ Dynamic: license-file
32
+ Dynamic: provides-extra
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
@@ -0,0 +1,16 @@
1
+ LICENSE.txt
2
+ README.md
3
+ setup.cfg
4
+ setup.py
5
+ pyHik.egg-info/PKG-INFO
6
+ pyHik.egg-info/SOURCES.txt
7
+ pyHik.egg-info/dependency_links.txt
8
+ pyHik.egg-info/requires.txt
9
+ pyHik.egg-info/top_level.txt
10
+ pyhik/__init__.py
11
+ pyhik/constants.py
12
+ pyhik/hikvision.py
13
+ pyhik/isapi.py
14
+ pyhik/watchdog.py
15
+ test/test_hikvision.py
16
+ test/test_isapi.py
@@ -0,0 +1,4 @@
1
+ requests>=2.20.0
2
+
3
+ [isapi]
4
+ xmltodict>=0.13.0
@@ -0,0 +1 @@
1
+ pyhik
@@ -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
+ ]
@@ -2,20 +2,23 @@
2
2
  pyhik.constants
3
3
  ~~~~~~~~~~~~~~~~~~~~
4
4
  Constants list
5
- Copyright (c) 2016-2019 John Mihalic <https://github.com/mezz64>
5
+ Copyright (c) 2016-2021 John Mihalic <https://github.com/mezz64>
6
6
  Licensed under the MIT license.
7
7
  """
8
8
 
9
9
  MAJOR_VERSION = 0
10
- MINOR_VERSION = 2
11
- SUB_MINOR_VERSION = 5
10
+ MINOR_VERSION = 4
11
+ SUB_MINOR_VERSION = 0
12
12
  __version__ = '{}.{}.{}'.format(
13
13
  MAJOR_VERSION, MINOR_VERSION, SUB_MINOR_VERSION)
14
14
 
15
- CONNECT_TIMEOUT = 5
15
+ CONNECT_TIMEOUT = 10
16
16
  READ_TIMEOUT = 60
17
+ SNAPSHOT_TIMEOUT = 10
18
+ RECORDING_SEARCH_TIMEOUT = 30
17
19
 
18
20
  DEFAULT_PORT = 80
21
+ DEFAULT_RTSP_PORT = 554
19
22
  XML_ENCODING = 'UTF-8'
20
23
  XML_NAMESPACE = 'http://www.hikvision.com/ver20/XMLSchema'
21
24
 
@@ -31,6 +34,7 @@ SENSOR_MAP = {
31
34
  'videoloss': 'Video Loss',
32
35
  'tamperdetection': 'Tamper Detection',
33
36
  'shelteralarm': 'Tamper Detection',
37
+ 'defocus': 'Tamper Detection',
34
38
  'diskfull': 'Disk Full',
35
39
  'diskerror': 'Disk Error',
36
40
  'nicbroken': 'Net Interface Broken',
@@ -46,8 +50,27 @@ SENSOR_MAP = {
46
50
  'attendedbaggage': 'Attended Baggage',
47
51
  'recordingfailure': 'Recording Failure',
48
52
  'regionexiting': "Exiting Region",
49
- 'regionentrance': "Entering Region"
53
+ 'regionentrance': "Entering Region",
54
+ 'duration': "Ongoing Events",
55
+ 'thermometry': "Thermometry"
50
56
  }
51
57
 
58
+ # The name 'id' should always be last
59
+ CHANNEL_NAMES = ['dynVideoInputChannelID', 'videoInputChannelID',
60
+ 'dynInputIOPortID', 'inputIOPortID',
61
+ 'id']
62
+
63
+ ID_TYPES = ['channelID', 'dynChannelID', 'inputIOPortID',
64
+ 'dynInputIOPortID']
65
+
52
66
  CAM_DEVICE = 'CAM'
53
67
  NVR_DEVICE = 'NVR'
68
+
69
+ CONTEXT_INFO = 'INFO'
70
+ CONTEXT_TRIG = 'TRIGGERS'
71
+ CONTEXT_ALERT = 'ALERTS'
72
+ CONTEXT_MOTION = 'MOTION'
73
+
74
+ # Notification methods that indicate the event is active/configured
75
+ # Expanded from original list of just 'center' and 'HTTP' to support NVRs
76
+ VALID_NOTIFICATION_METHODS = {'center', 'HTTP', 'record', 'email', 'beep'}