ActionStreamer 1.1.44__tar.gz → 1.2.2__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.1.44 → actionstreamer-1.2.2}/PKG-INFO +1 -1
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/Model/Model.py +6 -3
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/File/File.py +58 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/File/__init__.py +2 -2
- actionstreamer-1.2.2/actionstreamer/WebService/Tag/Tag.py +95 -0
- actionstreamer-1.2.2/actionstreamer/WebService/Tag/__init__.py +4 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/__init__.py +2 -2
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/pyproject.toml +1 -1
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/README.md +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/CommonFunctions/CommonFunctions.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/CommonFunctions/Wifi/Wifi.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/CommonFunctions/Wifi/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/CommonFunctions/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/Config/Config.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/Config/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/Device/Device.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/Device/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/Model/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/API/API.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/API/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/Event/Event.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/Event/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/EventPreset/EventPreset.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/EventPreset/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/Health/Health.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/Health/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/LogMessage/LogMessage.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/LogMessage/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/Patch/Patch.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/Patch/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/VideoClip/VideoClip.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/VideoClip/__init__.py +0 -0
- {actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/__init__.py +0 -0
|
@@ -110,7 +110,7 @@ class EventWithNames(Event):
|
|
|
110
110
|
|
|
111
111
|
class RecordingParameters:
|
|
112
112
|
|
|
113
|
-
def __init__(self, height: int = 1920, width: int = 1080, fps: float = 30, bitrate: int = 5000000, vflip: int = 0, hflip: int = 0, encoding: str = '', segmentLengthSeconds: float = 0, audio: int = 0):
|
|
113
|
+
def __init__(self, height: int = 1920, width: int = 1080, fps: float = 30, bitrate: int = 5000000, vflip: int = 0, hflip: int = 0, encoding: str = '', segmentLengthSeconds: float = 0, audio: int = 0, rotationDegrees: int = 0, **kwargs):
|
|
114
114
|
self.height = height
|
|
115
115
|
self.width = width
|
|
116
116
|
self.fps = fps
|
|
@@ -120,7 +120,9 @@ class RecordingParameters:
|
|
|
120
120
|
self.encoding = encoding
|
|
121
121
|
self.segmentLengthSeconds = segmentLengthSeconds
|
|
122
122
|
self.audio = audio
|
|
123
|
-
|
|
123
|
+
#self.rotationDegrees = rotationDegrees
|
|
124
|
+
# Store or ignore unknown fields
|
|
125
|
+
self.extra_fields = kwargs # Optionally, store unknown fields for debugging or logging
|
|
124
126
|
|
|
125
127
|
class RTMPParameters:
|
|
126
128
|
|
|
@@ -372,4 +374,5 @@ class CreateVideoClip:
|
|
|
372
374
|
self.clipLengthInSeconds = clipLengthInSeconds
|
|
373
375
|
self.videoClipStatus = videoClipStatus
|
|
374
376
|
self.videoClipTypeID = videoClipTypeID
|
|
375
|
-
self.videoClipParameters = videoClipParameters
|
|
377
|
+
self.videoClipParameters = videoClipParameters
|
|
378
|
+
|
|
@@ -63,6 +63,64 @@ def create_file(ws_config: actionstreamer.Config.WebServiceConfig, device_name:
|
|
|
63
63
|
return response_code, response_string, signed_url, file_id
|
|
64
64
|
|
|
65
65
|
|
|
66
|
+
def create_temp_file(ws_config: actionstreamer.Config.WebServiceConfig, device_name: str, filename: str, file_size: int, sha256_hash: str) -> tuple[int, str, str, int]:
|
|
67
|
+
|
|
68
|
+
"""
|
|
69
|
+
Create a temp file. This file will be deleted from S3 after 24 hours.
|
|
70
|
+
|
|
71
|
+
Parameters:
|
|
72
|
+
ws_config (Config.WebServiceConfig): The web service configuration.
|
|
73
|
+
device_name (string): The device name.
|
|
74
|
+
filename (string): The filename (no path information, just the name).
|
|
75
|
+
file_size (int): The file size in bytes.
|
|
76
|
+
sha256_hash (string): The SHA256 hash for the file.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
response_code: The API HTTP response code.
|
|
80
|
+
response_string: The API HTTP response body
|
|
81
|
+
signed_url: The URL to upload the file to.
|
|
82
|
+
file_id: The ID for the newly generated file.
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
json_post_data = {"deviceName":device_name, "filename":filename, "fileSize":file_size, "sHA256Hash":sha256_hash}
|
|
87
|
+
|
|
88
|
+
method = "POST"
|
|
89
|
+
path = 'v1/file/temp'
|
|
90
|
+
url = ws_config.base_url + path
|
|
91
|
+
headers = {"Content-Type": "application/json"}
|
|
92
|
+
parameters = ''
|
|
93
|
+
body = json.dumps(json_post_data)
|
|
94
|
+
|
|
95
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
96
|
+
|
|
97
|
+
signed_url = ''
|
|
98
|
+
file_id = 0
|
|
99
|
+
|
|
100
|
+
if (response_code == 200):
|
|
101
|
+
|
|
102
|
+
# This response should include signedURL, fileID
|
|
103
|
+
response_data = json.loads(response_string)
|
|
104
|
+
|
|
105
|
+
signed_url = response_data['signedURL']
|
|
106
|
+
file_id = response_data['fileID']
|
|
107
|
+
|
|
108
|
+
except Exception as ex:
|
|
109
|
+
|
|
110
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
111
|
+
|
|
112
|
+
if filename is not None and line_number is not None:
|
|
113
|
+
print(f"Exception occurred at line {line_number} in {filename}")
|
|
114
|
+
print(ex)
|
|
115
|
+
|
|
116
|
+
response_code = -1
|
|
117
|
+
response_string = "Exception in create_file"
|
|
118
|
+
signed_url = ""
|
|
119
|
+
file_id = 0
|
|
120
|
+
|
|
121
|
+
return response_code, response_string, signed_url, file_id
|
|
122
|
+
|
|
123
|
+
|
|
66
124
|
def update_file_upload_success(ws_config: WebServiceConfig, device_name: str, file_id: int) -> WebServiceResult:
|
|
67
125
|
|
|
68
126
|
ws_result = WebServiceResult(0, '', '', '', None)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from .File import create_file, update_file_upload_success, get_file
|
|
1
|
+
from .File import create_file, update_file_upload_success, get_file, create_temp_file
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
__all__ = ['create_file', 'update_file_upload_success', 'get_file']
|
|
4
|
+
__all__ = ['create_file', 'update_file_upload_success', 'get_file', 'create_temp_file']
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from actionstreamer import CommonFunctions
|
|
4
|
+
import actionstreamer.WebService.API
|
|
5
|
+
from actionstreamer.WebService.API import WebServiceResult
|
|
6
|
+
from actionstreamer.Config import WebServiceConfig
|
|
7
|
+
|
|
8
|
+
def get_tags_for_uploaded_temp_image(ws_config: actionstreamer.Config.WebServiceConfig, object_name: str, device_id: int, video_clip_id: int = 0, epoch_time: int = 0, epoch_time_ms: int = 0) -> tuple[int, str]:
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Get tags for an image using AWS Recognition.
|
|
12
|
+
The file must have already been uploaded using a signed URL for ActionStreamer's temporary cloud storage.
|
|
13
|
+
If optional arguments are omitted, the web service will not add records to the database, it will simply return the tags.
|
|
14
|
+
Return an array of {Label: str, Confidence: float}.
|
|
15
|
+
|
|
16
|
+
Parameters:
|
|
17
|
+
ws_config (Config.WebServiceConfig): The web service configuration.
|
|
18
|
+
object_name (string): The uploaded file's object name.
|
|
19
|
+
device_id (int): The device that recorded the video where the image was extracted.
|
|
20
|
+
video_clip_id: The video clip the image was extracted from. Optional.
|
|
21
|
+
epoch_time: The epoch timestamp of the frame. Optional.
|
|
22
|
+
epoch_time_ms: The millisecond value of the timestamp. Optional.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
response_code: The API HTTP response code.
|
|
26
|
+
response_string: The API HTTP response body
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
# Call the web service to get the tags for this image.
|
|
31
|
+
json_post_data = {"objectName": object_name, "deviceID": device_id, "videoClipID": video_clip_id, "epochTime": epoch_time, "epochTimeMs": epoch_time_ms}
|
|
32
|
+
|
|
33
|
+
method = "POST"
|
|
34
|
+
path = 'v1/tag/image'
|
|
35
|
+
url = ws_config.base_url + path
|
|
36
|
+
headers = {"Content-Type": "application/json"}
|
|
37
|
+
parameters = ''
|
|
38
|
+
body = json.dumps(json_post_data)
|
|
39
|
+
|
|
40
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
41
|
+
|
|
42
|
+
except Exception as ex:
|
|
43
|
+
|
|
44
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
45
|
+
|
|
46
|
+
if filename is not None and line_number is not None:
|
|
47
|
+
print(f"Exception occurred at line {line_number} in {filename}")
|
|
48
|
+
print(ex)
|
|
49
|
+
|
|
50
|
+
response_code = -1
|
|
51
|
+
response_string = "Exception in get_tags_for_uploaded_temp_image"
|
|
52
|
+
|
|
53
|
+
return response_code, response_string
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def create_tags_for_video_clip(ws_config: actionstreamer.Config.WebServiceConfig, video_clip_id: str) -> tuple[int, str]:
|
|
57
|
+
|
|
58
|
+
"""
|
|
59
|
+
Inserts tags into the database for a video clip using AWS Recognition.
|
|
60
|
+
The file must have already been uploaded to ActionStreamer's cloud storage.
|
|
61
|
+
|
|
62
|
+
Parameters:
|
|
63
|
+
ws_config (Config.WebServiceConfig): The web service configuration.
|
|
64
|
+
video_clip_id: The video clip ID.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
response_code: The API HTTP response code.
|
|
68
|
+
response_string: The API HTTP response body
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
try:
|
|
72
|
+
# Call the web service to get the tags for this image.
|
|
73
|
+
json_post_data = {"videoClipID": video_clip_id}
|
|
74
|
+
|
|
75
|
+
method = "POST"
|
|
76
|
+
path = 'v1/tag/videoclip'
|
|
77
|
+
url = ws_config.base_url + path
|
|
78
|
+
headers = {"Content-Type": "application/json"}
|
|
79
|
+
parameters = ''
|
|
80
|
+
body = json.dumps(json_post_data)
|
|
81
|
+
|
|
82
|
+
response_code, response_string = CommonFunctions.send_signed_request(ws_config, method, url, path, headers, parameters, body)
|
|
83
|
+
|
|
84
|
+
except Exception as ex:
|
|
85
|
+
|
|
86
|
+
filename, line_number = CommonFunctions.get_exception_info()
|
|
87
|
+
|
|
88
|
+
if filename is not None and line_number is not None:
|
|
89
|
+
print(f"Exception occurred at line {line_number} in {filename}")
|
|
90
|
+
print(ex)
|
|
91
|
+
|
|
92
|
+
response_code = -1
|
|
93
|
+
response_string = "Exception in get_tags_for_uploaded_temp_image"
|
|
94
|
+
|
|
95
|
+
return response_code, response_string
|
|
@@ -5,6 +5,6 @@ from .Health import *
|
|
|
5
5
|
from .LogMessage import *
|
|
6
6
|
from .Patch import *
|
|
7
7
|
from .VideoClip import *
|
|
8
|
+
from .Tag import *
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
__all__ = API.__all__ + Event.__all__ + File.__all__ + Health.__all__ + LogMessage.__all__ + Patch.__all__ + VideoClip.__all__
|
|
10
|
+
__all__ = API.__all__ + Event.__all__ + File.__all__ + Health.__all__ + LogMessage.__all__ + Patch.__all__ + VideoClip.__all__ + Tag.__all__
|
|
File without changes
|
{actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/CommonFunctions/CommonFunctions.py
RENAMED
|
File without changes
|
|
File without changes
|
{actionstreamer-1.1.44 → actionstreamer-1.2.2}/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.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/EventPreset/EventPreset.py
RENAMED
|
File without changes
|
{actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/EventPreset/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/LogMessage/LogMessage.py
RENAMED
|
File without changes
|
{actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/LogMessage/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/VideoClip/VideoClip.py
RENAMED
|
File without changes
|
{actionstreamer-1.1.44 → actionstreamer-1.2.2}/actionstreamer/WebService/VideoClip/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|