ActionStreamer 0.2.24__tar.gz → 0.2.26__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.
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/CommonFunctions/CommonFunctions.py +14 -13
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/CommonFunctions/Wifi/Wifi.py +5 -5
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/Config/Config.py +9 -7
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/Device/Device.py +10 -10
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/Model/Model.py +7 -7
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/API/API.py +6 -5
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/Event/Event.py +24 -23
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/File/File.py +2 -1
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/Health/Health.py +6 -6
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/LogMessage/LogMessage.py +6 -5
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/Patch/Patch.py +2 -2
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/VideoClip/VideoClip.py +7 -6
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/PKG-INFO +1 -1
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/pyproject.toml +1 -1
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/CommonFunctions/Wifi/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/CommonFunctions/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/Config/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/Device/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/Model/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/API/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/Event/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/File/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/Health/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/LogMessage/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/Patch/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/VideoClip/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/__init__.py +0 -0
- {actionstreamer-0.2.24 → actionstreamer-0.2.26}/README.md +0 -0
{actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/CommonFunctions/CommonFunctions.py
RENAMED
|
@@ -10,11 +10,12 @@ import re
|
|
|
10
10
|
|
|
11
11
|
import pytz
|
|
12
12
|
import requests
|
|
13
|
+
|
|
13
14
|
from ActionStreamer.Config import WebServiceConfig
|
|
14
15
|
|
|
15
16
|
class StandardResult:
|
|
16
17
|
|
|
17
|
-
def __init__(self, code, description):
|
|
18
|
+
def __init__(self, code: int, description: str):
|
|
18
19
|
self.Code = code
|
|
19
20
|
self.Description = description
|
|
20
21
|
|
|
@@ -30,7 +31,7 @@ class switch(object):
|
|
|
30
31
|
yield self.match
|
|
31
32
|
raise StopIteration
|
|
32
33
|
|
|
33
|
-
def match(self, *args):
|
|
34
|
+
def match(self, *args) -> bool:
|
|
34
35
|
"""Indicate whether or not to enter a case suite"""
|
|
35
36
|
if self.fall or not args:
|
|
36
37
|
return True
|
|
@@ -41,7 +42,7 @@ class switch(object):
|
|
|
41
42
|
return False
|
|
42
43
|
|
|
43
44
|
|
|
44
|
-
def get_exception_info():
|
|
45
|
+
def get_exception_info() -> tuple[str, int] | tuple[None, None]:
|
|
45
46
|
exception_type, exception_object, exception_traceback = sys.exc_info()
|
|
46
47
|
if exception_traceback is not None:
|
|
47
48
|
filename = exception_traceback.tb_frame.f_code.co_filename
|
|
@@ -50,14 +51,14 @@ def get_exception_info():
|
|
|
50
51
|
return None, None
|
|
51
52
|
|
|
52
53
|
|
|
53
|
-
def get_line_number():
|
|
54
|
+
def get_line_number() -> int | None:
|
|
54
55
|
exception_type, exception_object, exception_traceback = sys.exc_info()
|
|
55
56
|
if exception_traceback is not None:
|
|
56
57
|
return exception_traceback.tb_lineno
|
|
57
58
|
return None
|
|
58
59
|
|
|
59
60
|
|
|
60
|
-
def log_to_console(message, agent_name=''):
|
|
61
|
+
def log_to_console(message: str, agent_name='') -> None:
|
|
61
62
|
# Get the current UTC time
|
|
62
63
|
utc_now = datetime.now(pytz.utc)
|
|
63
64
|
|
|
@@ -74,7 +75,7 @@ def log_to_console(message, agent_name=''):
|
|
|
74
75
|
print(result_string)
|
|
75
76
|
|
|
76
77
|
|
|
77
|
-
def send_signed_request(ws_config: WebServiceConfig, method, url, path, headers=None, parameters=None, body=None):
|
|
78
|
+
def send_signed_request(ws_config: WebServiceConfig, method: str, url: str, path: str, headers: dict = None, parameters: str = None, body: str = None) -> tuple[int, str]:
|
|
78
79
|
|
|
79
80
|
try:
|
|
80
81
|
if headers is None:
|
|
@@ -119,7 +120,7 @@ def send_signed_request(ws_config: WebServiceConfig, method, url, path, headers=
|
|
|
119
120
|
return status_code, response_string
|
|
120
121
|
|
|
121
122
|
|
|
122
|
-
def get_hmac_signature(secret_key, method, path, headers, parameters, body=None):
|
|
123
|
+
def get_hmac_signature(secret_key: str, method: str, path: str, headers, parameters: dict, body: str = None)-> tuple[str, str] | None:
|
|
123
124
|
|
|
124
125
|
try:
|
|
125
126
|
if 'Content-Type' in headers:
|
|
@@ -153,7 +154,7 @@ def get_hmac_signature(secret_key, method, path, headers, parameters, body=None)
|
|
|
153
154
|
print(ex)
|
|
154
155
|
|
|
155
156
|
|
|
156
|
-
def dictionary_to_string(dictionary):
|
|
157
|
+
def dictionary_to_string(dictionary: dict) -> str:
|
|
157
158
|
|
|
158
159
|
result = ''
|
|
159
160
|
|
|
@@ -172,7 +173,7 @@ def dictionary_to_string(dictionary):
|
|
|
172
173
|
return result
|
|
173
174
|
|
|
174
175
|
|
|
175
|
-
def upload_file_to_s3(file_path, signed_url):
|
|
176
|
+
def upload_file_to_s3(file_path: str, signed_url: str) -> int:
|
|
176
177
|
|
|
177
178
|
retry = True
|
|
178
179
|
result = 0
|
|
@@ -197,7 +198,7 @@ def upload_file_to_s3(file_path, signed_url):
|
|
|
197
198
|
return result
|
|
198
199
|
|
|
199
200
|
|
|
200
|
-
def get_sha256_hash_for_file(file_path):
|
|
201
|
+
def get_sha256_hash_for_file(file_path: str) -> str:
|
|
201
202
|
# Initialize the hash object (SHA-256 is used in this example)
|
|
202
203
|
hash_object = hashlib.sha256()
|
|
203
204
|
|
|
@@ -213,7 +214,7 @@ def get_sha256_hash_for_file(file_path):
|
|
|
213
214
|
return file_hash
|
|
214
215
|
|
|
215
216
|
|
|
216
|
-
def create_folders(path):
|
|
217
|
+
def create_folders(path: str) -> None:
|
|
217
218
|
# Split the path into individual folders
|
|
218
219
|
folders = path.split(os.sep)
|
|
219
220
|
|
|
@@ -231,7 +232,7 @@ def create_folders(path):
|
|
|
231
232
|
os.makedirs(base_folder)
|
|
232
233
|
|
|
233
234
|
|
|
234
|
-
def get_cpu_frequency():
|
|
235
|
+
def get_cpu_frequency() -> float:
|
|
235
236
|
with open("/proc/cpuinfo") as f:
|
|
236
237
|
cpuinfo = f.read()
|
|
237
238
|
# Find the first occurrence of "cpu MHz"
|
|
@@ -242,7 +243,7 @@ def get_cpu_frequency():
|
|
|
242
243
|
raise RuntimeError("Unable to find CPU frequency in /proc/cpuinfo")
|
|
243
244
|
|
|
244
245
|
|
|
245
|
-
def get_clock_cycles_per_millisecond():
|
|
246
|
+
def get_clock_cycles_per_millisecond() -> float:
|
|
246
247
|
frequency_mhz = get_cpu_frequency()
|
|
247
248
|
frequency_hz = frequency_mhz * 1_000_000
|
|
248
249
|
cycles_per_millisecond = frequency_hz / 1_000
|
|
@@ -2,7 +2,7 @@ import json
|
|
|
2
2
|
import subprocess
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def add_wifi_connection(ssid, password, connection_name, priority=1):
|
|
5
|
+
def add_wifi_connection(ssid: str, password: str, connection_name: str, priority=1) -> None:
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
8
|
subprocess.run(['sudo', 'nmcli', 'connection', 'add', 'type', 'wifi', 'ifname', 'wlan0', 'con-name', connection_name, 'ssid', ssid, 'connection.autoconnect-priority', str(priority)], check=True)
|
|
@@ -17,7 +17,7 @@ def add_wifi_connection(ssid, password, connection_name, priority=1):
|
|
|
17
17
|
print(f"Failed to add connection: {connection_name}. Error: {ex}")
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def remove_wifi_connection(ssid):
|
|
20
|
+
def remove_wifi_connection(ssid: str) -> None:
|
|
21
21
|
|
|
22
22
|
try:
|
|
23
23
|
subprocess.run(['sudo', 'nmcli', 'connection', 'delete', ssid], check=True)
|
|
@@ -26,7 +26,7 @@ def remove_wifi_connection(ssid):
|
|
|
26
26
|
print(f"Failed to remove connection: {ssid}. It might not exist.")
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def set_wifi_priority(ssid, priority):
|
|
29
|
+
def set_wifi_priority(ssid: str, priority: int) -> None:
|
|
30
30
|
|
|
31
31
|
# Example usage:
|
|
32
32
|
# set_wifi_priority("YourSSID", 100)
|
|
@@ -60,7 +60,7 @@ def set_wifi_priority(ssid, priority):
|
|
|
60
60
|
print(ex)
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
def back_up_connections(backup_file_path):
|
|
63
|
+
def back_up_connections(backup_file_path: str) -> None:
|
|
64
64
|
# Backup all connection data to a JSON file
|
|
65
65
|
try:
|
|
66
66
|
result = subprocess.run(['sudo', 'nmcli', '--json', 'connection', 'export'], capture_output=True, text=True, check=True)
|
|
@@ -75,7 +75,7 @@ def back_up_connections(backup_file_path):
|
|
|
75
75
|
print(f"Failed to backup connections. Error: {ex}")
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
def restore_connections(backup_file_path):
|
|
78
|
+
def restore_connections(backup_file_path: str) -> None:
|
|
79
79
|
# Restore all connections from a JSON backup file
|
|
80
80
|
try:
|
|
81
81
|
with open(backup_file_path, 'r') as f:
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import platform
|
|
3
3
|
|
|
4
|
+
from ActionStreamer.Config import WebServiceConfig
|
|
5
|
+
|
|
4
6
|
class WebServiceConfig:
|
|
5
7
|
|
|
6
8
|
"""
|
|
@@ -31,7 +33,7 @@ class WebServiceConfig:
|
|
|
31
33
|
|
|
32
34
|
class LogConfig:
|
|
33
35
|
|
|
34
|
-
def __init__(self, ws_config, device_name, agent_type, agent_version, agent_index, process_id):
|
|
36
|
+
def __init__(self, ws_config: WebServiceConfig, device_name: str, agent_type: str, agent_version: str, agent_index: int, process_id: int):
|
|
35
37
|
self.ws_config = ws_config
|
|
36
38
|
self.device_name = device_name
|
|
37
39
|
self.agent_type = agent_type
|
|
@@ -40,11 +42,11 @@ class LogConfig:
|
|
|
40
42
|
self.process_id = process_id
|
|
41
43
|
|
|
42
44
|
|
|
43
|
-
def is_windows():
|
|
45
|
+
def is_windows() -> bool:
|
|
44
46
|
return platform.system() == 'Windows'
|
|
45
47
|
|
|
46
48
|
|
|
47
|
-
def get_config_folder_path(app_name):
|
|
49
|
+
def get_config_folder_path(app_name: str) -> str:
|
|
48
50
|
|
|
49
51
|
if is_windows():
|
|
50
52
|
username = os.getlogin()
|
|
@@ -62,7 +64,7 @@ def get_config_folder_path(app_name):
|
|
|
62
64
|
return config_dir
|
|
63
65
|
|
|
64
66
|
|
|
65
|
-
def get_appdata_folder_path(app_name):
|
|
67
|
+
def get_appdata_folder_path(app_name: str) -> str:
|
|
66
68
|
|
|
67
69
|
if is_windows():
|
|
68
70
|
username = os.getlogin()
|
|
@@ -79,7 +81,7 @@ def get_appdata_folder_path(app_name):
|
|
|
79
81
|
return appdata_folder_path
|
|
80
82
|
|
|
81
83
|
|
|
82
|
-
def get_config_value(config_folder_path, name):
|
|
84
|
+
def get_config_value(config_folder_path: str, name: str) -> str | None:
|
|
83
85
|
|
|
84
86
|
if not os.path.exists(config_folder_path):
|
|
85
87
|
os.makedirs(config_folder_path)
|
|
@@ -98,7 +100,7 @@ def get_config_value(config_folder_path, name):
|
|
|
98
100
|
return None
|
|
99
101
|
|
|
100
102
|
|
|
101
|
-
def set_config_value(config_folder_path, name, value):
|
|
103
|
+
def set_config_value(config_folder_path: str, name: str, value: str) -> None:
|
|
102
104
|
|
|
103
105
|
if not os.path.exists(config_folder_path):
|
|
104
106
|
os.makedirs(config_folder_path)
|
|
@@ -114,4 +116,4 @@ def set_config_value(config_folder_path, name, value):
|
|
|
114
116
|
file.write(value)
|
|
115
117
|
print(f"Successfully set the value in '{name}'")
|
|
116
118
|
except Exception as ex:
|
|
117
|
-
print(f"Error occurred while setting value in '{name}': {ex}")
|
|
119
|
+
print(f"Error occurred while setting value in '{name}': {ex}")
|
|
@@ -4,7 +4,7 @@ import sys
|
|
|
4
4
|
import platform
|
|
5
5
|
import subprocess
|
|
6
6
|
|
|
7
|
-
def process_cpuinfo():
|
|
7
|
+
def process_cpuinfo() -> str:
|
|
8
8
|
|
|
9
9
|
device_name = "0000000000000000"
|
|
10
10
|
|
|
@@ -23,7 +23,7 @@ def process_cpuinfo():
|
|
|
23
23
|
return device_name
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def get_serial_number():
|
|
26
|
+
def get_serial_number() -> str:
|
|
27
27
|
|
|
28
28
|
serial_number = ""
|
|
29
29
|
manufacturer = ""
|
|
@@ -41,7 +41,7 @@ def get_serial_number():
|
|
|
41
41
|
return manufacturer + "_" + serial_number
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def get_ip_address():
|
|
44
|
+
def get_ip_address() -> str:
|
|
45
45
|
|
|
46
46
|
try:
|
|
47
47
|
# Get the local hostname
|
|
@@ -55,7 +55,7 @@ def get_ip_address():
|
|
|
55
55
|
return ip_address
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
def get_cpu_serial_number_windows():
|
|
58
|
+
def get_cpu_serial_number_windows() -> str:
|
|
59
59
|
|
|
60
60
|
try:
|
|
61
61
|
import wmi
|
|
@@ -67,7 +67,7 @@ def get_cpu_serial_number_windows():
|
|
|
67
67
|
return str(ex)
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
def get_cpu_serial_number_linux():
|
|
70
|
+
def get_cpu_serial_number_linux() -> str:
|
|
71
71
|
|
|
72
72
|
try:
|
|
73
73
|
with open('/proc/cpuinfo', 'r') as f:
|
|
@@ -79,7 +79,7 @@ def get_cpu_serial_number_linux():
|
|
|
79
79
|
return str(ex)
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
def get_manufacturer():
|
|
82
|
+
def get_manufacturer() -> tuple[str, int]:
|
|
83
83
|
|
|
84
84
|
if platform.system() == "Windows":
|
|
85
85
|
return get_manufacturer_windows()
|
|
@@ -87,7 +87,7 @@ def get_manufacturer():
|
|
|
87
87
|
return get_manufacturer_linux()
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
def get_manufacturer_windows():
|
|
90
|
+
def get_manufacturer_windows() -> tuple[str, int]:
|
|
91
91
|
try:
|
|
92
92
|
import wmi
|
|
93
93
|
w = wmi.WMI()
|
|
@@ -100,7 +100,7 @@ def get_manufacturer_windows():
|
|
|
100
100
|
return "", 1
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
def get_manufacturer_linux():
|
|
103
|
+
def get_manufacturer_linux() -> tuple[str, int]:
|
|
104
104
|
try:
|
|
105
105
|
with open("/proc/cpuinfo", "r") as f:
|
|
106
106
|
for line in f:
|
|
@@ -120,7 +120,7 @@ def get_manufacturer_linux():
|
|
|
120
120
|
return "", 1
|
|
121
121
|
|
|
122
122
|
|
|
123
|
-
def parse_raspberry_pi_model(model):
|
|
123
|
+
def parse_raspberry_pi_model(model: str) -> str:
|
|
124
124
|
|
|
125
125
|
if "Raspberry Pi" in model:
|
|
126
126
|
parts = model.split()
|
|
@@ -129,7 +129,7 @@ def parse_raspberry_pi_model(model):
|
|
|
129
129
|
return model
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
def parse_manufacturer(manufacturer):
|
|
132
|
+
def parse_manufacturer(manufacturer: str) -> str:
|
|
133
133
|
|
|
134
134
|
if "Intel" in manufacturer:
|
|
135
135
|
return "Intel"
|
|
@@ -34,7 +34,7 @@ class EventType:
|
|
|
34
34
|
|
|
35
35
|
class Event:
|
|
36
36
|
|
|
37
|
-
def __init__(self, key, userID, deviceID, agentTypeID, agentID, eventTypeID, eventStatus, eventParameters, processID, result, percentComplete, priority, expirationEpoch, attemptNumber, maxAttempts, checkoutToken, tagString, tagNumber, creationDate, createdBy, lastModifiedDate, lastModifiedBy):
|
|
37
|
+
def __init__(self, key: int, userID: int, deviceID: int, agentTypeID: int, agentID: int, eventTypeID: int, eventStatus: str, eventParameters: str, processID: int, result: str, percentComplete: int, priority: int, expirationEpoch: int, attemptNumber: int, maxAttempts: int, checkoutToken: str, tagString: str, tagNumber: int, creationDate: str, createdBy: int, lastModifiedDate: str, lastModifiedBy: int):
|
|
38
38
|
|
|
39
39
|
self.eventID = key
|
|
40
40
|
self.userID = userID
|
|
@@ -62,8 +62,8 @@ class Event:
|
|
|
62
62
|
|
|
63
63
|
class EventWithNames(Event):
|
|
64
64
|
|
|
65
|
-
def __init__(self, key, userID, deviceID, agentTypeID, agentID, eventTypeID, eventStatus, eventParameters, processID, result, percentComplete, priority, expirationEpoch, attemptNumber, maxAttempts, checkoutToken, tagString, tagNumber, creationDate, createdBy, lastModifiedDate, lastModifiedBy, deviceName, eventType, agentType, version, eventStatusName, agentIndex):
|
|
66
|
-
super().__init__(key, userID, deviceID, agentTypeID, agentID, eventTypeID, eventStatus, eventParameters,
|
|
65
|
+
def __init__(self, key: int, userID: int, deviceID: int, agentTypeID: int, agentID: int, eventTypeID: int, eventStatus: str, eventParameters: str, processID: int, result: str, percentComplete: int, priority: int, expirationEpoch: int, attemptNumber: int, maxAttempts: int, checkoutToken: str, tagString: str, tagNumber: int, creationDate: str, createdBy: int, lastModifiedDate: str, lastModifiedBy: int, deviceName: str, eventType: str, agentType: str, version: str, eventStatusName: str, agentIndex: int):
|
|
66
|
+
super().__init__(key, userID, deviceID, agentTypeID, agentID, eventTypeID, eventStatus, eventParameters, processID, result, percentComplete, priority, expirationEpoch, attemptNumber, maxAttempts, checkoutToken, tagString, tagNumber, creationDate, createdBy, lastModifiedDate, lastModifiedBy)
|
|
67
67
|
self.deviceName = deviceName
|
|
68
68
|
self.eventType = eventType
|
|
69
69
|
self.agentType = agentType
|
|
@@ -74,7 +74,7 @@ class EventWithNames(Event):
|
|
|
74
74
|
|
|
75
75
|
class RecordingParameters:
|
|
76
76
|
|
|
77
|
-
def __init__(self, height, width, fps, bitrate, vflip, hflip, encoding, segment_length_seconds):
|
|
77
|
+
def __init__(self, height: int, width: int, fps: float, bitrate: int, vflip: int, hflip: int, encoding: str, segment_length_seconds: float):
|
|
78
78
|
self.height = height
|
|
79
79
|
self.width = width
|
|
80
80
|
self.fps = fps
|
|
@@ -87,7 +87,7 @@ class RecordingParameters:
|
|
|
87
87
|
|
|
88
88
|
class VideoClip:
|
|
89
89
|
|
|
90
|
-
def __init__(self, file_id=0, ts_file_id=0, video_clip_parameters='', local_file_path='', height=0, width=0, frames_per_second=0, bitrate = 0, audio_status=0, start_time=0, start_time_ms=0, end_time=0, end_time_ms=0, clip_length_in_seconds=0):
|
|
90
|
+
def __init__(self, file_id=0, ts_file_id=0, video_clip_parameters='', local_file_path='', height=0, width=0, frames_per_second:float=0, bitrate = 0, audio_status=0, start_time=0, start_time_ms=0, end_time=0, end_time_ms=0, clip_length_in_seconds:float=0):
|
|
91
91
|
self.fileID = file_id
|
|
92
92
|
self.tSFileID = ts_file_id
|
|
93
93
|
self.videoClipParameters = video_clip_parameters
|
|
@@ -106,7 +106,7 @@ class VideoClip:
|
|
|
106
106
|
|
|
107
107
|
class TranscodingParameters:
|
|
108
108
|
|
|
109
|
-
def __init__(self, file_id, source, source_file, target_file, fps, codec):
|
|
109
|
+
def __init__(self, file_id: int, source: str, source_file: str, target_file: str, fps: float, codec: str):
|
|
110
110
|
self.fileID = file_id
|
|
111
111
|
self.source = source
|
|
112
112
|
self.sourceFile = source_file
|
|
@@ -117,7 +117,7 @@ class TranscodingParameters:
|
|
|
117
117
|
|
|
118
118
|
class TransferArgs:
|
|
119
119
|
|
|
120
|
-
def __init__(self, video_clip_id, local_file_path, remote_filename, remote_folder_path):
|
|
120
|
+
def __init__(self, video_clip_id: int, local_file_path: str, remote_filename: str, remote_folder_path: str):
|
|
121
121
|
self.videoClipId = video_clip_id
|
|
122
122
|
self.localFilePath = local_file_path
|
|
123
123
|
self.remoteFilename = remote_filename
|
|
@@ -3,16 +3,17 @@ import json
|
|
|
3
3
|
from json import JSONEncoder
|
|
4
4
|
|
|
5
5
|
import ActionStreamer.CommonFunctions
|
|
6
|
+
from ActionStreamer.Config import WebServiceConfig
|
|
6
7
|
|
|
7
8
|
class PatchOperation:
|
|
8
9
|
|
|
9
|
-
def __init__(self, field_name, value):
|
|
10
|
+
def __init__(self, field_name: str, value):
|
|
10
11
|
self.field_name = field_name
|
|
11
12
|
self.value = value
|
|
12
13
|
|
|
13
14
|
class WebServiceResult:
|
|
14
15
|
|
|
15
|
-
def __init__(self, code, description, http_response_code, http_response_string, json_data):
|
|
16
|
+
def __init__(self, code: int, description: str, http_response_code: int, http_response_string: str, json_data: str):
|
|
16
17
|
self.code = code
|
|
17
18
|
self.description = description
|
|
18
19
|
self.http_response_code = http_response_code
|
|
@@ -22,12 +23,12 @@ class WebServiceResult:
|
|
|
22
23
|
class DateTimeEncoder(JSONEncoder):
|
|
23
24
|
|
|
24
25
|
# Override the default method
|
|
25
|
-
def default(self, obj):
|
|
26
|
+
def default(self, obj) -> str | None:
|
|
26
27
|
if isinstance(obj, (datetime.date, datetime.datetime)):
|
|
27
28
|
return obj.isoformat()
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
def register_agent(ws_config, device_name, agent_type, agent_version, agent_index, process_id):
|
|
31
|
+
def register_agent(ws_config: WebServiceConfig, device_name: str, agent_type: str, agent_version: str, agent_index: int, process_id: int) -> tuple[int, str]:
|
|
31
32
|
|
|
32
33
|
try:
|
|
33
34
|
jsonPostData = {"deviceName":device_name, "agentType":agent_type, "agentVersion":agent_version, "agentIndex":agent_index, "processID":process_id}
|
|
@@ -51,4 +52,4 @@ def register_agent(ws_config, device_name, agent_type, agent_version, agent_inde
|
|
|
51
52
|
response_code = -1
|
|
52
53
|
response_string = "Exception in RegisterAgent"
|
|
53
54
|
|
|
54
|
-
return response_code, response_string
|
|
55
|
+
return response_code, response_string
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import json
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
from ActionStreamer import CommonFunctions
|
|
4
|
+
from ActionStreamer.WebService.API import WebServiceResult
|
|
5
|
+
from ActionStreamer.Config import WebServiceConfig
|
|
5
6
|
|
|
6
|
-
def get_pending_event_list(ws_config, device_name):
|
|
7
|
+
def get_pending_event_list(ws_config: WebServiceConfig, device_name: str) -> WebServiceResult:
|
|
7
8
|
|
|
8
|
-
ws_result =
|
|
9
|
+
ws_result = WebServiceResult(0, '', '', '', None)
|
|
9
10
|
|
|
10
11
|
try:
|
|
11
12
|
method = "POST"
|
|
@@ -20,7 +21,7 @@ def get_pending_event_list(ws_config, device_name):
|
|
|
20
21
|
|
|
21
22
|
body = json.dumps(json_post_data)
|
|
22
23
|
|
|
23
|
-
response_code, response_string =
|
|
24
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
24
25
|
|
|
25
26
|
ws_result.http_response_code = response_code
|
|
26
27
|
ws_result.http_response_string = response_string
|
|
@@ -28,7 +29,7 @@ def get_pending_event_list(ws_config, device_name):
|
|
|
28
29
|
|
|
29
30
|
except Exception as ex:
|
|
30
31
|
ws_result.code = -1
|
|
31
|
-
filename, line_number =
|
|
32
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
32
33
|
if filename is not None and line_number is not None:
|
|
33
34
|
print(f"Exception occurred at line {line_number} in {filename}")
|
|
34
35
|
print(ex)
|
|
@@ -37,9 +38,9 @@ def get_pending_event_list(ws_config, device_name):
|
|
|
37
38
|
return ws_result
|
|
38
39
|
|
|
39
40
|
|
|
40
|
-
def dequeue_event(ws_config, device_name, agent_type):
|
|
41
|
+
def dequeue_event(ws_config: WebServiceConfig, device_name: str, agent_type: str) -> WebServiceResult:
|
|
41
42
|
|
|
42
|
-
ws_result =
|
|
43
|
+
ws_result = WebServiceResult(0, '', '', '', None)
|
|
43
44
|
|
|
44
45
|
try:
|
|
45
46
|
method = "POST"
|
|
@@ -55,7 +56,7 @@ def dequeue_event(ws_config, device_name, agent_type):
|
|
|
55
56
|
|
|
56
57
|
body = json.dumps(json_post_data)
|
|
57
58
|
|
|
58
|
-
response_code, response_string =
|
|
59
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
59
60
|
|
|
60
61
|
ws_result.http_response_code = response_code
|
|
61
62
|
ws_result.http_response_string = response_string
|
|
@@ -63,7 +64,7 @@ def dequeue_event(ws_config, device_name, agent_type):
|
|
|
63
64
|
|
|
64
65
|
except Exception as ex:
|
|
65
66
|
ws_result.code = -1
|
|
66
|
-
filename, line_number =
|
|
67
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
67
68
|
if filename is not None and line_number is not None:
|
|
68
69
|
print(f"Exception occurred at line {line_number} in {filename}")
|
|
69
70
|
print(ex)
|
|
@@ -72,9 +73,9 @@ def dequeue_event(ws_config, device_name, agent_type):
|
|
|
72
73
|
return ws_result
|
|
73
74
|
|
|
74
75
|
|
|
75
|
-
def create_event(ws_config, device_name, agent_type, event_type, event_parameters, priority=1, max_attempts=0,
|
|
76
|
+
def create_event(ws_config: WebServiceConfig, device_name: str, agent_type: str, event_type: str, event_parameters: str, priority=1, max_attempts=0, expiration_epoch=0) -> WebServiceResult:
|
|
76
77
|
|
|
77
|
-
ws_result =
|
|
78
|
+
ws_result = WebServiceResult(0, '', '', '', None)
|
|
78
79
|
|
|
79
80
|
try:
|
|
80
81
|
method = "POST"
|
|
@@ -90,12 +91,12 @@ def create_event(ws_config, device_name, agent_type, event_type, event_parameter
|
|
|
90
91
|
"eventParameters": event_parameters,
|
|
91
92
|
"priority": priority,
|
|
92
93
|
"maxAttempts": max_attempts,
|
|
93
|
-
"expirationDate":
|
|
94
|
+
"expirationDate": expiration_epoch
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
body = json.dumps(json_post_data)
|
|
97
98
|
|
|
98
|
-
response_code, response_string =
|
|
99
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
99
100
|
|
|
100
101
|
ws_result.http_response_code = response_code
|
|
101
102
|
ws_result.http_response_string = response_string
|
|
@@ -103,7 +104,7 @@ def create_event(ws_config, device_name, agent_type, event_type, event_parameter
|
|
|
103
104
|
|
|
104
105
|
except Exception as ex:
|
|
105
106
|
ws_result.code = -1
|
|
106
|
-
filename, line_number =
|
|
107
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
107
108
|
if filename is not None and line_number is not None:
|
|
108
109
|
print(f"Exception occurred at line {line_number} in {filename}")
|
|
109
110
|
print(ex)
|
|
@@ -112,9 +113,9 @@ def create_event(ws_config, device_name, agent_type, event_type, event_parameter
|
|
|
112
113
|
return ws_result
|
|
113
114
|
|
|
114
115
|
|
|
115
|
-
def get_event_details(ws_config, event_id):
|
|
116
|
+
def get_event_details(ws_config: WebServiceConfig, event_id: int) -> WebServiceResult:
|
|
116
117
|
|
|
117
|
-
ws_result =
|
|
118
|
+
ws_result = WebServiceResult(0, '', '', '', None)
|
|
118
119
|
|
|
119
120
|
try:
|
|
120
121
|
method = "GET"
|
|
@@ -124,7 +125,7 @@ def get_event_details(ws_config, event_id):
|
|
|
124
125
|
headers = {}
|
|
125
126
|
body = ''
|
|
126
127
|
|
|
127
|
-
response_code, response_string =
|
|
128
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
128
129
|
|
|
129
130
|
ws_result.http_response_code = response_code
|
|
130
131
|
ws_result.http_response_string = response_string
|
|
@@ -132,7 +133,7 @@ def get_event_details(ws_config, event_id):
|
|
|
132
133
|
|
|
133
134
|
except Exception as ex:
|
|
134
135
|
ws_result.code = -1
|
|
135
|
-
filename, line_number =
|
|
136
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
136
137
|
if filename is not None and line_number is not None:
|
|
137
138
|
print(f"Exception occurred at line {line_number} in {filename}")
|
|
138
139
|
print(ex)
|
|
@@ -141,9 +142,9 @@ def get_event_details(ws_config, event_id):
|
|
|
141
142
|
return ws_result
|
|
142
143
|
|
|
143
144
|
|
|
144
|
-
def update_event(ws_config, event_id, event_status, result, process_id, tag_string='', tag_number=0, attempt_number=1):
|
|
145
|
+
def update_event(ws_config: WebServiceConfig, event_id: int, event_status: int, result: str, process_id: int, tag_string='', tag_number=0, attempt_number=1) -> WebServiceResult:
|
|
145
146
|
|
|
146
|
-
ws_result =
|
|
147
|
+
ws_result = WebServiceResult(0, '', '', '', None)
|
|
147
148
|
|
|
148
149
|
try:
|
|
149
150
|
method = "PUT"
|
|
@@ -163,7 +164,7 @@ def update_event(ws_config, event_id, event_status, result, process_id, tag_stri
|
|
|
163
164
|
|
|
164
165
|
body = json.dumps(json_post_data)
|
|
165
166
|
|
|
166
|
-
response_code, response_string =
|
|
167
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
167
168
|
|
|
168
169
|
ws_result.http_response_code = response_code
|
|
169
170
|
ws_result.http_response_string = response_string
|
|
@@ -171,7 +172,7 @@ def update_event(ws_config, event_id, event_status, result, process_id, tag_stri
|
|
|
171
172
|
|
|
172
173
|
except Exception as ex:
|
|
173
174
|
ws_result.code = -1
|
|
174
|
-
filename, line_number =
|
|
175
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
175
176
|
if filename is not None and line_number is not None:
|
|
176
177
|
print(f"Exception occurred at line {line_number} in {filename}")
|
|
177
178
|
print(ex)
|
|
@@ -2,6 +2,7 @@ import json
|
|
|
2
2
|
|
|
3
3
|
import ActionStreamer.CommonFunctions
|
|
4
4
|
import ActionStreamer.WebService.API
|
|
5
|
+
from ActionStreamer.Config import WebServiceConfig
|
|
5
6
|
|
|
6
7
|
def create_file(ws_config: ActionStreamer.Config.WebServiceConfig, device_name: str, filename: str, file_size: int, sha256_hash: str) -> tuple[int, str, str, int]:
|
|
7
8
|
|
|
@@ -61,7 +62,7 @@ def create_file(ws_config: ActionStreamer.Config.WebServiceConfig, device_name:
|
|
|
61
62
|
return response_code, response_string, signed_url, file_id
|
|
62
63
|
|
|
63
64
|
|
|
64
|
-
def update_file_upload_success(ws_config, device_name, file_id):
|
|
65
|
+
def update_file_upload_success(ws_config: WebServiceConfig, device_name: str, file_id: int) -> tuple[int, str]:
|
|
65
66
|
|
|
66
67
|
try:
|
|
67
68
|
json_post_data = {'deviceSerial':device_name}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import json
|
|
2
2
|
|
|
3
|
-
import ActionStreamer.CommonFunctions
|
|
4
3
|
from ActionStreamer import CommonFunctions
|
|
5
4
|
from ActionStreamer.WebService.API import WebServiceResult
|
|
5
|
+
from ActionStreamer.Config import WebServiceConfig
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def create_health(ws_config, device_name, health_json):
|
|
8
|
+
def create_health(ws_config: WebServiceConfig, device_name: str, health_json: str) -> WebServiceResult:
|
|
9
9
|
|
|
10
10
|
ws_result = WebServiceResult(0, '', '', '', None)
|
|
11
11
|
|
|
@@ -23,7 +23,7 @@ def create_health(ws_config, device_name, health_json):
|
|
|
23
23
|
|
|
24
24
|
body = json.dumps(json_post_data)
|
|
25
25
|
|
|
26
|
-
response_code, response_string =
|
|
26
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
27
27
|
|
|
28
28
|
ws_result.http_response_code = response_code
|
|
29
29
|
ws_result.http_response_string = response_string
|
|
@@ -39,7 +39,7 @@ def create_health(ws_config, device_name, health_json):
|
|
|
39
39
|
return ws_result
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
def update_health(ws_config, device_name, health_json):
|
|
42
|
+
def update_health(ws_config: WebServiceConfig, device_name: str, health_json: str) -> WebServiceResult:
|
|
43
43
|
|
|
44
44
|
ws_result = WebServiceResult(0, '', '', '', None)
|
|
45
45
|
|
|
@@ -57,7 +57,7 @@ def update_health(ws_config, device_name, health_json):
|
|
|
57
57
|
|
|
58
58
|
body = json.dumps(json_post_data)
|
|
59
59
|
|
|
60
|
-
response_code, response_string =
|
|
60
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
61
61
|
|
|
62
62
|
ws_result.http_response_code = response_code
|
|
63
63
|
ws_result.http_response_string = response_string
|
|
@@ -65,7 +65,7 @@ def update_health(ws_config, device_name, health_json):
|
|
|
65
65
|
|
|
66
66
|
except Exception as ex:
|
|
67
67
|
ws_result.code = -1
|
|
68
|
-
filename, line_number =
|
|
68
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
69
69
|
if filename is not None and line_number is not None:
|
|
70
70
|
print(f"Exception occurred at line {line_number} in {filename}")
|
|
71
71
|
print(ex)
|
{actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/LogMessage/LogMessage.py
RENAMED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import json
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
from ActionStreamer import CommonFunctions
|
|
5
5
|
from ActionStreamer.Config import LogConfig
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
def create_log_message(log_config: LogConfig, message: str, log_to_console=True) -> tuple[int, str]:
|
|
8
9
|
|
|
9
10
|
try:
|
|
10
11
|
if (log_to_console):
|
|
11
12
|
agent_name = str(log_config.agent_type) + "Agent:" + str(log_config.agent_index) + "_" + str(log_config.agent_version)
|
|
12
|
-
|
|
13
|
+
CommonFunctions.log_to_console(message, agent_name)
|
|
13
14
|
|
|
14
15
|
utc_now = datetime.datetime.now(datetime.timezone.utc)
|
|
15
16
|
post_data = {"deviceSerial": log_config.device_name, "agentType": log_config.agent_type, "agentVersion": log_config.agent_version, "agentIndex": log_config.agent_index, "processID": log_config.process_id, "message": message, "logDate": str(utc_now)}
|
|
@@ -21,11 +22,11 @@ def create_log_message(log_config: LogConfig, message, log_to_console=True):
|
|
|
21
22
|
parameters = ''
|
|
22
23
|
body = json.dumps(post_data)
|
|
23
24
|
|
|
24
|
-
response_code, response_string =
|
|
25
|
+
response_code, response_string = CommonFunctions.send_signed_request(log_config.ws_config, method, url, path, headers, parameters, body)
|
|
25
26
|
|
|
26
27
|
except Exception as ex:
|
|
27
28
|
|
|
28
|
-
filename, line_number =
|
|
29
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
29
30
|
if filename is not None and line_number is not None:
|
|
30
31
|
print(f"Exception occurred at line {line_number} in {filename}")
|
|
31
32
|
print(ex)
|
|
@@ -3,11 +3,11 @@ import json
|
|
|
3
3
|
from ActionStreamer.WebService.API import PatchOperation
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def add_patch_operation(operations, field_name, value):
|
|
6
|
+
def add_patch_operation(operations: list, field_name: str, value: str | int) -> list:
|
|
7
7
|
operations.append(PatchOperation(field_name, value))
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def generate_patch_json(operations):
|
|
10
|
+
def generate_patch_json(operations: list) -> str:
|
|
11
11
|
# Convert all values to strings
|
|
12
12
|
operations_str = [{k: str(v) for k, v in vars(op).items()} for op in operations]
|
|
13
13
|
json_data = json.dumps(operations_str)
|
{actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/VideoClip/VideoClip.py
RENAMED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import json
|
|
2
2
|
|
|
3
3
|
from ActionStreamer import CommonFunctions
|
|
4
|
-
from ActionStreamer.
|
|
4
|
+
from ActionStreamer.Config import WebServiceConfig
|
|
5
5
|
from ActionStreamer.WebService.Patch import *
|
|
6
|
+
from ActionStreamer.Model import VideoClip
|
|
6
7
|
|
|
7
|
-
def create_video_clip(ws_config, device_name, video_clip):
|
|
8
|
+
def create_video_clip(ws_config: WebServiceConfig, device_name: str, video_clip: VideoClip) -> tuple[int, str]:
|
|
8
9
|
|
|
9
10
|
try:
|
|
10
11
|
method = "POST"
|
|
@@ -29,7 +30,7 @@ def create_video_clip(ws_config, device_name, video_clip):
|
|
|
29
30
|
return response_code, response_string
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
def update_file_id(ws_config, video_clip_id, file_id):
|
|
33
|
+
def update_file_id(ws_config: WebServiceConfig, video_clip_id: int, file_id: int) -> tuple[int, str]:
|
|
33
34
|
|
|
34
35
|
try:
|
|
35
36
|
operations_list = []
|
|
@@ -42,7 +43,7 @@ def update_file_id(ws_config, video_clip_id, file_id):
|
|
|
42
43
|
parameters = ''
|
|
43
44
|
body = generate_patch_json(operations_list)
|
|
44
45
|
|
|
45
|
-
response_code,
|
|
46
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
46
47
|
|
|
47
48
|
except Exception as ex:
|
|
48
49
|
|
|
@@ -52,6 +53,6 @@ def update_file_id(ws_config, video_clip_id, file_id):
|
|
|
52
53
|
print(ex)
|
|
53
54
|
|
|
54
55
|
response_code = -1
|
|
55
|
-
|
|
56
|
+
response_string = "Exception in UpdateVideoClipFileID"
|
|
56
57
|
|
|
57
|
-
return response_code,
|
|
58
|
+
return response_code, response_string
|
{actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/CommonFunctions/Wifi/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/Health/__init__.py
RENAMED
|
File without changes
|
{actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/LogMessage/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{actionstreamer-0.2.24 → actionstreamer-0.2.26}/ActionStreamer/WebService/VideoClip/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|