Retrieve string of "path to movie" from latest version

Hi,

I’m trying to get the string of the latest published version “path to movie” from a given shot.

How can I return this information? Is there a specific field I can use? I checked under configure fields and could not see any suitable values.

Thank you,

Craig

How are you trying to retrieve this?
Via the Python API?

Yes, I’m using the Python api. I have since found that I can simply use the ‘path_to_movie’ field with some sorting to get the latest version path as follows:

filters = [['entity', 'is', {'type': 'Shot', 'id': id}]]
fields = ['sg_path_to_movie']
sorting = [{'column':'created_at','direction':'desc'}]
latest_version = sg.find_one('Version', filters, fields, sorting)
path_to_movie = latest_version['sg_path_to_movie']
1 Like

Yeah you can sort by creation date :slight_smile:

Or use a preset. There are some presets from Shotgrid for Versions.

Something like this:

additional_filter_presets = [
    {
        "preset_name": "LATEST",
        "latest_by": "ENTITIES_CREATED_AT"
    }
]
versions = sg.find("Version", [['project', 'is', {'type': 'Project', 'id': 1}]], 
                    fields = ['code', 'id', 'sg_path_to_movie'], 
                    order = [{'field_name':'version_number', 'direction':'desc'}], 
                    additional_filter_presets = additional_filter_presets)```
1 Like