Audio Item Breaks Recursive Media Pool Search

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

claytonbeutler

  • Posts: 6
  • Joined: Mon Jul 12, 2021 10:35 pm
  • Real Name: Clayton Beutler

Audio Item Breaks Recursive Media Pool Search

PostWed Jul 14, 2021 11:35 pm

Hello,

I am attempting to search through all of the subfolders inside of my root folder for a clip named "WIF_FA21_1.mov" 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()
   print(curFolder)
   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 == "WIF_FA21_1.mov" 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.")
                  end   
             end
           end
      end
   end
end


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 "WIF_FA21_1.mov" 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
Offline

Brendan Dower

Blackmagic Design

  • Posts: 45
  • Joined: Thu Oct 10, 2019 5:56 am
  • Real Name: Brendan Dower

Re: Audio Item Breaks Recursive Media Pool Search

PostThu Jul 22, 2021 2:43 am

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
Brendan Dower
Blackmagic Design Developer Support

Return to Software Developers

Who is online

Users browsing this forum: ArtemSt, rajeshgupta and 1 guest