Python Resolve Create Subfolder

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

Benjamin Kratzin

  • Posts: 63
  • Joined: Mon Apr 24, 2017 8:44 pm

Python Resolve Create Subfolder

PostWed Oct 09, 2019 7:36 am

Hi everyone,

I'm currently trying to use Python in Resolve and got everything to work so far. Whats not working is creating subfolders in the Media Bin of folders created with python. I already know the function AddSubFolder()
but don't know how to use it, my current status is below. I don't know how to make a subfolder for example "00_Master") as I only get it to work when I call the mediapoolRoot.
But I'm sure there is someone knowing what I'm missing :)

project = projectManager.GetCurrentProject()
mediapool = project.GetMediaPool()
mediapoolRoot = mediapool.GetRootFolder()
resolve_media_storage = resolve.GetMediaStorage()
#parentFolder = mediapool.GotoParentFolder()
currentFolder = mediapool.GetCurrentFolder()

#Create Folders
mediapool.AddSubFolder(mediapoolRoot, "00_MASTER")
mediapool.AddSubFolder(OpenFolder("00_MASTER"), "Edits")


Thank you! Cheers
Director / DP / VFX Supervisor | www.benjaminkratzin.com | vimeo.com/benjaminkratzin
Offline
User avatar

iddos-l

  • Posts: 800
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Python Resolve Create Subfolder

PostWed Oct 09, 2019 9:47 am

Hi,
try this:

Code: Select all
rootFolder = mediapool.GetRootFolder()
currentFolder = mediapool.GetCurrentFolder()

#Create Folders
mediapool.AddSubFolder(rootFolder, "00_MASTER")
mediapool.AddSubFolder(currentFolder, "00_MASTER_2")

mediapool.SetCurrentFolder("00_MASTER")
master00 = mediapool.GetCurrentFolder()
mediapool.AddSubFolder(master00, "edit")

Offline

Benjamin Kratzin

  • Posts: 63
  • Joined: Mon Apr 24, 2017 8:44 pm

Re: Python Resolve Create Subfolder

PostThu Oct 17, 2019 8:07 am

You're amazing, thank you for the fast answer. Sorry for the late reply but it worked like charm!!!
Director / DP / VFX Supervisor | www.benjaminkratzin.com | vimeo.com/benjaminkratzin
Offline

Rick van den Berg

  • Posts: 1502
  • Joined: Tue Jun 02, 2015 7:47 am
  • Location: Netherlands

Re: Python Resolve Create Subfolder

PostThu Oct 17, 2019 9:40 am

Hey, i think this python thing is really interesting. I have almost zero knowledge about coding in general, but i'm about to dive into it (for other purposes then editing mainly). just a question out of curiousity. maybe i'm thinking this all wrong. But.. does the python environment in resolve allow one to theoretically build something like a hardware panel that controls various editing/audio-related operations like adjusting the audio gain, setting audio keyframes, on specific audio-tracks, with all kinds of buttons like knobs, faders, keys, etc? i can imagine something in theory that would fit my needs perfectly.
Offline
User avatar

iddos-l

  • Posts: 800
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Python Resolve Create Subfolder

PostThu Oct 17, 2019 12:02 pm

Rick van den Berg wrote:Hey, i think this python thing is really interesting. I have almost zero knowledge about coding in general, but i'm about to dive into it (for other purposes then editing mainly). just a question out of curiousity. maybe i'm thinking this all wrong. But.. does the python environment in resolve allow one to theoretically build something like a hardware panel that controls various editing/audio-related operations like adjusting the audio gain, setting audio keyframes, on specific audio-tracks, with all kinds of buttons like knobs, faders, keys, etc? i can imagine something in theory that would fit my needs perfectly.


Some of what your asking is still not supported in the API.
Check the documentation.
Here is an easy to read doc:

https://forum.blackmagicdesign.com/memb ... le&u=52950
Offline
User avatar

Isazaly Mohamed Isa

  • Posts: 16
  • Joined: Wed Apr 17, 2013 4:04 am
  • Location: Malaysia

Re: Python Resolve Create Subfolder

PostSat Jul 04, 2020 8:38 am

I am getting this error code :(

Traceback (most recent call last):
File "<nofile>", line 1, in <module>
NameError: name 'mediapool' is not defined
Isazaly Isa (aka Zalee)
Certified Master Trainer for Resolve
Kuala Lumpur, Malaysia
Offline
User avatar

iddos-l

  • Posts: 800
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Python Resolve Create Subfolder

PostSat Jul 04, 2020 8:41 am

Isazaly Mohamed Isa wrote:I am getting this error code :(

Traceback (most recent call last):
File "<nofile>", line 1, in <module>
NameError: name 'mediapool' is not defined

Were you able to get the resolve object?
Can you share your code?


Sent from my iPhone using Tapatalk
Offline

jensenni

  • Posts: 23
  • Joined: Wed Jan 27, 2021 12:26 am
  • Real Name: Jens Klein

Re: Python Resolve Create Subfolder

PostFri Feb 19, 2021 1:21 am

How do I check if a folder name 'foe' already exists?
Offline

jensenni

  • Posts: 23
  • Joined: Wed Jan 27, 2021 12:26 am
  • Real Name: Jens Klein

Re: Python Resolve Create Subfolder

PostSat Feb 20, 2021 8:28 pm

Hey there, I made it work meantime :)



In terms of code let me know what you need and how I can help :)

best

Jens

Return to DaVinci Resolve

Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 289 guests