Pira.cz Technical Forum
Magic RDS 4 => Configuration Options and Possibilities => Topic started by: South Coast FM Tech on April 24, 2022, 03:08:59 am
-
Hi Jan,
I'm already using %MATCHEDSTR% to truncate the radio text, as added in V4.0.34.
Change: %REGEXP%^.{0,64} To: %CLEAR%%MATCHEDSTR%
Sometimes the 'Artist - Title' text is too long & thus the Title gets truncated.
In such cases, I'd like to remove 'The ' from the beginning of the Artist name (if it exists), so that more of the Title is shown.
Example: "The Miami Sound Machine - Words Get In The Way This Is A Very Long Title"
Becomes: "Miami Sound Machine - Words Get In The Way This Is A Very Long Title"
Is it possible to use Text Replacing to do this?
thanks, Rod
-
The new implementation of External text sources will bring javascript engine, ideal for tasks like this.
-
"new implementation of External text sources will bring JavaScript engine"
Sounds great! When do you anticipate that will be implemented?
thanks, Rod
-
OK, we released the JS support in advance.
In version 4.0.38 you may use this JS:
var t = '%TEXT%';
var srcName = '%SRC_NAME%';
var remove = 'The ';
if ((srcName == 'Source 1') || (srcName == 'TEST')) {
if (t.length > 64) {
if (t.indexOf(remove) == 0) {
t = t.substring(remove.length);
}
}
}
return t;
Only edit the Source name from 'Source 1' to actual name, or entirely remove the srcName condition.
-
Nice one, Jan. Works like a charm.
Seems the Javascript processing before the 'Text Replacing' process.
This really adds a whole new world of flexibility in text processing.
Well done & thanks!