Link a media in rv to its shotgun version

Hi Guys,

I have a local media open in rv and the same media is uploaded in shotgun and I would like get
the version info for the local media when its opened locally so I can access the shotgun menu >
Current Source Pref Options

I am using “shotgun_mode.theMode().sessionFromVersionIDs” in another case in that I am launching rv with that so its entirely a newer session , but here I don’t want to add a new source node to the existing session or clear it

I have the version id of the shotgun version and the source node name of the local media in rv, please let me know is there any way I can get the information linked ?



Hey @ajayakumarrp,

Thank you for waiting!

Sounds like you’re generally in the right area, you want to have the shotgun_mode.theMode() singleton to get to the, where the version metadata is stored.

Have you seen the answer from Kessler here?

I think it’s generally what you’re looking for, does that help?


1 Like

Hi Alexaz,

I have read the post earlier, That’s what we need to get the “” which exists in the source node which get created in the source when we open through screening room , my question is more on how to add the “” (metadata) to a local media source node through code without opening screening room so we can access the tools in shotgun menu


1 Like

Great, thank you for confirmng! Would you mind clarifying your workflow a bit further for me?

  • You have Screening Room package enabled in RV.
  • You open up a local media without Screening Room really knowing what it is, but you’d like to be able to set preferences without reloading the session.
  • You have path_to_frames and path_to_movie defined in the version fields in Shotgun.

Does that sound accurate?

Let me take a look. I’m not sure if you can change preferences without reloading the session, but I may be wrong.


1 Like

That sounds accurate Alexaz,

set preferences without reloading the session.,

But this reloading will discard or change media order of the media we already loaded right ? , if it will, that’s not what we want.


1 Like

Hi @ajayakumarrp,

I had to do something similar to this in the past. In my case I wanted the user to be able to open a file from the file system, add annotations, then upload the annotations/note to SG.

Here’s what I came up with:

shotgun_mode has a function called updateTrackingInfo that is responsible for, as the name suggests, updating the tracking info on a source node in RV. This function only updates existing values and will not work on a source node that was loaded outside of screening room. However, all the function actually requires is for the version ID to be set in the tracking info. So my hack was to insert the ID into the tracking info, then call updateTrackingInfo to fill in the rest of the values for me.

The other thing to keep in mind is that the updateTrackingInfo function either works on the currently rendered source, or all sources. You cannot specify a source for it to update. In my case this wasn’t a problem since I only wanted the currently visible source anyway. Here’s all that in code:

import rv
from rv import commands as rvc

version_id = 6073

# Get the source node currently being viewed
source_node = rvc.sourcesRendered()[0]["node"]

# Make sure the tracking info property exists. Create it if it doesn't exist
tracking_info_prop= "" % source_node
if not rvc.propertyExists(tracking_info_prop):
    rvc.newProperty(tracking_info_prop, rv.commands.StringType, 2)

# Set the version ID on the tracking info
rvc.setStringProperty(tracking_info_prop, ["id", str(version_id)], True)

# Ask the shotgun_mode to fill in the rest of the tracking info based on the version ID
    """shotgun_mode.theMode().updateTrackingInfo("one", nil);""", 

At this point, your source node should work exactly as if it had been loaded from screening room. Since we’re not dealing with API calls and hacking our way through this, you have to keep in mind that this method may not work this way (or even exist) in future releases. But for now this should get you what you need.

Hopefully this will work for your scenario as well.



Works like a charm , Thanks @Ehsan Exactly what I needed :smile:

1 Like

Given this is a bit of hack, can I ask that it be more formally supported? It would be great to be able to open sequences from any source and for it to find the SG version automatically.

Hey Patrick,

I’ve submitted your feedback to our PMs as a feature request.