ActionStreamer 0.2.1__tar.gz → 0.2.3__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.
Files changed (31) hide show
  1. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/CommonFunctions/CommonFunctions.py +19 -0
  2. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/CommonFunctions/__init__.py +2 -2
  3. actionstreamer-0.2.3/ActionStreamer/Model/Model.py +78 -0
  4. actionstreamer-0.2.3/ActionStreamer/Model/__init__.py +4 -0
  5. actionstreamer-0.2.3/ActionStreamer/WebService/Device/Device.py +125 -0
  6. actionstreamer-0.2.3/ActionStreamer/WebService/Device/__init__.py +4 -0
  7. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/Event/Event.py +2 -1
  8. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/Event/__init__.py +2 -2
  9. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/PKG-INFO +2 -1
  10. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/pyproject.toml +2 -1
  11. actionstreamer-0.2.1/ActionStreamer/WebService/Device/Device.py +0 -57
  12. actionstreamer-0.2.1/ActionStreamer/WebService/Device/__init__.py +0 -4
  13. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/CommonFunctions/Wifi/Wifi.py +0 -0
  14. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/CommonFunctions/Wifi/__init__.py +0 -0
  15. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/API/API.py +0 -0
  16. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/API/__init__.py +0 -0
  17. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/Config/Config.py +0 -0
  18. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/Config/__init__.py +0 -0
  19. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/File/File.py +0 -0
  20. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/File/__init__.py +0 -0
  21. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/Health/Health.py +0 -0
  22. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/Health/__init__.py +0 -0
  23. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/LogMessage/LogMessage.py +0 -0
  24. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/LogMessage/__init__.py +0 -0
  25. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/Patch/Patch.py +0 -0
  26. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/Patch/__init__.py +0 -0
  27. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/VideoClip/VideoClip.py +0 -0
  28. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/VideoClip/__init__.py +0 -0
  29. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/WebService/__init__.py +0 -0
  30. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/ActionStreamer/__init__.py +0 -0
  31. {actionstreamer-0.2.1 → actionstreamer-0.2.3}/README.md +0 -0
@@ -5,6 +5,7 @@ import uuid
5
5
  import time
6
6
  from datetime import datetime
7
7
  import requests
8
+ import os
8
9
 
9
10
  import pytz
10
11
  import requests
@@ -209,3 +210,21 @@ def get_sha256_hash_for_file(file_path):
209
210
  file_hash = hash_object.hexdigest()
210
211
 
211
212
  return file_hash
213
+
214
+
215
+ def create_folders(path):
216
+ # Split the path into individual folders
217
+ folders = path.split(os.sep)
218
+
219
+ # Initialize the base folder to the root of the file system
220
+ base_folder = ""
221
+
222
+ # Loop through each folder in the path
223
+ for folder in folders:
224
+ # Append the current folder to the base folder
225
+ base_folder = os.path.join(base_folder, folder)
226
+
227
+ # Check if the current folder exists
228
+ if not os.path.exists(base_folder):
229
+ # If not, create the folder
230
+ os.makedirs(base_folder)
@@ -1,4 +1,4 @@
1
- from .CommonFunctions import StandardResult, switch, get_exception_info, get_line_number, log_to_console, send_signed_request, get_hmac_signature, dictionary_to_string, upload_file_to_s3, get_sha256_hash_for_file
1
+ from .CommonFunctions import StandardResult, switch, get_exception_info, get_line_number, log_to_console, send_signed_request, get_hmac_signature, dictionary_to_string, upload_file_to_s3, get_sha256_hash_for_file, create_folders
2
2
  from . import Wifi
3
3
 
4
- __all__ = ['StandardResult', 'switch', 'get_exception_info', 'get_line_number', 'log_to_console', 'send_signed_request', 'get_hmac_signature', 'dictionary_to_string', 'upload_file_to_s3', 'get_sha256_hash_for_file', 'Wifi']
4
+ __all__ = ['StandardResult', 'switch', 'get_exception_info', 'get_line_number', 'log_to_console', 'send_signed_request', 'get_hmac_signature', 'dictionary_to_string', 'upload_file_to_s3', 'get_sha256_hash_for_file', 'Wifi', 'create_folders']
@@ -0,0 +1,78 @@
1
+ from enum import Enum
2
+
3
+ class EventStatus(Enum):
4
+
5
+ Checked_out = 2,
6
+ Complete = 4,
7
+ Error = 5,
8
+ Pending = 1,
9
+ Processing = 3,
10
+ Timed_out = 6
11
+
12
+
13
+ class EventType:
14
+
15
+ class Video(Enum):
16
+ Start_bars = 9,
17
+ Follow = 8,
18
+ Receive_stream = 5,
19
+ Start_recording = 1,
20
+ Start_streaming = 3,
21
+ Stop_bars = 10,
22
+ Stop_receive_stream = 6,
23
+ Stop_recording = 2,
24
+ Stop_streaming = 4,
25
+ Test_event = 7,
26
+ Test_stop = 11
27
+
28
+
29
+ class Event:
30
+
31
+ def __init__(self, key, userID, deviceID, agentTypeID, agentID, eventTypeID, eventStatus, eventParameters, result, percentComplete, priority, expirationEpoch, attemptNumber, maxAttempts, checkoutToken, tagString, tagNumber, creationDate, createdBy, lastModifiedDate, lastModifiedBy):
32
+
33
+ self.eventID = key
34
+ self.userID = userID
35
+ self.deviceID = deviceID
36
+ self.agentTypeID = agentTypeID
37
+ self.agentID = agentID
38
+ self.eventTypeID = eventTypeID
39
+ self.eventStatus = eventStatus
40
+ self.eventParameters = eventParameters
41
+ self.result = result
42
+ self.percentComplete = percentComplete
43
+ self.priority = priority
44
+ self.expirationEpoch = expirationEpoch
45
+ self.attemptNumber = attemptNumber
46
+ self.maxAttempts = maxAttempts
47
+ self.checkoutToken = checkoutToken
48
+ self.tagString = tagString
49
+ self.tagNumber = tagNumber
50
+ self.creationDate = creationDate
51
+ self.createdBy = createdBy
52
+ self.lastModifiedDate = lastModifiedDate
53
+ self.lastModifiedBy = lastModifiedBy
54
+
55
+
56
+ class EventWithNames(Event):
57
+
58
+ def __init__(self, key, userID, deviceID, agentTypeID, agentID, eventTypeID, eventStatus, eventParameters, result, percentComplete, priority, expirationEpoch, attemptNumber, maxAttempts, checkoutToken, tagString, tagNumber, creationDate, createdBy, lastModifiedDate, lastModifiedBy, deviceName, eventType, agentType, version, eventStatusName, agentIndex):
59
+ super().__init__(key, userID, deviceID, agentTypeID, agentID, eventTypeID, eventStatus, eventParameters, result, percentComplete, priority, expirationEpoch, attemptNumber, maxAttempts, checkoutToken, tagString, tagNumber, creationDate, createdBy, lastModifiedDate, lastModifiedBy)
60
+ self.deviceName = deviceName
61
+ self.eventType = eventType
62
+ self.agentType = agentType
63
+ self.version = version
64
+ self.eventStatusName = eventStatusName
65
+ self.agentIndex = agentIndex
66
+
67
+
68
+ class VideoParameters:
69
+
70
+ def __init__(self, height, width, fps, bitrate, vflip, hflip, encoding, segment_length_seconds):
71
+ self.height = height
72
+ self.width = width
73
+ self.fps = fps
74
+ self.bitrate = bitrate
75
+ self.vflip = vflip
76
+ self.hflip = hflip
77
+ self.encoding = encoding
78
+ self.segment_length_seconds = segment_length_seconds
@@ -0,0 +1,4 @@
1
+ from .Model import Event, EventWithNames, EventType, EventStatus, VideoParameters
2
+
3
+
4
+ __all__ = ['Event', 'EventWithNames', 'EventType', 'EventStatus', 'VideoParameters']
@@ -0,0 +1,125 @@
1
+ import getopt
2
+ import socket
3
+ import sys
4
+ import platform
5
+ import subprocess
6
+
7
+ def process_cpuinfo():
8
+
9
+ device_name = "0000000000000000"
10
+
11
+ try:
12
+ optlist, args = getopt.getopt(sys.argv[1:], 'm:')
13
+
14
+ except getopt.GetoptError as err:
15
+ # Print help information and exit:
16
+ print(str(err)) # This will print something like "option -a not recognized"
17
+ return device_name
18
+
19
+ for option, argument in optlist:
20
+ if option == "-m":
21
+ device_name = argument
22
+
23
+ return device_name
24
+
25
+
26
+ def get_serial_number():
27
+
28
+ serial_number = ""
29
+ manufacturer = ""
30
+ manufacturer, return_code = get_manufacturer()
31
+
32
+ if platform.system() == "Windows":
33
+ serial_number = get_cpu_serial_number_windows()
34
+
35
+ elif platform.system() == "Linux":
36
+ serial_number = get_cpu_serial_number_linux()
37
+
38
+ else:
39
+ serial_number = ""
40
+
41
+ return manufacturer + "_" + serial_number
42
+
43
+
44
+ def get_ip_address():
45
+
46
+ try:
47
+ # Get the local hostname
48
+ hostname = socket.gethostname()
49
+ # Get the IP address associated with the hostname
50
+ ip_address = socket.gethostbyname(hostname)
51
+ except socket.error:
52
+ # If an error occurs, return a default IP address
53
+ ip_address = "0.0.0.0"
54
+
55
+ return ip_address
56
+
57
+
58
+ def get_cpu_serial_number_windows():
59
+
60
+ try:
61
+ import wmi
62
+ wmi_object = wmi.WMI()
63
+ for processor in wmi_object.Win32_Processor():
64
+ return processor.ProcessorId.strip()
65
+
66
+ except Exception as ex:
67
+ return str(ex)
68
+
69
+
70
+ def get_cpu_serial_number_linux():
71
+
72
+ try:
73
+ with open('/proc/cpuinfo', 'r') as f:
74
+ for line in f:
75
+ if line.strip().startswith("Serial"):
76
+ return line.strip().split(":")[1].strip()
77
+
78
+ except Exception as ex:
79
+ return str(ex)
80
+
81
+
82
+ def get_manufacturer():
83
+
84
+ if platform.system() == "Windows":
85
+ return get_manufacturer_windows()
86
+ elif platform.system() == "Linux":
87
+ return get_manufacturer_linux()
88
+ else:
89
+ return "", 1
90
+
91
+
92
+ def get_manufacturer_windows():
93
+
94
+ try:
95
+ import wmi
96
+ w = wmi.WMI()
97
+ for processor in w.Win32_Processor():
98
+ return parse_manufacturer(processor.Manufacturer.strip()), 0
99
+ except Exception:
100
+ return "", 1
101
+
102
+
103
+ def get_manufacturer_linux():
104
+
105
+ try:
106
+ result = subprocess.run(['dmidecode', '-t', 'processor'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
107
+ for line in result.stdout.splitlines():
108
+ if line.strip().startswith("Manufacturer"):
109
+ return parse_manufacturer(line.split(":")[1].strip()), 0
110
+ except Exception:
111
+ return "", 1
112
+
113
+
114
+ def parse_manufacturer(manufacturer):
115
+
116
+ if "Intel" in manufacturer:
117
+ return "Intel"
118
+ elif "AMD" in manufacturer:
119
+ return "AMD"
120
+ elif "Broadcom" in manufacturer:
121
+ return "Broadcom"
122
+ elif "ARM" in manufacturer:
123
+ return "ARM"
124
+ else:
125
+ return manufacturer
@@ -0,0 +1,4 @@
1
+ from .Device import get_serial_number, get_ip_address, get_manufacturer
2
+
3
+
4
+ __all__ = ['get_serial_number', 'get_ip_address', 'get_manufacturer']
@@ -138,7 +138,7 @@ def get_event_details(ws_config, event_id):
138
138
  return ws_result
139
139
 
140
140
 
141
- def update_event(ws_config, event_id, event_status, result, tag_string='', tag_number=0, attempt_number=1):
141
+ def update_event(ws_config, event_id, event_status, result, process_id, tag_string='', tag_number=0, attempt_number=1):
142
142
 
143
143
  ws_result = WebServiceResult(0, '', '', '', None)
144
144
 
@@ -153,6 +153,7 @@ def update_event(ws_config, event_id, event_status, result, tag_string='', tag_n
153
153
  "eventStatus": event_status,
154
154
  "attemptNumber": attempt_number,
155
155
  "result": result,
156
+ "processID": process_id,
156
157
  "tagString": tag_string,
157
158
  "tagNumber": tag_number
158
159
  }
@@ -1,4 +1,4 @@
1
- from .Event import create_event, dequeue_event, get_event_details, update_event
1
+ from .Event import create_event, dequeue_event, get_event_details, update_event, get_pending_event_list
2
2
 
3
3
 
4
- __all__ = ['create_event', 'dequeue_event', 'get_event_details', 'update_event']
4
+ __all__ = ['create_event', 'dequeue_event', 'get_event_details', 'update_event', 'get_pending_event_list']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ActionStreamer
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: A library for the ActionStreamer API.
5
5
  Author: ActionStreamer
6
6
  Author-email: joe@actionstreamer.com
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Requires-Dist: pytz (>=2024.1,<2025.0)
13
13
  Requires-Dist: requests (>=2.32.3,<3.0.0)
14
+ Requires-Dist: wmi (>=1.5.1,<2.0.0)
14
15
  Description-Content-Type: text/markdown
15
16
 
16
17
  # ActionStreamer
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ActionStreamer"
3
- version = "0.2.1"
3
+ version = "0.2.3"
4
4
  description = "A library for the ActionStreamer API."
5
5
  authors = ["ActionStreamer <joe@actionstreamer.com>"]
6
6
  readme = "README.md"
@@ -9,6 +9,7 @@ readme = "README.md"
9
9
  python = "^3.10"
10
10
  requests = "^2.32.3"
11
11
  pytz = "^2024.1"
12
+ wmi = "^1.5.1"
12
13
 
13
14
 
14
15
  [build-system]
@@ -1,57 +0,0 @@
1
- import getopt
2
- import socket
3
- import sys
4
-
5
-
6
- def process_cpuinfo():
7
-
8
- device_name = "0000000000000000"
9
-
10
- try:
11
- optlist, args = getopt.getopt(sys.argv[1:], 'm:')
12
-
13
- except getopt.GetoptError as err:
14
- # Print help information and exit:
15
- print(str(err)) # This will print something like "option -a not recognized"
16
- return device_name
17
-
18
- for option, argument in optlist:
19
- if option == "-m":
20
- device_name = argument
21
-
22
- return device_name
23
-
24
-
25
- def get_serial_number():
26
-
27
- # Extract serial from cpuinfo file
28
- cpu_serial = "0000000000000000"
29
- cpu_serial = process_cpuinfo()
30
-
31
- try:
32
- file = open('/proc/cpuinfo','r')
33
-
34
- for line in file:
35
- if line[0:6] == 'Serial':
36
- cpu_serial = line[10:26]
37
-
38
- file.close()
39
-
40
- except:
41
- cpu_serial = "ERROR000000000"
42
-
43
- return cpu_serial
44
-
45
-
46
- def get_ip_address():
47
-
48
- try:
49
- # Get the local hostname
50
- hostname = socket.gethostname()
51
- # Get the IP address associated with the hostname
52
- ip_address = socket.gethostbyname(hostname)
53
- except socket.error:
54
- # If an error occurs, return a default IP address
55
- ip_address = "0.0.0.0"
56
-
57
- return ip_address
@@ -1,4 +0,0 @@
1
- from .Device import process_cpuinfo, get_serial_number, get_ip_address
2
-
3
-
4
- __all__ = ['process_cpuinfo', 'get_serial_number', 'get_ip_address']
File without changes