Closed LikeThisReview closed 1 year ago
Please add function FIND(val, find). Find a substring within a string and returns index of last position of substring.
For example
Find($(tcp-hypd: tcp_response), "audio input")
will return an index pointing to the end of the substring "audio input" in variable$(tcp-hypd: tcp_response)
.
Any reason you wish to go to the end of the string rather than the beginning as per usual behaviour?: https://www.w3schools.com/jsref/jsref_search.asp
I mean I appreciate it will be more useful for your use case, but I'd imagine the non-standard behaviour will be more confusing overall.
Beginning or end position does not matter to me; I prefer standard behaviour
On Tue, 8 Aug 2023 at 17:24, Peter Newman @.***> wrote:
Please add function FIND(val, find). Find a substring within a string and returns index of last position of substring.
For example Find($(tcp-hypd: tcp_response), "audio input") will return an index pointing to the end of the substring "audio input" in variable $(tcp-hypd: tcp_response).
Any reason you wish to go to the end of the string rather than the beginning as per usual behaviour?: https://www.w3schools.com/jsref/jsref_search.asp
I mean I appreciate it will be more useful for your use case, but I'd imagine the non-standard behaviour will be more confusing overall.
— Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion/issues/2528#issuecomment-1669831204, or unsubscribe https://github.com/notifications/unsubscribe-auth/A25NECBRUKPT2CYW7WLUDULXUJKZDANCNFSM6AAAAAA2OLE56I . You are receiving this because you authored the thread.Message ID: @.***>
This is now in beta with both of the following
indexOf(val, find, offset)
Find the index of the first occurence of a value within the provided string.
Optionally provide an offset to start the search from.
lastIndexOf(val, find, offset)
Find the index of the last occurence of a value within the provided string.
Optionally provide an offset to start the search from.
Julian, A quick test in v3.1.0+6093 (6094) worked OK. Many Thanks!!
Text Box with substr($(tcp-hypd:tcp_response),indexOf($(tcp-hypd:tcp_response),
version
)+9,indexOf($(tcp-hypd:tcp_response), version
)+13)
returned 1.13 for $(tcp-hypd:tcp_response with value 500 connection
info: protocol version: 1.13 model: HyperDeck Studio HD Plus.
Regards, Nico
Op wo 9 aug 2023 om 01:20 schreef Julian Waller @.***>:
This is now in beta with both of the following
indexOf(val, find, offset)
Find the index of the first occurence of a value within the provided string.
Optionally provide an offset to start the search from.
lastIndexOf(val, find, offset)
Find the index of the last occurence of a value within the provided string.
Optionally provide an offset to start the search from.
— Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion/issues/2528#issuecomment-1670438203, or unsubscribe https://github.com/notifications/unsubscribe-auth/A25NECCC37OVHK76D7IBQITXULCUDANCNFSM6AAAAAA2OLE56I . You are receiving this because you authored the thread.Message ID: @.***>
Out of curiosity @LikeThisReview (and clearly a bit OT), you're clearly aware of the Hyperdeck module: https://github.com/bitfocus/companion-module-bmd-hyperdeck/issues/created_by/likethisreview
And actually it's already got feedbacks for audio input: https://github.com/bitfocus/companion-module-bmd-hyperdeck/blob/1d7b57423476c9f09f4c44e45fef25e2f8036b67/feedbacks.js#L210-L232
Are there not already feedbacks to do what you want/have you considered requesting new ones if not?
Peter, Yes, I'm aware of the hyperdeck module. In addition I'm using Generic tcp-udp for the actions which do not support variables (like goto timecode) and many more tcp commands for which there is no support in the hyperdeck module.
Audio codec and audio channels, including feedback, works just fine for me in the hyperdeck module. "Audio Mapping" is not supported but it is not really relevant for me so far. "Audio Input" is always "embedded" for my Hyperdeck Studio HD Plus, so no requirement here. The Hyperdeck Plus has headphone / speaker level, but that's not even supported in the hyperdeck ethernet protocol.
On a side note. The atem module provides $(atem:audio_input_1_gain) and $(atem:audio_input_1_faderGain) but faderGain for Master output is missing.
Regards, Nico Wasmus
Op zo 13 aug 2023 om 16:38 schreef Peter Newman @.***>:
Out of curiosity @LikeThisReview https://github.com/LikeThisReview (and clearly a bit OT), you're clearly aware of the Hyperdeck module:
https://github.com/bitfocus/companion-module-bmd-hyperdeck/issues/created_by/likethisreview
And actually it's already got feedbacks for audio input:
Are there not already feedbacks to do what you want/have you considered requesting new ones if not?
— Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion/issues/2528#issuecomment-1676379165, or unsubscribe https://github.com/notifications/unsubscribe-auth/A25NECCCWRHL5MUFARWGZ4DXVDREJANCNFSM6AAAAAA2OLE56I . You are receiving this because you were mentioned.Message ID: @.***>
Is this a feature relevant to companion itself, and not a module?
Is there an existing issue for this?
Describe the feature
Please add function FIND(val, find). Find a substring within a string and returns index of last position of substring.
For example
Find($(tcp-hypd: tcp_response), "audio input")
will return an index pointing to the end of the substring "audio input" in variable$(tcp-hypd: tcp_response)
.Thanks, Nico Wasmus
Usecases
For example
Find($(tcp-hypd: tcp_response), "audio input")
will return an index pointing to the end of the substring "audio input" in variable$(tcp-hypd: tcp_response)
. This variable$(tcp-hypd: tcp_response)
is my response field from the generic tcp-ups module (Send to the hyperdeck), It contains for example:211 configuration: audio input: embedded audio mapping: 2 video input: HDMI file format: H.264Medium audio codec: AAC timecode input: preset timecode output: timeline timecode preference: default timecode preset: 00:00:00:00 audio input channels: 2 record trigger: none record prefix: LTR_HD1 append timestamp: false genlock input resync: false
The function will be used to parse all the values of all the labels into custom variables. So after Find "audio input", find "audio mapping" will be next, and so on. An additional parameter "continue Find from current position / index" to the function will avoid rescanning the entire text over and over. Currently I use three steps to loop through the text and then have additional steps to parse each parameter. That's significant overload and if I do not enter significant delays, Companion kills the process.