No need to apologize! The script has been really useful. :-) There’s a tiny issue, and a more challenging problem, feel free to ignore either one :-D
The tiny issue is that, as I guess the script uses the xml’s lane ordering, it presents the dialogs for for the user to enter role assignments in descending order, (if there are 4 lanes, it prompts for lane 4 first, then 3,2,1). Not a huge problem, and maybe not too difficult to sort out.
The larger issue arises when working with xml made from clips with no Video component. I’m hesitant to even ask, as I have figured out a workaround, but if you like a challenge, here is a summary. This is really long, and I apologize in advance, I just figured I'd put it all in on giant post and be done. :-)
Some background… I’m using the script with fcpxml files and thanks to your help, it works great! My intent was to use this script with fcpxml which defines A/V clips comprised of one Video component and multiple Audio components(channels) as shown below.
(this A/V clip contains 1 Video component and 4 interleaved stereo Audio components(channels) )
<clip name="TR_R1_V10_SPLIT" duration="2862400/2400s" start="3590s" format="r1" tcFormat="NDF">
<video offset="3590s" ref="r2" duration="2862400/2400s" start="3590s">
<audio lane=“-4” offset="3590s" ref="r2" srcID=“4” duration="858720000/720000s" start="3590s" role=“ROLE_D“ srcCh="1, 2"/>
<audio lane="-3" offset="3590s" ref="r2" srcID="3" duration="858720000/720000s" start="3590s" role=“ROLE_C“ srcCh="1, 2"/>
<audio lane="-2" offset="3590s" ref="r2" srcID="2" duration="858720000/720000s" start="3590s" role=“ROLE-B” srcCh="1, 2"/>
<audio lane="-1" offset="3590s" ref="r2" duration="858720000/720000s" start="3590s" role=“ROLE_A” srcCh="1, 2"/>
</video>
</clip>
So as all the <audio> elements have lane=“-X” parameters, the script finds and modifies the role parameter in each audio element perfectly.
But, for clips that are audio-only, the fcpxml is constructed slightly differently. For example:
(this audio clip contains 4 mono audio components(channels) )
<clip name="COACHVPRET01" duration="169369185/720000s" start="2515120609/48000s" format="r1" tcFormat="NDF">
<audio offset="37726809135/720000s" ref="r2" duration="169369185/720000s" start="37726809135/720000s" role="Role_A” srcCh="1">
<audio lane="-3" offset="37726809135/720000s" ref="r2" duration="169369185/720000s" start="37726809135/720000s" role="Role_D” srcCh="4"/>
<audio lane="-2" offset="37726809135/720000s" ref="r2" duration="169369185/720000s" start="37726809135/720000s" role="Role_C” srcCh="3"/>
<audio lane="-1" offset="37726809135/720000s" ref="r2" duration="169369185/720000s" start="37726809135/720000s" role=“Role_B” srcCh="2"/>
</audio>
</clip>
As there is no <video> element, the first audio component(channel) is defined in the parent <audio> element and has no “lane” parameter. (it is effectively lane=“0” , but the lane parameter is not required for the parent component in fcpxml).
So, as the script is looking for <audio> elements containing lane parameters to build the role mappings, it misses the first (parent) component(channel). Subsequent components are then mis-identified in the Role setting dialogs. Since the <audio lane> parameters start at “-1” for the second component, the prompt for lane -1 sets the role for the second component, lane -2 prompt sets the role for the third component, etc.
The challenge is that I can’t figure out how to get the script to see the role parameter in the parent element. It was suggested to me that I could have the script first replace all occurrences of <audio offset with <audio lane=“0” offset and then run the mapping bit. Other than manually in BBedit or something, I have no clue how to do that, so here I am…
The only unique search term for component(channel) 1 will be the <audio offset> text string as it will only occur, and always be first, in the parent element. Additional channels will always be in child audio elements with lane parameters as before. Would I need a separate Audio Only script? could there be an if/then routine triggered by user input, check box, radio button or something? I have no clue. :-(
As I said above, I have a workaround. The user can set the Role they want on component(channel) to all channels easily before creating the original fcpxml., then just use the script to batch change the individual child elements. as long as they also know that the role prompt for lane -1 sets component 2, -2 sets 3 etc., it works fine.
If this is too much, just say so. I only ask because, though I have no problem at all with the workaround, I’ve made the script available to others for free here, and I’d like to make it less confusing when used with Audio Only clips. I really would like to do it myself, but based on what I’ve learned from the material you posted above, I think it will be quite some time before I can do that.
In any case, Thanks very much for your time. This script was something that a lot of people, including myself, have been clamoring for. :-)