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

Does a PP Project have XMP data?

Explorer ,
Jun 17, 2016 Jun 17, 2016

Copy link to clipboard

Copied

Hi all, can a Premiere Pro Project have XMP data?  I know clips can have data, but I want to store data globally for the project, not tied to a specific clip or bin.  I need to be able to blast all clips/bins from a project but still retain XMP data.

I found this thread but it wasn't much help:

Re: Storing data in Premiere Project

I saw in the DOM there's a "app.project.rootItem" which is of type ProjectItem.

I also saw the code in Premiere.jsx that reads/writes XMP data to ProjectItems and tried this on the root item, but with no luck.

Any help would be greatly appreciated.

TNKS!

G

TOPICS
SDK

Views

1.6K

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 , Jun 20, 2016 Jun 20, 2016

1. That might work,
2. That's some scary user experience.

Why not store those as data, private to your panel, associated with that project?

Save a list of correspondences in a .txt file somewhere (the PPro prefs dir is available via API; seems like a likely location); something like:

OSFolder /Users/username/work_projects/ProjectXYZ_ingest  = /Users/username/Documents/Adobe/projectname.prproj:ProjectXYZ_ingest

Your panel could sniff the current project path, check that .txt file for correspondence

...

Votes

Translate

Translate
Adobe Employee ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

> I need to be able to blast all clips/bins from a project but still retain XMP data.

XMP is associated with project items, not with the project itself.

What sort of XMP metadata would make sense, without being attached to actual data?

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
Explorer ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

Thanks for clarifying Bruce!

I'm writing a Panel extension that can sync an OS folder structure to bins and clips and visa versa.  I need a place to globally store a user selectable base folder path (might even have multiple base paths).  I think I'll just auto generate a sequence to store global values on.

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 ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

1. That might work,
2. That's some scary user experience.

Why not store those as data, private to your panel, associated with that project?

Save a list of correspondences in a .txt file somewhere (the PPro prefs dir is available via API; seems like a likely location); something like:

OSFolder /Users/username/work_projects/ProjectXYZ_ingest  = /Users/username/Documents/Adobe/projectname.prproj:ProjectXYZ_ingest

Your panel could sniff the current project path, check that .txt file for correspondences, then sync. Get the bin's 'context in project', from projectItem.treePath, to avoid dupe bin name problems.

Potentially of interest: There's a 'hidden' pref tucked away in the Media Browser's 'hamburger menu' (three horizontal bars next to the name 'Media Browser'): 'Allow Duplicate Media During Project Import'. Turn this OFF, to ensure that users only ever get one copy of referenced footage.


In a forthcoming release you should be able to add a property (with value) to the project metadata schema, but I'd start with the proposal above.

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
Explorer ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

Haha yes it could be scary   But we're planning on adding lots of smarts to address to problems of duplicate clips etc.  I'll look into the txt file solution as well.

Thanks again!

Geordie

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
Explorer ,
Jun 20, 2016 Jun 20, 2016

Copy link to clipboard

Copied

OK more investigations, is it possible to set/get XMP data on a Bin?

I've noticed the only metadata fields that are editable for bins are "Comment" and "Client" in the Clip section.

Which XML schema do I use to access the clip data?

I'm using the mungeXMP function as inspiration to write this:

getProjectData: function()

    {

        if (ExternalObject.AdobeXMPScript == undefined)

        {

             ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

        }

       

        var numItems = app.project.rootItem.children.numItems;

        

        var currentItem;

        var dataItem;

        for (var i = 0; i < numItems; i++)

        {

            currentItem = app.project.rootItem.children;

            alert(currentItem.name);

            if(currentItem.name == "__DATA_DO_NOT_DELETE__")

            {

                 alert("found");

                dataItem = currentItem;

                break;

            }

        }

       

        if(dataItem === undefined)

        {

            //dataItem = app.project.createNewSequence( "__DATA_DO_NOT_DELETE__", $._ext.generateUUID());

            dataItem = app.project.rootItem.createBin("__DATA_DO_NOT_DELETE__");          

        }

       

        var xmp_blob = dataItem.getXMPMetadata();

        var xmp = new XMPMeta(xmp_blob);

       

        xmp.setProperty(XMPConst.NS_DM, "Comment", "{'test':'testVal'}");

       

        var xmpAsString = xmp.serialize(); // either way, serialize and write XMP.

        dataItem.setXMPMetadata(xmpAsString);

       

        return(dataItem);

        // var xmp_blob = dataItem.getXMPMetadata();

    },

It runs but doesn't do anything.  I'm assuming XMPConst.NS_DM is the wrong schema.

Also, running this from the Extendscript Toolkit:

var xmpData = app.project.rootItem.children[0].getXMPMetadata();

$.writeln(xmpData);

Doesn't return any XMP data. (I confirmed my bin was child 0)

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 ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

As your testing showed, no. This makes sense, in PPro's model; XMP lives with the asset, and there is no asset 'behind' that bin.

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
Explorer ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

Thanks again, I'll begrudgingly store my project data in a sidecar file

For clarity:

Is Clip metadata not accessible at all though code (on any kind of asset) or is this more to do with assets that don't have a referenced file?

Clip metadata is not XMP data?

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 ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

When you say 'clip', my internal PPro translator substitutes 'clip within a timeline'. I think you mean media, a.k.a. projectItems, right?

In PPro, metadata travels with the media with which it's associated; in the API, that means projectItems, including media and sequences. As you've found, for bins, there's no "there" there; there's nowhere outside the .prproj for PPro to store asset-associated metadata (I'm 70% sure you'll find the same is true for Bars&Tone, Universal Counting Leader, and other synthetic importers).

For projectItems associated with actual media, panels can TOTALLY get and set both the XMP metadata, and PPro's private project metadata; see example in PProPanel.

Oh yeah, updated PProPanel sample forthcoming, including the capability to get the projectItem associated with a clip in a timeline.

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
Explorer ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

pprobin.png

So in the metadata panel there's "Clip" and "File" sections.  I was referring to the "Clip" section above which would be linked to a Project Item.

Is the "Clip" section PPro's internal metadata and the "File" section the XMP data?

I can set the Clip -> Comment and Clip -> Client sections for Bins, and just did a test and can set the other text properties for a "Black Video" project item.  I've also saved the project and restarted PPro and the "Clip" metadata is still present for a Bin.

Is there an example of setting Clip -> Comment or Clip -> Client for a Bin or something similar with extendscript?

Thanks again Bruce for your Help

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 ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

Geordie Moffatt wrote:

Is the "Clip" section PPro's internal metadata and the "File" section the XMP data?

Exactly!

Is there an example of setting Clip -> Comment or Clip -> Client for a Bin or something similar with extendscript?

Yes. From PProPanel:

modifyProjectMetadata : function () {
var kPProPrivateProjectMetadataURI = "http://ns.adobe.com/premierePrivateProjectMetaData/1.0/";
var namefield = "Column.Intrinsic.Name";
var tapename  = "Column.Intrinsic.TapeName";
var desc      = "Column.PropertyText.Description";
var newField  = "ExampleFieldName";

if (app.isDocumentOpen()) {
var projectItem = app.project.rootItem.children[0]; // just grabs first projectItem.
if (projectItem) {
if (ExternalObject.AdobeXMPScript === undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}

if (ExternalObject.AdobeXMPScript !== undefined) {// safety-conscious!
var projectMetadata = projectItem.getProjectMetadata();
var successfullyAdded = app.project.addPropertyToProjectMetadataSchema(newField, "ExampleFieldLabel",  2);

var xmp = new XMPMeta(projectMetadata);
var obj = xmp.dumpObject();

// var aliases = xmp.dumpAliases();

var namespaces = XMPMeta.dumpNamespaces();

var found_name      = xmp.doesPropertyExist(kPProPrivateProjectMetadataURI, namefield);
var found_tapename  = xmp.doesPropertyExist(kPProPrivateProjectMetadataURI, tapename);
var found_desc      = xmp.doesPropertyExist(kPProPrivateProjectMetadataURI, desc);
var found_custom = xmp.doesPropertyExist(kPProPrivateProjectMetadataURI, newField);

xmp.setProperty(kPProPrivateProjectMetadataURI, tapename,"***TAPENAME***");
xmp.setProperty(kPProPrivateProjectMetadataURI, desc,"***DESCRIPTION***");
xmp.setProperty(kPProPrivateProjectMetadataURI, namefield,"***NEWNAME***");
xmp.setProperty(kPProPrivateProjectMetadataURI, newField, "PProPanel set this, using addPropertyToProjectMetadataSchema().");

var str = xmp.serialize();

var array = new Array();
array[0] = tapename;
array[1] = desc;
array[2] = namefield;
array[3] = newField;

projectItem.setProjectMetadata(str, array);
  
// test: is it in there?
var newblob= projectItem.getProjectMetadata();
var newXMP= new XMPMeta(newblob);
var foundYet= newXMP.doesPropertyExist(kPProPrivateProjectMetadataURI, newField);

if (foundYet){
alert("PProPanel successfully added a field to the project metadata schema, and set a value for it.");
}
}
}
}
},

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
Explorer ,
Oct 20, 2016 Oct 20, 2016

Copy link to clipboard

Copied

LATEST

Resurrecting this thread for future travelers.  Got a set and get metadata function working.  Thanks again for the help Bruce

// metadata format: [["fieldName", "fieldLabel", "PropValue"]]

// This is to get around eronious property names added at object level.

function setMetadata(projectItem, metadata)

{

    var kPProPrivateProjectMetadataURI = "http://ns.adobe.com/premierePrivateProjectMetaData/1.0/";

   

    if (app.isDocumentOpen())

    {

            //var projectItem =  app.project.activeSequence.projectItem;

            if (projectItem)

            {

                if (ExternalObject.AdobeXMPScript === undefined)

                {

  ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

    }

          

                 if (ExternalObject.AdobeXMPScript !== undefined)

                 {

                     var projectMetadata = projectItem.getProjectMetadata();

                     var xmp = new XMPMeta(projectMetadata);

                    

                     // Adding new properties to schema                   

                     for(var pc =0; pc < metadata.length; pc++)

                     {

                         var successfullyAdded = app.project.addPropertyToProjectMetadataSchema(metadata[pc][0], metadata[pc][1],  2);                        

                     }

                     

                      var array = [];

                      for(var pc =0; pc < metadata.length; pc++)

                     {

                          xmp.setProperty(kPProPrivateProjectMetadataURI, metadata[pc][0], metadata[pc][2]);

                          array.push(metadata[pc][0]);

                     }

               

                      var str = xmp.serialize();                    

                      projectItem.setProjectMetadata(str, array);                     

                 }          

            }

    }

}

// fieldNames = array of fieldnames

function getMetadata(projectItem, fieldNames)

{

    var kPProPrivateProjectMetadataURI = "http://ns.adobe.com/premierePrivateProjectMetaData/1.0/";

     if (app.isDocumentOpen())

    {

         if (projectItem)

            {

                if (ExternalObject.AdobeXMPScript === undefined)

                {

  ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

    }

          

                 if (ExternalObject.AdobeXMPScript !== undefined)

                 {

                     var retArray = []

                     var projectMetadata = projectItem.getProjectMetadata();

                     var xmp = new XMPMeta(projectMetadata);

                     

                      for(var pc =0; pc < fieldNames.length; pc++)

                      {

                          if(xmp.doesPropertyExist(kPProPrivateProjectMetadataURI, fieldNames[pc]))

                          {

                                retArray.push([fieldNames[pc], xmp.getProperty(kPProPrivateProjectMetadataURI, fieldNames[pc])])

                          }

                      }

                 

                       return(retArray);

                  }

            }

    }

    return(false);

}

// Test Code

var projectItem = app.project.activeSequence.projectItem;

var testObj = {};

testObj.propA = "test2";

testObj.propB = [4,2,3,2000];

setMetadata(projectItem, [["myCustomPropName", "myCustomPropLabel", JSON.stringify(testObj)]]); // value doesnt need to be JSON, just using as example

getMetadata(projectItem, ["myCustomPropName"]);

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