0

Passing custom parameters

Hi,

I open movies in RV from another application on OSX. I need to pass extra parameters while opening a movie in RV for using by scripts. It's not a problem in case of cold start, I can add command line flags easily. But if RV is running, I send it "Open Document" Apple Event, in this case I can't set any flags.

One potential solution would be - to create a temporary RV session file and put some extra parameters there. But it looks like RV ignores any non-standard fields while parsing session files. 

Something like this would help me a lot:

sourceGroup000000_source : RVFileSource (1)
{
media
{
string movie = "some path"
string customParam = "some string"
}

}

Does it looks feasible? Or is it any better way to pass custom parameters?

Thanks

 

Anton

7 comments

  • 0
    Avatar
    Jon Morley

    Hi Anton,

    Are you familiar with RVPUSH? It is included with every download of RV. Here is the relevant documentation:

     17: RVPUSH

    It was designed with the kind of workflow I think you are describing in mind. With RVPUSH you can talk to already running RV instances in a similar way as when you first start them. If no RV process is running RVPUSH will start one. You can also name the instances with tags and control multiple different instances with targeted tagged commands.

    Please take a look and let me know if this will work for you.

    Thanks,
    Jon

  • 0
    Avatar
    Anton Dukhovnikov

    That's what I need!

    Thank you very much Jon!

  • 0
    Avatar
    Jon Morley

    Terrific!

  • 0
    Avatar
    Anton Dukhovnikov

    Hey Jon,

    One more question. When I call rvpush this way:

    rvpush set somefile.mov -flags 'someflag=value'

    it works well if RV is not running. But if there is RV running, the same command returns this:

    INFO: trying brute force to find an image reader for -flags
    INFO: trying brute force to find an image reader for -flags
    INFO: trying brute force to find an image reader for -flags
    INFO: trying brute force to find an image reader for -flags
    INFO: trying brute force to find an image reader for -flags
    INFO: trying brute force to find an image reader for someflag=value
    INFO: trying brute force to find an image reader for someflag=value
    INFO: trying brute force to find an image reader for someflag=value
    INFO: trying brute force to find an image reader for someflag=value
    INFO: trying brute force to find an image reader for someflag=value
    INFO: trying brute force to find an image reader for someflag=value
    ERROR: Cannot access file -flags (1)
    Cannot access file someflag=value (2)

    If I try to put the flag into source group like this:

    rvpush set [ somefile.mov -flags 'someflag=value ]

    RV opens the file without any errors, but the flag is not accessible in my scripts.

    Is there any way to fix it?

     

    Thanks,

    Anton

  • 0
    Avatar
    Jon Morley

    Hi Anton,

    That is kind of funny that you can pass the flags that way at all. The set command isn't really equivalent to the command line. If you want to pass more information then you can use mu-eval, py-eval, and py-exec to send code to directly modify RV's state, or you can embed the flags in a URL and use the url option. Here is an example of the later:

    rvpush url "rvlink://smptebars,start=1,end=10.movieproc%20-play%20-flags%20'someflag=value'"

    Thanks,
    Jon

  • 0
    Avatar
    Benoit Leveau

    Hi Jon,

    I got the same problem and figured out I had to use py-exec which works great, but I have one question.

    How can I make sure the session I want to send the command to had the time to initialize? I want to load a sequence (possibly stereo), then later on I want to load more sequences.

    So, to send a mono image sequences I do:

    rvpush  -tag mytag merge [ sequence ]

    or for stereo:

    rvpush  -tag mytag merge [ left_seq right_seq ]

    Additionnaly when I send a stereo sequence, I want to ensure the stereo mode is ON so I do:

    rvpush  -tag mytag py_exec 'for node in rv.commands.nodesOfType("RVDisplayStereo"): rv.commands.setStringProperty(node+".stereo.type", ["pair"])'

    which forces the stereo to side by side.

    Problem is that it can launch 2 RVs if the first one (merge) didn't have the time to initialize when I send the second one (py_exec). It only takes 1-2 seconds, so I could add a "sleep 2" as a dirty hack for the moment. Any idea how I could achieve this?

    Thanks.

    Benoit

     

    PS. And I agree it's misleading that you can pass flags to the first instance but not the others. I was trying to do

    "rvpush merge -stereo pair [ left right ]"

    which works great the first time but not if rv is already running.

  • 0
    Avatar
    Jon Morley

    Hi Benoit,

    First of all sorry for the delayed reply.

    The real solution here is to use packages and commands.commandLineFlags() for your package. In this way you can leverage the "feature" that the first rvpush will pass its arguments to any listeners like your package. Here are the docs regarding commands.commandLineFilags:

    Path: commands.commandLineFlag

    commandLineFlag (string; 
                     string flagName,
                     string defaultValue = nil)
    

    Description

    The RV command line has an option -flags . Arguments after -flags can have the form foo or foo=bar .commandLineFlag() will find the value of one of these name value pairs. If the argument does not have a value, then true will be returned.

    For example:

     shell> rv -flags A B=foo
    

    commandLineFlag("A") would return true

    commandLineFlag("B") would return foo

    With this technique you can put your heavy RV logic (like setting up the stereo type) in a package. Install that package wherever you need it. And then call RVPUSH with the "-flags" you need.

    Please let me know if there is anything we can explain further.

    Thanks,
    Jon

Please sign in to leave a comment.