Import media to power bin programmatically

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

Rafadess

  • Posts: 8
  • Joined: Mon Apr 02, 2018 4:33 pm
  • Real Name: Rafael Dessotti

Import media to power bin programmatically

PostMon Jun 18, 2018 2:49 pm

Hi folks,

Do you guys know if it's possible to import medias to power bins with scripts?

I saw in readme that davinci script has a function called AddItemsToMediaPool(item1, item2, ...). Is it possible to use this function to import items to power bins instead of to ordinary bins?

The idea is to make sure that users has the correct files imported before run other scripts.

Regards,
Rafael Dessotti
Rafael Dessotti
BRAZIL
Offline

FranzDev78

  • Posts: 8
  • Joined: Mon Mar 04, 2024 4:30 pm
  • Real Name: Franco Zega

Re: Import media to power bin programmatically

PostThu Mar 14, 2024 4:45 pm

I'm interested in this too
I'll bring the discussion back.

I tried to use
Code: Select all
var ms = resolve.GetMediaStorage();
ms.AddItemListToMediaPool("E:\\clip\\testimport.mp4");


but it always replies that the file doesn't exist, when in reality it does...


Am I doing something wrong?

Thanks everyone for the kind replies.
Offline

Stephen Swaney

  • Posts: 29
  • Joined: Tue Jun 15, 2021 4:23 pm
  • Location: Michigan, USA
  • Real Name: Stephen Swaney

Re: Import media to power bin programmatically

PostFri Mar 15, 2024 3:57 pm

"E:\\clip\\testimport.mp4"


Purely a random guess, but maybe the problem is backslashes vs escape sequences in whatever scripting language Resolve uses. Maybe try with a single backslash?
Offline

FranzDev78

  • Posts: 8
  • Joined: Mon Mar 04, 2024 4:30 pm
  • Real Name: Franco Zega

Re: Import media to power bin programmatically

PostThu Mar 28, 2024 12:40 pm

Stephen Swaney wrote:
"E:\\clip\\testimport.mp4"


Purely a random guess, but maybe the problem is backslashes vs escape sequences in whatever scripting language Resolve uses. Maybe try with a single backslash?




Thank you! and sorry for the late reply.

the problem is that it doesn't take unc paths,
I tried like this:

Code: Select all
ms.AddItemListToMediaPool("\\\\MyFolder\\clip\\test.mp4");


and so :
Code: Select all
ms.AddItemListToMediaPool("\\MyFolder\clip\test.mp4");


but don't work, the error is in attach file.

any idea ?
thanks for the answers.
Attachments
Screenshot 2024-03-28 141715.png
Screenshot 2024-03-28 141715.png (20.15 KiB) Viewed 267 times
Offline

Andy Mees

  • Posts: 3259
  • Joined: Wed Aug 22, 2012 7:48 am

Re: Import media to power bin programmatically

PostThu Mar 28, 2024 1:40 pm

try
Code: Select all
resolve.GetMediaStorage().AddItemListToMediaPool("E:/clip/testimport.mp4")
Offline

FranzDev78

  • Posts: 8
  • Joined: Mon Mar 04, 2024 4:30 pm
  • Real Name: Franco Zega

Re: Import media to power bin programmatically

PostThu Mar 28, 2024 2:01 pm

resolve.GetMediaStorage().AddItemListToMediaPool("E:/clip/testimport.mp4")


yes,...this run correctly!!

but so doesn't work....

resolve.GetMediaStorage().AddItemListToMediaPool("////sharedfolder//clip//testimport.mp4")


It doesn't seem to see the unc paths

Thanks.
Offline
User avatar

Vojta Filipi

  • Posts: 57
  • Joined: Wed May 18, 2022 4:24 pm
  • Real Name: Vojtěch Filipi

Re: Import media to power bin programmatically

PostFri Apr 05, 2024 6:53 pm

I´m interested in this too, but for getting files from power bin
Offline

FranzDev78

  • Posts: 8
  • Joined: Mon Mar 04, 2024 4:30 pm
  • Real Name: Franco Zega

Re: Import media to power bin programmatically

PostMon Apr 08, 2024 7:24 am

Hi,

for the topic issue, I solved it this way:


project_manager = resolve.GetProjectManager();
project = project_manager.GetCurrentProject();

var mp = project.GetMediaPool();

var xx = [];
xx.push(pathToImport);
var res = mp.ImportMedia(xx);



In this way, the UNC path is also seen correctly.


To take the clips from the Mediapool (not timeline) :
var flist = [];
var rootFolder = project.GetMediaPool().GetRootFolder();
var clips = rootFolder.GetClipList();

for (item in clips) {
if (clips[item].GetClipProperty("Type").toLowerCase() != "timeline") {
flist.push(clips[item].GetClipProperty("File path"));
}
}

console.table(flist);

Return to DaVinci Resolve

Who is online

Users browsing this forum: 4EvrYng, panos_mts, roger.magnusson and 116 guests