# Tk-multi-publish2 - hooks - upload\_version.py

**URL:** <https://community.shotgridsoftware.com/t/tk-multi-publish2-hooks-upload-version-py/8591>\
**Category:** Pipeline Integrations\
**Tags:** hooks, fptr-tk, customization, publish\
**Created:** [May 8, 2020, 2:36pm UTC](https://community.shotgridsoftware.com/t/tk-multi-publish2-hooks-upload-version-py/8591 "2020-05-08T14:36:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbasu](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@sbasu](https://community.shotgridsoftware.com/u/sbasu)\
**Post date:** [May 8, 2020, 2:36pm UTC](https://community.shotgridsoftware.com/t/tk-multi-publish2-hooks-upload-version-py/8591/1 "2020-05-08T14:36:19Z")

</div>

Hi All,

I’m currently working on customizing publish workflows for review media.  
Using these guides for the same:  
[https://community.shotgridsoftware.com/t/publish2-custom-plugin-ui-example/2981](https://community.shotgridsoftware.com/t/publish2-custom-plugin-ui-example/2981)

[https://www.youtube.com/watch?v=pH4mylrnktY](https://www.youtube.com/watch?v=pH4mylrnktY)

Was hoping for a bit a guidance for making the following modifications:

1. Modifying path\_to\_movie to copy media to production file system  
e.g. Default config2 creates a folder structure like so: /storage/projects/my\_proj/assets/{asset\_type}/{asset\_name}/{step}/publish, reference, review, work  
Is the above path (assets/{asset\_type}/{asset\_name}/{step}/review) meant for storing review media? If so, will try to make path\_to\_movie to point to read like so: assets/{asset\_type}/{asset\_name}/{step}/review/media.mov or any other specified directory.
2. Forcing the filename and version name template to mimic the file naming from templates. e.g. AssetName\_{step}\_{version}.extension
3. Disabling sg\_uploaded\_movie and using sg\_local\_file\_path to point to the above path instead.

Summary: enforcing Version naming templates, save location templates, updating field data on Version entity during publish execution of plugins. Guidance or doc links for customizing with hooks in general.

Request some guidance for the above.

Thank you

---

<div class="post-metadata">

**Author:** ![tannaz](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/tannaz/32/32_2.png) [@tannaz](https://community.shotgridsoftware.com/u/tannaz)\
**Post date:** [May 19, 2020, 1:01am UTC](https://community.shotgridsoftware.com/t/tk-multi-publish2-hooks-upload-version-py/8591/3 "2020-05-19T01:01:35Z")

</div>

Hi @sbasu!

Can you clarify your questions a bit? First off, what software are we talking about here – Nuke? or something else?

It sounds like, in general, you’re interested in using templates in your custom code. This is totally doable. You can [see an example of using a template to build a path in this developer guide](https://developer.shotgunsoftware.com/836446f3/?title=Generating+a+path+and+publishing+it#part-5-using-a-template-to-build-a-path). You could use similar logic in your custom code. And [here is reference documentation for working with templates with the Toolkit API](https://developer.shotgunsoftware.com/tk-core/core.html#templates).

> [@sbasu](#):
>
> Is the above path (assets/{asset\_type}/{asset\_name}/{step}/review) meant for storing review media?

It can be. We don’t really prescribe what different paths should be used for – there are no dependencies that _expect_ reviewable media to be stored here, but it makes sense to use it as such.

> [@sbasu](#):
>
> 1. Forcing the filename and version name template to mimic the file naming from templates. e.g. AssetName\_{step}\_{version}.extension

Can you clarify this question, please? I’m not sure I understand.

> [@sbasu](#):
>
> 1. Disabling sg\_uploaded\_movie and using sg\_local\_file\_path to point to the above path instead.

Can you clarify this as well? Where do you want to disable these things? Are you interested in disabling the fields on the Version entity? If so, why?

Thanks!

---

<div class="post-metadata">

**Author:** ![sbasu](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@sbasu](https://community.shotgridsoftware.com/u/sbasu)\
**Post date:** [May 21, 2020, 9:12am UTC](https://community.shotgridsoftware.com/t/tk-multi-publish2-hooks-upload-version-py/8591/4 "2020-05-21T09:12:09Z")

</div>

Hi Tannaz!

Thank you for the doc links.

To follow up,

> [@tannaz](#):
>
> what software are we talking about here – Nuke? or something else?

The tk-multi-publish2 app in any engine [Maya, Nuke, Houdini, etc] as well as standalone.

> [@sbasu](#):
>
> > [@sbasu](#):
> >
> > 1. Forcing the filename and version name template to mimic the file naming from templates. e.g. AssetName\_{step}\_{version}.extension
> 
> Can you clarify this question, please? I’m not sure I understand.

When artists save the workfile (tk-multi-workfiles2?) or publish files and review media (tk-multi-publish2), we were hoping to enforce naming conventions on those file names. (e.g. for a Character Bob, a Maya file in the Model context, when artists save the file through the Shotgun menu, file gets saved to assets/character/Bob/Model/work/Bob\_Mo\_v01.ma. Similar nomenclature template for publish and review media as well.) I will refer to the doc links you have sent for this.

> [@sbasu](#):
>
> > [@sbasu](#):
> >
> > 1. Disabling sg\_uploaded\_movie and using sg\_local\_file\_path to point to the above path instead.
> 
> Can you clarify this as well? Where do you want to disable these things? Are you interested in disabling the fields on the Version entity? If so, why?

I have figured this out. Modified the `upload_version.py` hook from here: [https://github.com/shotgunsoftware/tk-multi-publish2/blob/master/hooks/upload\_version.py#L96](https://github.com/shotgunsoftware/tk-multi-publish2/blob/master/hooks/upload_version.py#L96)

Modified the the value for the ‘default’ key to ‘False’.

Thank you.

---

<div class="post-metadata">

**Author:** ![tannaz](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/tannaz/32/32_2.png) [@tannaz](https://community.shotgridsoftware.com/u/tannaz)\
**Post date:** [May 22, 2020, 12:59am UTC](https://community.shotgridsoftware.com/t/tk-multi-publish2-hooks-upload-version-py/8591/5 "2020-05-22T00:59:47Z")

</div>

Thanks for clarifying! That’s very helpful.

I understand now what you’re going for and I think you’re on the right track. In broad strokes, you’ll want to add your desired templates for review media to your `core/templates.yml` file, then modify the `upload_version` hook to include logic to rename things based on those templates.

Good luck - let us know if you hit any snags!

---

<div class="post-metadata">

**Author:** ![sbasu](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@sbasu](https://community.shotgridsoftware.com/u/sbasu)\
**Post date:** [May 22, 2020, 7:37am UTC](https://community.shotgridsoftware.com/t/tk-multi-publish2-hooks-upload-version-py/8591/6 "2020-05-22T07:37:32Z")

</div>

Sure. I’ll test the same and revert back.

Thank you!
