• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Link Media dialog when re-linking files trough code.

New Here ,
Aug 14, 2017 Aug 14, 2017

Copy link to clipboard

Copied

Hi,

We are integrating  adobe into our workflow automation and are running into what appears to be a bug in the program.

When renaming files to facilitate automatic upload and synchronisation, a dialog shows after the file is re-named and re-linked by code.

This seems buggy to us, as the whole reason of being able to use code for this is to prevent user interaction and thereby user error.

The code we use is as following:

cep.fs.rename(oldPath, newPath); 

projectItem.changeMediaPath(newPath); 

Are we missing something or is this indeed a bug in the program?

Kind regards,

Sven

TOPICS
SDK

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Aug 15, 2017 Aug 15, 2017

> Why would a human interaction be made mandatory in this case?

Because you just intentionally made footage go missing, and the user would need to fix the problem created by your script, in order to use that projectItem.

> And if this is "By-design behaviour", how do we adjust the linked file without human interaction?

Copy the file to [newname], instead of renaming it.


The following code successfully changes a media item's path, without provoking any dialogs, or user interaction.

var first = app.pr

...

Votes

Translate

Translate
Adobe Employee ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

Seems like by-design behavior.

Specifically, what dialog is shown, in response to what action?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

Hi Bruce,

The popup appears when the premiere is refreshed (refocused) after changing the media path.

missing_media.png

"By-design behaviour" seems a bit odd to me.

Why would a human interaction be made mandatory in this case? Especially seeing as this is all invoked by the SDK to begin with and the path is already been set.

And if this is "By-design behaviour", how do we adjust the linked file without human interaction?

Kind regards,

Sven.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

> Why would a human interaction be made mandatory in this case?

Because you just intentionally made footage go missing, and the user would need to fix the problem created by your script, in order to use that projectItem.

> And if this is "By-design behaviour", how do we adjust the linked file without human interaction?

Copy the file to [newname], instead of renaming it.


The following code successfully changes a media item's path, without provoking any dialogs, or user interaction.

var first = app.project.rootItem.children[0];

var oldPath = first.getMediaPath(); // 'Users/bbb/Movies/somefile.mxf'

var canChange = first.canChangeMediaPath();

if (canChange){

    first.changeMediaPath('/Users/bbb/Movies/aaa.mp4');

    var newPath = first.getMediaPath();

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

Hey Bruce

But copying the file is a huge time, computation and storage overhead when we just want to rename. If I understand correctly, you're suggesting we: copy file -> changeMediaPath to new file -> delete old file? These are high-bitrate media files, could be tens of gigabytes; copying seems like an unreasonable overhead.

I'm still not following why: rename -> changeMediaPath isn't valid. I guess there's a fraction of a second in between the 2 commands being executed where the file is indeed offline, but surely there must be a way to handle that and make it a granular operation?

Am I missing something?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

I'm suggesting that the Locate Footage dialog is entirely avoidable, by copying instead of renaming first.

Changing a path to something non-existent will, for now, provoke a dialog. As we've discussed, we're looking into changing that, in future versions.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

OK, thanks Bruce.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

I'd be curious to know if you only have 1 file in your test project, if

that file is even renamed.

During my tests with multiple files regarding this topic it turned out the

first file was never or rarely renamed because it was locked by PrPro

somehow. All other files were properly renamed and relinked.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

You're saying cep.fs.rename() was unsuccessful?

If PPro has a projectItem referring to that file path, then yes, it's very likely that the file was in use by PPro.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 17, 2017 Aug 17, 2017

Copy link to clipboard

Copied

Hi Bruce,

what does "being in use" actually mean? There was no (obvious) I/O operation being performed on the file (clip wasn't activated in any way, not loaded to source, no being used in a timeline, no preview generation or audio waveform calculation...nada!), how does Premiere "use" (lock) a file if there is no need to?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 17, 2017 Aug 17, 2017

Copy link to clipboard

Copied

Your conception of whether or not PPro 'needs' to keep files open/locked, may vary from PPro's own.

PPro doesn't access files directly; it relies upon Importer plug-ins. Those plug-ins are asked to provide details about the media, and are responsible for getting/setting associated metadata. It's up to each plug-in how long to keep each file open.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 21, 2017 Aug 21, 2017

Copy link to clipboard

Copied

Ok, I've written up the annoying behavior as DVAPR-4203511; I'll keep the thread informed of our progress.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 23, 2017 Aug 23, 2017

Copy link to clipboard

Copied

Hi Bruce,

From what I understand from Meet it is not possible to fully re-link media and remove the original file without human interaction, is that correct? If so, I would sooner call it a bug instead of "annoying behaviour".

If this is really the case it means there is no possible solution to this until this is solved. So no possibility to automate production with Premiere at all.

It would also mean the "correct answer" is not really correct, as it is incomplete.

Can we get any further estimation on what time-frame we are looking at to get this solved?

Kind regards,

Sven.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 23, 2017 Aug 23, 2017

Copy link to clipboard

Copied

We can quote no specific dates.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 01, 2018 Feb 01, 2018

Copy link to clipboard

Copied

LATEST

Hello Bruce Bullis​,
Any update on this?

Thanks,
Meet

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

Hi Bruce,

I can partially understand your point that, for the tiniest moment, there is no reference for the file. However, as stated, that is a fraction of a second and solved before the popup could even show.

Furthermore, it seems to me that renaming a file and re-linking it are one and the same action when done through the SDK. Why even have the option to rename available otherwise if it is not possible to implement it using solely the SDK. That is what we are addressing here.

As explained by Rowan, copying would create a massive and completely unnecessary overhead.

Currently there is no reason to copy these files other then: Adobe does not support renaming files without user interaction. Which I must say is quite disappointing.

Kind regards,

Sven.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

I can partially understand your point that, for the tiniest moment, there is no reference for the file. However, as stated, that is a fraction of a second and solved before the popup could even show.

...but not before PPro tried to access the media.

Furthermore, it seems to me that renaming a file and re-linking it are one and the same action when done through the SDK.

You're conflating two distinct APIs; CEP's JavaScript provides cep.fs.rename(), PPro's ExtendScript provides projectItem.changeMediaPath().

Why even have the option to rename available otherwise if it is not possible to implement it using solely the SDK. 

Why = because both methods are both useful, in different scenarios. Sorry you're disappointed.

PPro API feature request B-125731, "Provide API to prevent relink dialogs, when using projectItem.changeMediaPath()".

Further, pre-emptive disappointment; this feature is unlikely to make it into our next major release.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

Another (untested) possibility, which might work, today: Change the path to a valid existing placeholder file (maybe a small .mp4, from within the panel) first, and then to the correct updated path, once the file is renamed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

Would that not mess with the timing of the files as the length of the clip wil differ?

Interesting thing to test though.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 17, 2017 Aug 17, 2017

Copy link to clipboard

Copied

Hi Bruce,

I have copied the file before changing the media path as you have suggested and then delete the old file but the popup still exists. This means premiere pro still holds reference of the old file. Please refer below code snippet:

// Given that I have only one project item in premiere pro i.e. "D:/demo.mov"

var file = new File("D:/demo.mov");

file.copy("D:/demo-copy.mov");

app.project.rootItem.children[0].changeMediaPath("D:\\demo-copy.mov");

file.remove();

Thanks,

Meet

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines