Skip to content

Copy to

Copies paths stored in Shotgrid fields to destination folders.

API Url:

https://app.slingshotvfx.com/ami/<show id>/copy_files/<option>

Configuration

sg_ami:
  copy_files:
    EXRs_to_CO3:
      description: copy EXRs to staging
      trigger_entity: Playlist
      copy_versions_where: 
        - - playlists
          - is
          - ${trigger_entity}
      paths:
        - from: $sg_path_to_frames
          to: /Volumes/PDVFX/VFX/_postoffice/c03/from_vfx/_stage/${trigger_entity_name}
          is_from_path_frames: true
          rename: null
          method: hardlink
          service: local
          create_shared_link: false
          path_substitutions: {}
      sg_extra_version_fields: []
      sg_extra_entity_fields: []
      sg_field_value_map: {}
    Movies_to_CO3:
      description: copy movs to staging
      trigger_entity: Playlist
      copy_versions_where:
        - - playlists
          - is
          - ${trigger_entity}
      paths:
        - from: $sg_path_to_movie
          to: /Volumes/PDVFX/VFX/_postoffice/c03/from_vfx/_stage/${trigger_entity_name}
          is_from_path_frames: false
          rename: null
          method: hardlink
          service: local
          create_shared_link: false
          path_substitutions: {}
      sg_extra_version_fields: []
      sg_extra_entity_fields: []
      sg_field_value_map: {}
    Movies_and_EXRs_to_CO3:
      description: Copy MOVs and EXRs to CO3
      trigger_entity: Playlist
      copy_versions_where:
        - - playlists
          - is
          - ${trigger_entity}
      paths:
        - from: $sg_path_to_movie
          to: /Volumes/PDVFX/VFX/_postoffice/c03/from_vfx/_stage/${trigger_entity_name}
          is_from_path_frames: false
          rename: null
          method: hardlink
          service: local
          create_shared_link: false
          path_substitutions: {}
        - from: $sg_path_to_frames
          to: /Volumes/PDVFX/VFX/_postoffice/c03/from_vfx/_stage/${trigger_entity_name}
          is_from_path_frames: true
          rename: null
          method: hardlink
          service: local
          create_shared_link: false
          path_substitutions: {}
      sg_extra_version_fields: []
      sg_extra_entity_fields: []
      sg_field_value_map: {}

Config Options

  • trigger_entity: default: "Version" | Which Shotgrid entity to install this Action Menu Item on.
  • copy_versions_where: default: None | If the triggering entity is not a Version, then these Shotgrid filters1 are used to select which Versions to copy.$trigger_entity is the entity that triggered the Action Menu Item.
  • all Version fields are available as template keys (e.g. ${code} for Version name)
  • all triggering entity (Playlist, Delivery, etc) fields are available as dotted keys (e.g. ${trigger_entity.sg_type} for Playlist field sg_type)
  • Two special extra templates are provided, trigger_entity_name and trigger_entity_to
class CopyFilesConfigOption(ModuleConfigBase):
    : str = Field(
        default="Version", description="Which Shotgrid entity to install this Action Menu Item on."
    )
    copy_versions_where: ShotgridComplexFilter | list[ShotgridFilter] | None = Field(
        default=None,
        description="If the triggering entity is not a Version,"
        " then these Shotgrid filters are used to select which Versions to copy."
        " '$trigger_entity' is the entity that triggered the Action Menu Item.",
    )
    paths: list[CopyFilesPathModel] = Field(description="A list of paths to copy/move.")
    sg_extra_version_fields: list[str] = Field(
        default=[], description="A list of additional fields to pull from Shotgrid, e.g. for deep linked results."
    )
    sg_extra_entity_fields: list[str] = Field(
        default=[],
        validation_alias=AliasChoices(
            "sg_extra_entity_fields",
            "sg_extra_playlist_fields",  # deprecated
        ),
        description="A list of additional fields to pull from the the triggering entity (for deep linking/dot notation).",
    )
    sg_field_value_map: dict[DotSafeStr, dict[str, str]] = Field(
        default={}, description="A hard-coded map of field value substitutions."
    )

class CopyFilesPathModel(ModuleConfigBase):
    from_: Path = Field(alias="from", description="The source path. Accepts variables and * wildcards.")
    to: Path = Field(
        description="The destination directory."
        "\nCan use variables $trigger_entity_to (e.g. ${trigger_entity_to.Group.code}) and $trigger_entity_name"
    )
    is_from_path_frames: bool = Field(
        default=False,
        description="If true, the from path is a path of multiple frames and the entire folder will be copied",
    )
    rename: str | None = Field(default=None, description="Also rename the file to this new name.")
    method: Literal["copy", "hardlink", "move"] = Field(default="copy", description="Copy or Move the file.")
    service: Literal["s3", "local", "box"] = Field(default="local", description="The file storage service to use.")
    create_shared_link: bool = Field(
        default=False, description="If true, will create a shared link and print it in the results."
    )
    path_substitutions: dict[PurePath, PurePath] = Field(
        default={},
        description="A mapping of substitutions to apply, usually for cross platform drive-mapping e.g. {'z:\\', '/Volumes/z_drive'}",
    )

  1. For information on the filter syntax, see: Shotgrid REST API - Searching