Best event for auto stacking new sources

I have a requirement to turn new version or versions added to RV from a source into a stack (with the vzero plate for wiping).

The version(s) can come from drag and drop, from opened with shotgun (single version or playlist) or screening room.

The newly generated stack should be played instead of the original source media.

My question is

  • what’s the best event or events to listen to to get these sources reliably (after the tracking.info metadata from Flow has been added to the source)
  • how to ensure that the new stack is played back instead of the original source (especially important if multiple versions are added)

Thank you for your help!

Hi,

I would try to use the source-group-complete event. This is triggered no matter where the source gets added from.
This is the first event where it is safe to intercept after adding a source and it should work for your use case.

in the event.contents() you can then find the added node and add it to your stack.

Then set the stack as the view node
→ should be commands.setViewNode(your_stack) or something similar

Cheers

1 Like

Thank you @mircotornow.

Let’s say I have 3 new sources and for each create a stack with the corresponding plate.
Would one of you know if there is sample code/docs that outlines how to?

  • create the stacks
  • add them to a sequence
  • make that sequence the next view to be played

hey had some time and threw together a mode that should do it.
Just quick and dirty so don’t expect it to be robust but the basic functionality should be there

from rv import rvtypes, commands


class LoadPlates(rvtypes.MinorMode):

    def __init__(self):
        rvtypes.MinorMode.__init__(self)
        self.init(
            "load_plates",
            [("source-group-complete", self.load_plate, "")],
            None
        )

    def load_plate(self, event):
        event.reject()

        contents = event.contents()
        added_node = contents.split(";;")[0]

        src_path = commands.getStringProperty(f"{added_node}_source.media.movie")[0]
        plate_path_to_add = self.find_plate_path(src_path)
        added_plate_node = commands.addSourceVerbose([plate_path_to_add])

        stack_node = commands.newNode("RVStackGroup", "PlateStack")
        commands.setNodeInputs(stack_node, [added_plate_node, added_node])

        self.add_to_custom_sequence(stack_node=stack_node)

    def add_to_custom_sequence(self, stack_node: str):
        sequence_node = "MySequenceNode"
        if not commands.nodeExists(sequence_node):
            commands.newNode("RVSequenceGroup", sequence_node)

        input_nodes, _ = commands.nodeConnections(sequence_node)
        input_nodes.append(stack_node)
        commands.setNodeInputs(sequence_node, input_nodes)

        commands.setViewNode(sequence_node)

    def find_plate_path(self, source_path: str) -> str:
        # TODO: implement
        pass



def createMode():
    "Required to initialize the module. RV will call this function to create your mode."
    return LoadPlates()

1 Like

thank you so much! I look forward to trying it out. RV dev documentation isn’t too available it seems so that looks helpul!

I just tried it out and unfortunately the tracking.info is set after the source-group-complete event when media is added from screening room

sourceComplete sourceGroup000001;;new
stateChange sourceGroup000001_source.media.movie
stateChange sourceGroup000001_source.tracking.info
stateChange sourceGroup000001_source.tracking.infoStatus
stateChange sourceGroup000001_source.tracking.mediaType
stateChange sourceGroup000001_switchGroup.ui.name
stateChange sourceGroup000001.ui.name

I wonder if there is another event when it’s all completed including loading sg data?

To see which event you can use;
You can try opening rv with

rv --debug events

to see which events get triggered at which point when adding sources

2 Likes

Thank you @mircotornow that helped.

Looks like for “source-group-complete” different mode’s compete for the order and that mine is called before the code that loads the sg data.

And that the order of the modes can be tweaked during the init process of the mode.

And alternatively the “after-progressive-loading” event is fired at the very end of the process

  1. before-progressive-loading
  2. source-group-complete media 1
  3. source-group-complete media 2
  4. after-progressive-loading

thank you again so much! i tried it out and it worked and also gave an error which i posted here. would you have an idea? thank you!