Keyboard Shortcuts
Likes
Search
Extracting part of a return string
Hi,
state={'profile': 'signal-test', 'preview': {'state': 'running', 'status_message': 'Preview is running', 'hls_playlist': '/static/hls/7abb/adaptive.m3u8'}, 'recording': {'state': 'running', 'status_message': 'Recording in progress', 'folder': '/home/ubicast/mediacoder/media/20220208-181139-0d80', 'time_in_sec': 8, 'timecode': '0:00:08'}, 'live': {'available': True, 'linked_to_recording': False, 'state': 'idle', 'status_message': 'Ready to start'}, 'paused': False, 'video': [{'type': 'vtestsource', 'name': 'vsource-4c68', 'device': 'blue', 'capture': '1920x1080@25', 'signal': 'fake', 'state': 'running'}, {'type': 'vtestsource', 'name': 'vsource-af64', 'device': 'green', 'capture': '1280x720@25', 'signal': 'fake', 'state': 'running'}]}
state={'profile': 'signal-test', 'preview': {'state': 'running', 'status_message': 'Preview is running', 'hls_playlist': '/static/hls/7abb/adaptive.m3u8'}, 'recording': {'state': 'idle', 'status_message': 'Ready to record'}, 'live': {'available': True, 'linked_to_recording': False, 'state': 'running', 'status_message': 'On Air'}, 'paused': False, 'video': [{'type': 'vtestsource', 'name': 'vsource-4c68', 'device': 'blue', 'capture': '1920x1080@25', 'signal': 'fake', 'state': 'running'}, {'type': 'vtestsource', 'name': 'vsource-af64', 'device': 'green', 'capture': '1280x720@25', 'signal': 'fake', 'state': 'running'}]} |
There are ways to extract and match strings in SIMPL, especially if they are fixed length or if there is a fixed pattern, which your strings appear to have.
However, the string example you present appear to be too long to handle in SIMPL. Therefore, you will need to use S+, and doing so will make the job a lot easier. Lindsay |
¿ªÔÆÌåÓýIf the OP were trying to process the entire string or if there was more variability in the strings I would agree but it seems for what they want/need it could be done in an SIO, for example: ? Parameter 1 'recording': {'state': 'idle', ? Parameter 2 'recording': {'state': 'running', ? Then take those to a IL (or an INIT/EQU combo) to latch the recording status. ? Parameter 3 'live': {'available': True, 'linked_to_recording': False, 'state': 'idle', ? Parameter 4 'live': {'available': True, 'linked_to_recording': False, 'state': 'running', ? Then take those to an IL (or an INIT/EQU combo) to latch the live status ? If you need a ¡°recording and not live¡± ¡°live and not recoding¡± ¡°live and recording¡± FB you could either use a collection of gates or a TT to yield that result. ? Of course this would be real easy and the most robust/error resistant in S# where you can just deserialize the JSON into an object ? -- Lincoln King-Cliby, CTS, DMC-E-4K/T/D ? From: [email protected] [mailto:[email protected]]
On Behalf Of l_codd
Sent: Thursday, February 10, 2022 4:58 AM To: [email protected] Subject: Re: [crestron] Extracting part of a return string ? There are ways to extract and match strings in SIMPL, especially if they are fixed length or if there is a fixed pattern, which your strings appear to have. |