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
> 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
...Copy link to clipboard
Copied
Seems like by-design behavior.
Specifically, what dialog is shown, in response to what action?
Copy link to clipboard
Copied
Hi Bruce,
The popup appears when the premiere is refreshed (refocused) after changing the media path.
"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.
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();
}
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?
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.
Copy link to clipboard
Copied
OK, thanks Bruce.
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.
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.
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?
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.
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.
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.
Copy link to clipboard
Copied
We can quote no specific dates.
Copy link to clipboard
Copied
Hello Bruce Bullis​,
Any update on this?
Thanks,
Meet
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.
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.
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.
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.
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.
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