ActionStreamer 1.2.6__tar.gz → 1.2.8__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-1.2.6 → actionstreamer-1.2.8}/PKG-INFO +1 -1
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/Config/Config.py +63 -1
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/Config/__init__.py +2 -2
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/Model/Model.py +41 -3
- actionstreamer-1.2.8/actionstreamer/Model/__init__.py +4 -0
- actionstreamer-1.2.8/actionstreamer/WebService/EventPreset/EventPreset.py +83 -0
- actionstreamer-1.2.8/actionstreamer/WebService/EventPreset/__init__.py +4 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/File/File.py +1 -1
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/pyproject.toml +1 -1
- actionstreamer-1.2.6/actionstreamer/Model/__init__.py +0 -4
- actionstreamer-1.2.6/actionstreamer/WebService/EventPreset/EventPreset.py +0 -35
- actionstreamer-1.2.6/actionstreamer/WebService/EventPreset/__init__.py +0 -4
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/README.md +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/CommonFunctions/CommonFunctions.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/CommonFunctions/Wifi/Wifi.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/CommonFunctions/Wifi/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/CommonFunctions/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/Device/Device.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/Device/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/API/API.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/API/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/Event/Event.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/Event/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/File/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/Health/Health.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/Health/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/LogMessage/LogMessage.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/LogMessage/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/Patch/Patch.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/Patch/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/Tag/Tag.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/Tag/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/VideoClip/VideoClip.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/VideoClip/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/__init__.py +0 -0
- {actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/__init__.py +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import os
|
|
2
3
|
import platform
|
|
3
4
|
|
|
@@ -128,4 +129,65 @@ def set_config_value(config_folder_path: str, name: str, value: str) -> bool:
|
|
|
128
129
|
|
|
129
130
|
except Exception as ex:
|
|
130
131
|
print(f"Error occurred while setting value in '{name}': {ex}")
|
|
131
|
-
return False
|
|
132
|
+
return False
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def load_json(file_path):
|
|
136
|
+
"""Load JSON from file, creating an empty dict if the file doesn't exist."""
|
|
137
|
+
if not os.path.exists(file_path):
|
|
138
|
+
return {}
|
|
139
|
+
with open(file_path, "r", encoding="utf-8") as f:
|
|
140
|
+
try:
|
|
141
|
+
return json.load(f)
|
|
142
|
+
except json.JSONDecodeError:
|
|
143
|
+
return {}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def save_json(file_path, data):
|
|
147
|
+
"""Save JSON to file, ensuring directories exist."""
|
|
148
|
+
os.makedirs(os.path.dirname(file_path), exist_ok=True)
|
|
149
|
+
with open(file_path, "w", encoding="utf-8") as f:
|
|
150
|
+
json.dump(data, f, indent=4)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def get_json_value(data, path):
|
|
154
|
+
"""Retrieve a value from a nested dictionary using a dot-separated path."""
|
|
155
|
+
keys = path.split(".")
|
|
156
|
+
for key in keys:
|
|
157
|
+
if not isinstance(data, dict) or key not in data:
|
|
158
|
+
return None # Key path doesn't exist
|
|
159
|
+
data = data[key]
|
|
160
|
+
return data
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def set_json_value(data, path, value):
|
|
164
|
+
"""Set a value in a nested dictionary using a dot-separated path."""
|
|
165
|
+
keys = path.split(".")
|
|
166
|
+
d = data
|
|
167
|
+
for key in keys[:-1]:
|
|
168
|
+
if key not in d or not isinstance(d[key], dict):
|
|
169
|
+
d[key] = {} # Create nested dict if needed
|
|
170
|
+
d = d[key]
|
|
171
|
+
d[keys[-1]] = value # Set final value
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def read_json_value(file_path, json_path):
|
|
175
|
+
"""Read a value from a JSON file using a path."""
|
|
176
|
+
data = load_json(file_path)
|
|
177
|
+
return get_json_value(data, json_path)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def write_json_value(file_path, json_path, value):
|
|
181
|
+
"""Write a value to a JSON file using a path."""
|
|
182
|
+
data = load_json(file_path)
|
|
183
|
+
set_json_value(data, json_path, value)
|
|
184
|
+
save_json(file_path, data)
|
|
185
|
+
|
|
186
|
+
# # Example usage
|
|
187
|
+
# config_path = "config.json"
|
|
188
|
+
|
|
189
|
+
# # Set a value
|
|
190
|
+
# write_value(config_path, "myroot.mychild.isenabled", True)
|
|
191
|
+
|
|
192
|
+
# # Get a value
|
|
193
|
+
# print(read_value(config_path, "myroot.mychild.isenabled")) # Output: True
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from .Config import WebServiceConfig, LogConfig, is_windows, get_config_folder_path, get_appdata_folder_path, get_config_value, set_config_value
|
|
1
|
+
from .Config import WebServiceConfig, LogConfig, is_windows, get_config_folder_path, get_appdata_folder_path, get_config_value, set_config_value, read_json_value, write_json_value
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
__all__ = ['WebServiceConfig', 'LogConfig', 'is_windows', 'get_config_folder_path', 'get_appdata_folder_path', 'get_config_value', 'set_config_value']
|
|
4
|
+
__all__ = ['WebServiceConfig', 'LogConfig', 'is_windows', 'get_config_folder_path', 'get_appdata_folder_path', 'get_config_value', 'set_config_value', 'read_json_value', 'write_json_value']
|
|
@@ -180,7 +180,7 @@ class RTMPParameters:
|
|
|
180
180
|
|
|
181
181
|
class RTMPArgs:
|
|
182
182
|
|
|
183
|
-
def __init__(self, height: int = 1920, width: int = 1080, fps: float = 30, bitrate: int = 5000000, server: str = '', port: int = 0, streamName: str = '', streamKey: str = '', hflip: int = 0, vflip: int = 0, **kwargs):
|
|
183
|
+
def __init__(self, height: int = 1920, width: int = 1080, fps: float = 30, bitrate: int = 5000000, server: str = '', port: int = 0, streamName: str = '', streamKey: str = '', hflip: int = 0, vflip: int = 0, rotationDegrees: int = 0, **kwargs):
|
|
184
184
|
self.height = height
|
|
185
185
|
self.width = width
|
|
186
186
|
self.fps = fps
|
|
@@ -191,6 +191,7 @@ class RTMPArgs:
|
|
|
191
191
|
self.stream_key = streamKey
|
|
192
192
|
self.hflip = hflip
|
|
193
193
|
self.vflip = vflip
|
|
194
|
+
self.rotationDegrees = rotationDegrees
|
|
194
195
|
# Optionally store any extra fields
|
|
195
196
|
self.extra_fields = kwargs
|
|
196
197
|
|
|
@@ -337,7 +338,7 @@ class ConcatenateClipsArgs:
|
|
|
337
338
|
|
|
338
339
|
class ConferenceArgs:
|
|
339
340
|
|
|
340
|
-
def __init__(self, url: str, roomName: str, displayName: str, videoWidth: int = 1280, videoHeight: int = 720, framerate: float = 30, videoBitrate: int = 1000000, sendVideo: bool = True, sendAudio: bool = True, receiveVideo: bool = True, receiveAudio: bool = True, **kwargs):
|
|
341
|
+
def __init__(self, url: str, roomName: str, displayName: str, videoWidth: int = 1280, videoHeight: int = 720, framerate: float = 30, videoBitrate: int = 1000000, sendVideo: bool = True, sendAudio: bool = True, receiveVideo: bool = True, receiveAudio: bool = True, rotationDegrees: int = 0, **kwargs):
|
|
341
342
|
self.url = url
|
|
342
343
|
self.roomName = roomName
|
|
343
344
|
self.displayName = displayName
|
|
@@ -349,6 +350,7 @@ class ConferenceArgs:
|
|
|
349
350
|
self.sendAudio = sendAudio
|
|
350
351
|
self.receiveVideo = receiveVideo
|
|
351
352
|
self.receiveAudio = receiveAudio
|
|
353
|
+
self.rotationDegrees = rotationDegrees
|
|
352
354
|
# Store or ignore unknown fields
|
|
353
355
|
self.extra_fields = kwargs # Optionally, store unknown fields for debugging or logging
|
|
354
356
|
|
|
@@ -434,7 +436,7 @@ class StandardResult:
|
|
|
434
436
|
|
|
435
437
|
class DeviceObject:
|
|
436
438
|
|
|
437
|
-
def __init__(self, key: int = 0, deviceTypeID: int = 0, userID: int = 0, deviceName: str = '', serialNumber: str = '', deviceDescription: str = '', recentOutput: str = '', cameraStatus: str = '', lastIPAddress: str = '', tunnelIPAddress: str = '', lastHeardFromDate: datetime = datetime.now(), softwareDate: datetime = datetime.now(), location: str = '', setupStatus: int = 0, autoSendFiles: int = 0, runStartupEvent: int = 0, deviceReadyEventPresetID: int = 0, standaloneEventPresetID: int = 0, logHealth: int = 0, audioChannelName: str = '', volume: int = 0, commentListID = 0, isArchived: bool = False, gUID: str = '', creationDate: datetime = datetime.now(), createdBy: int = 0, lastModifiedDate: datetime = datetime.now(), lastModifiedBy: int = 0, **kwargs):
|
|
439
|
+
def __init__(self, key: int = 0, deviceTypeID: int = 0, userID: int = 0, deviceName: str = '', serialNumber: str = '', deviceDescription: str = '', recentOutput: str = '', cameraStatus: str = '', lastIPAddress: str = '', tunnelIPAddress: str = '', lastHeardFromDate: datetime = datetime.now(), softwareDate: datetime = datetime.now(), location: str = '', setupStatus: int = 0, autoSendFiles: int = 0, runStartupEvent: int = 0, deviceReadyEventPresetID: int = 0, standaloneEventPresetID: int = 0, logHealth: int = 0, runAnalytics: int = 0, audioChannelName: str = '', volume: int = 0, commentListID = 0, isArchived: bool = False, gUID: str = '', creationDate: datetime = datetime.now(), createdBy: int = 0, lastModifiedDate: datetime = datetime.now(), lastModifiedBy: int = 0, **kwargs):
|
|
438
440
|
self.key = key
|
|
439
441
|
self.deviceTypeID = deviceTypeID
|
|
440
442
|
self.userID = userID
|
|
@@ -454,6 +456,7 @@ class DeviceObject:
|
|
|
454
456
|
self.deviceReadyEventPresetID = deviceReadyEventPresetID
|
|
455
457
|
self.standaloneEventPresetID = standaloneEventPresetID
|
|
456
458
|
self.logHealth = logHealth
|
|
459
|
+
self.runAnalytics = runAnalytics
|
|
457
460
|
self.audioChannelName = audioChannelName
|
|
458
461
|
self.volume = volume
|
|
459
462
|
self.commentListID = commentListID
|
|
@@ -525,6 +528,41 @@ class CreateVideoClip:
|
|
|
525
528
|
# Optionally store any extra fields
|
|
526
529
|
self.extra_fields = kwargs
|
|
527
530
|
|
|
531
|
+
# Warn or log if there are unexpected keyword arguments
|
|
532
|
+
if kwargs:
|
|
533
|
+
print(f"Warning: Ignoring unexpected arguments: {kwargs}")
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
class EventPreset:
|
|
537
|
+
|
|
538
|
+
def __init__(self, deviceID: int = 0, agentTypeID: int = 0, eventTypeID: int = 0, eventParameters: str = '', eventPresetName: str = '', priority: int = 1, maxAttempts: int = 5, expirationEpoch: int = 0, **kwargs):
|
|
539
|
+
self.deviceID = deviceID
|
|
540
|
+
self.agentTypeID = agentTypeID
|
|
541
|
+
self.eventTypeID = eventTypeID
|
|
542
|
+
self.eventParameters = eventParameters
|
|
543
|
+
self.eventPresetName = eventPresetName
|
|
544
|
+
self.priority = priority
|
|
545
|
+
self.maxAttempts = maxAttempts
|
|
546
|
+
self.expirationEpoch = expirationEpoch
|
|
547
|
+
|
|
548
|
+
# Warn or log if there are unexpected keyword arguments
|
|
549
|
+
if kwargs:
|
|
550
|
+
print(f"Warning: Ignoring unexpected arguments: {kwargs}")
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
class StartRecordingParameters:
|
|
554
|
+
|
|
555
|
+
def __init__(self, width: int = 0, height: int = 0, fps: int = 0, bitrate: int = 0, segmentLengthSeconds: int = 0, hflip: int = 0, vflip: int = 0, rotationDegrees: int = 0, audio: int = 0, **kwargs):
|
|
556
|
+
self.width = width
|
|
557
|
+
self.height = height
|
|
558
|
+
self.fps = fps
|
|
559
|
+
self.bitrate = bitrate
|
|
560
|
+
self.segmentLengthSeconds = segmentLengthSeconds
|
|
561
|
+
self.hflip = hflip
|
|
562
|
+
self.vflip = vflip
|
|
563
|
+
self.rotationDegrees = rotationDegrees
|
|
564
|
+
self.audio = audio
|
|
565
|
+
|
|
528
566
|
# Warn or log if there are unexpected keyword arguments
|
|
529
567
|
if kwargs:
|
|
530
568
|
print(f"Warning: Ignoring unexpected arguments: {kwargs}")
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
from .Model import Event, EventWithNames, EventType, EventStatus, EventPreset, VideoClip, RecordingParameters, RecordingArgs, TranscodingParameters, TranscodingArgs, TransferArgs, ConcatenateClipsArgs, File, RTMPParameters, RTMPArgs, WifiConnection, NameValuePair, EventDetails, StandardResult, EpochRange, DeviceObject, CreateVideoClip, VideoClipType, ConferenceArgs
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
__all__ = ['Event', 'EventWithNames', 'EventType', 'EventStatus', 'EventPreset', 'VideoClip', 'RecordingParameters', 'RecordingArgs', 'TranscodingParameters', 'TranscodingArgs', 'TransferArgs', 'ConcatenateClipsArgs', 'File', 'RTMPParameters', 'RTMPArgs', 'WifiConnection', 'NameValuePair', 'EventDetails', 'StandardResult', 'EpochRange', 'DeviceObject', 'CreateVideoClip', 'VideoClipType', 'ConferenceArgs']
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from actionstreamer import CommonFunctions, Model
|
|
4
|
+
from actionstreamer.WebService.API import WebServiceResult
|
|
5
|
+
from actionstreamer.Config import WebServiceConfig
|
|
6
|
+
|
|
7
|
+
def run_event_preset(ws_config: WebServiceConfig, event_preset_id: int) -> WebServiceResult:
|
|
8
|
+
|
|
9
|
+
ws_result = WebServiceResult(0, '', '', '', None)
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
method = "POST"
|
|
13
|
+
path = 'v1/eventpreset/run/' + str(event_preset_id)
|
|
14
|
+
url = ws_config.base_url + path
|
|
15
|
+
headers = {"Content-Type": "application/json"}
|
|
16
|
+
parameters = ''
|
|
17
|
+
|
|
18
|
+
json_post_data = {}
|
|
19
|
+
body = json.dumps(json_post_data)
|
|
20
|
+
|
|
21
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
22
|
+
|
|
23
|
+
ws_result.http_response_code = response_code
|
|
24
|
+
ws_result.http_response_string = response_string
|
|
25
|
+
ws_result.json_data = json.loads(response_string)
|
|
26
|
+
|
|
27
|
+
except Exception as ex:
|
|
28
|
+
ws_result.code = -1
|
|
29
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
30
|
+
if filename is not None and line_number is not None:
|
|
31
|
+
print(f"Exception occurred at line {line_number} in {filename}")
|
|
32
|
+
print(ex)
|
|
33
|
+
ws_result.description = str(ex)
|
|
34
|
+
|
|
35
|
+
return ws_result
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def create_event_preset(ws_config: WebServiceConfig, event_preset: Model.EventPreset, event_type: Model.EventType, event_parameters: Model.StartRecordingParameters | Model.StopRecordingParameters) -> tuple[int, str]:
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
method = "POST"
|
|
42
|
+
path = 'v1/eventpreset/'
|
|
43
|
+
url = ws_config.base_url + path
|
|
44
|
+
headers = {"Content-Type": "application/json"}
|
|
45
|
+
parameters = ''
|
|
46
|
+
|
|
47
|
+
# Set the event parameters based on the event type.
|
|
48
|
+
if event_type == Model.EventType.Video.Start_recording:
|
|
49
|
+
event_parameters_json = Model.RecordingArgs (**event_parameters)
|
|
50
|
+
|
|
51
|
+
elif event_type == Model.EventType.Video.Stop_recording:
|
|
52
|
+
event_parameters_json = None
|
|
53
|
+
|
|
54
|
+
elif event_type == Model.EventType.Video.Start_RTMP:
|
|
55
|
+
event_parameters_json = Model.RTMPArgs(**event_parameters)
|
|
56
|
+
|
|
57
|
+
elif event_type == Model.EventType.Video.Stop_RTMP:
|
|
58
|
+
event_parameters_json = None
|
|
59
|
+
|
|
60
|
+
elif event_type == Model.EventType.Video.Join_conference:
|
|
61
|
+
event_parameters_json = Model.ConferenceArgs(**event_parameters)
|
|
62
|
+
|
|
63
|
+
elif event_type == Model.EventType.Video.Leave_conference:
|
|
64
|
+
event_parameters_json = None
|
|
65
|
+
|
|
66
|
+
else:
|
|
67
|
+
raise ValueError('Invalid event type]')
|
|
68
|
+
|
|
69
|
+
body = json.dumps(event_preset.__dict__)
|
|
70
|
+
|
|
71
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
72
|
+
|
|
73
|
+
except Exception as ex:
|
|
74
|
+
|
|
75
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
76
|
+
if filename is not None and line_number is not None:
|
|
77
|
+
print(f"Exception occurred at line {line_number} in {filename}")
|
|
78
|
+
print(ex)
|
|
79
|
+
|
|
80
|
+
response_code = -1
|
|
81
|
+
response_string = "Exception in create_event_preset. Line number " + str(line_number)
|
|
82
|
+
|
|
83
|
+
return response_code, response_string
|
|
@@ -70,7 +70,7 @@ def create_temp_file(ws_config: actionstreamer.Config.WebServiceConfig, device_n
|
|
|
70
70
|
|
|
71
71
|
Parameters:
|
|
72
72
|
ws_config (Config.WebServiceConfig): The web service configuration.
|
|
73
|
-
device_name (string): The device
|
|
73
|
+
device_name (string): The device serial number.
|
|
74
74
|
filename (string): The filename (no path information, just the name).
|
|
75
75
|
file_size (int): The file size in bytes.
|
|
76
76
|
sha256_hash (string): The SHA256 hash for the file.
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
from .Model import Event, EventWithNames, EventType, EventStatus, VideoClip, RecordingParameters, RecordingArgs, TranscodingParameters, TranscodingArgs, TransferArgs, ConcatenateClipsArgs, File, RTMPParameters, RTMPArgs, WifiConnection, NameValuePair, EventDetails, StandardResult, EpochRange, DeviceObject, CreateVideoClip, VideoClipType, ConferenceArgs
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
__all__ = ['Event', 'EventWithNames', 'EventType', 'EventStatus', 'VideoClip', 'RecordingParameters', 'RecordingArgs', 'TranscodingParameters', 'TranscodingArgs', 'TransferArgs', 'ConcatenateClipsArgs', 'File', 'RTMPParameters', 'RTMPArgs', 'WifiConnection', 'NameValuePair', 'EventDetails', 'StandardResult', 'EpochRange', 'DeviceObject', 'CreateVideoClip', 'VideoClipType', 'ConferenceArgs']
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
|
|
3
|
-
from actionstreamer import CommonFunctions
|
|
4
|
-
from actionstreamer.WebService.API import WebServiceResult
|
|
5
|
-
from actionstreamer.Config import WebServiceConfig
|
|
6
|
-
|
|
7
|
-
def run_event_preset(ws_config: WebServiceConfig, event_preset_id: int) -> WebServiceResult:
|
|
8
|
-
|
|
9
|
-
ws_result = WebServiceResult(0, '', '', '', None)
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
method = "POST"
|
|
13
|
-
path = 'v1/eventpreset/run/' + str(event_preset_id)
|
|
14
|
-
url = ws_config.base_url + path
|
|
15
|
-
headers = {"Content-Type": "application/json"}
|
|
16
|
-
parameters = ''
|
|
17
|
-
|
|
18
|
-
json_post_data = {}
|
|
19
|
-
body = json.dumps(json_post_data)
|
|
20
|
-
|
|
21
|
-
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
22
|
-
|
|
23
|
-
ws_result.http_response_code = response_code
|
|
24
|
-
ws_result.http_response_string = response_string
|
|
25
|
-
ws_result.json_data = json.loads(response_string)
|
|
26
|
-
|
|
27
|
-
except Exception as ex:
|
|
28
|
-
ws_result.code = -1
|
|
29
|
-
filename, line_number = CommonFunctions.get_exception_info()
|
|
30
|
-
if filename is not None and line_number is not None:
|
|
31
|
-
print(f"Exception occurred at line {line_number} in {filename}")
|
|
32
|
-
print(ex)
|
|
33
|
-
ws_result.description = str(ex)
|
|
34
|
-
|
|
35
|
-
return ws_result
|
|
File without changes
|
{actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/CommonFunctions/CommonFunctions.py
RENAMED
|
File without changes
|
|
File without changes
|
{actionstreamer-1.2.6 → actionstreamer-1.2.8}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/LogMessage/LogMessage.py
RENAMED
|
File without changes
|
{actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/LogMessage/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/VideoClip/VideoClip.py
RENAMED
|
File without changes
|
{actionstreamer-1.2.6 → actionstreamer-1.2.8}/actionstreamer/WebService/VideoClip/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|