PP, you did not answer my last two questions which are crucial in getting the plugin to work the way you want.
However, assuming both answers were YES then I have a tentative proposal for just your BMD Sources.
Use
Tools > Plugins... and click the
More >> button to reveal the side panel of buttons.
Select the
Rename Selected Source Media plugin and click the
Edit... button to open the script editor.
Scroll down to line 42
local sTitle, n = cleanTitle(fhGetDisplayText(p)) and replace it with the following lines:
Code: Select all
local sSource = fhGetDisplayText(p)
local sSource, s = sSource:gsub( "^(.+) %(.+ (%d%d%d%d) (.+)$", "%1 %2 (%3)" )
sSource = sSource:gsub( " & ", " and " )
if s == 0 then
tTitleStatus[i] = 'unsuitable Source Title'
break
end
local sTitle, n = cleanTitle(sSource)
Use the
File > Save command in the script editor window to save the changes.
Click the
Go icon in the toolbar to run the plugin in debug mode, which allows you to click in the left margin to set red bullet break points to monitor progress.
However, it might be best to do all that on a temporary copy of your Project because any renaming of Media files cannot be reversed by FH. i.e. The Edit > Undo Plugin Updates command does NOT undo filename changes.
The main magic above is in the
sSource:gsub( "^(.+) %(.+ (%d%d%d%d) (.+)$", "%1 %2 (%3)" ) transformation.
"^(.+) %(.+ (%d%d%d%d) (.+)$" matches your style of Source Titles.
^(.+) %( captures the leading text up to the first space and (
.+ matches but disregards the subsequent text
(%d%d%d%d) captures the year digits
(.+)$ captures the trailing text
"%1 %2 (%3)" defines the format of the transformed Title.
%1 substitutes the 1st capture of leading text
%2 substitutes the 2nd capture of year digits
(%3) substitutes the 3rd capture of trailing text enclosed in ( )
If that transformation fails to recognise the crucial
( and year digits then it sets the status to 'unsuitable Source Title' and breaks out of the plugin.