Page 1 of 1

Audio Item Breaks Recursive Media Pool Search

PostPosted: Wed Jul 14, 2021 11:35 pm
by claytonbeutler

I am attempting to search through all of the subfolders inside of my root folder for a clip named "" and append frames "244710" through "422920" to the timeline. However, my Lua script encounters an error whenever my media pool contains any audio items. This is the current Lua script that I'm trying:

Code: Select all
resolve = Resolve()
projectManager = resolve:GetProjectManager()
project = projectManager:GetCurrentProject()
mediaPool = project:GetMediaPool()
rootFolder = mediaPool:GetRootFolder()

folders = rootFolder:GetSubFolderList()

-- Go through all folders (in first sublevel)
for folderIndex in pairs(folders) do
   folder = folders[folderIndex]
   curFolder = folder:GetName()
   if curFolder ~= "" then

-- Go through all clips in folders
      clips = folder:GetClips()
      for clipIndex in pairs(clips) do
           clip = clips[clipIndex]
           videoFormat = clip:GetClipProperty()["Format"]
           videoName = clip:GetClipProperty()["Clip Name"]
           if videoFormat ~= "AIFF" then
              if videoName == "" then
                subClip = {}
                subClip["mediaPoolItem"] = clip
                subClip["startFrame"] = 422710
                subClip["endFrame"] = 422920

                if mediaPool:AppendToTimeline({ subClip }) then
                     print("Successfully found and added clip"" .. clip:GetName() .. "\" to current timeline.")

The script does what I want it to do until I add a ".aif" file into the media pool; then the script encounters an error before it can reach the folder that the "" clip is inside. This is the error that it spits out:

Code: Select all
...script.lua:20: attempt to index a nil value

Can someone please help me to understand why introducing the ".aif" file into the mix keeps the script from working? I would imagine the equivalent python script breaks for the same reason, so if anyone has advice for a python script that performs the same function (but is able to pass through mixed media files without the "nil value" error) that would be much appreciated.

Thank you

Re: Audio Item Breaks Recursive Media Pool Search

PostPosted: Thu Jul 22, 2021 2:43 am
by Brendan Dower
Hi Clayton,

Thanks for bringing this to our attention - Our Resolve team are investigating this further.

Can you please clarify if it's a specific .aif file, or if this occurs with any/all aif files? If it is a specific aif file, does it work with the Resolve GUI or does the Resolve GUI crash when searching for this file too?

- Brendan