Variable for date-time File Metadata Changed

Started by PandDLong, April 15, 2021, 12:41:50 AM

Previous topic - Next topic

PandDLong


Can a file variable be added that provides the datetime stamp for when the metadata was last changed in the database for the file?

This data is in the History panel but can't be accessed by a variable (at least I didn't find it listed in Help nor the Variable Selector and I did a few attempts in VarToy with various spellings - but I expect it isn't exposed to the variables capability at all).

Thanks for considering.

Ger

Try


function getHistoryData() {
           IMWS.get('v1/files', {
            idlist: IMatch.idlist.fileWindowSelection,
                fields: 'id,name,history',
           }).then(function(r) {
            if (r.files.length > 0) {
                    resultJSON.html(JSON.stringify(r, null, 2));
           
                    });
                };
           });
        };


The JSON will look like:


{
  "files": [
    {
      "id": 4089,
      "name": "20060530_162411_1234.jpg",
      "history": [
        {
          "event": {
            "type": 1,
            "name": "added",
            "id": 4089,
            "id2": 0,
            "dateTime": "2019-02-24T12:20:47",
            "title": "",
            "text": "",
            "user": "Ger"
          }
        },
        {
          "event": {
            "type": 2,
            "name": "updated",
            "id": 4089,
            "id2": 0,
            "dateTime": "2019-02-24T12:21:12",
            "title": "",
            "text": "",
            "user": "Ger"
          }
        },
        {
          "event": {
            "type": 60,
[...]

Mario

Does {File.MD.XMP::xmp\ModifyDate\ModifyDate} not work for you? Or the shortcode {File.MD.modifydate}?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

PandDLong


File.MD.modifydate seems to correspond to when metadata is last modified in the file.   ie. it corresponds almost exactly to 'Updated' in the History panel.

I was hoping for the datetime corresponding to 'Metadata changed' in the History panel. 


I haven't done any scripting yet with iMatch - perhaps it is time to start...

Michael

Mario

Yes. IMatch does not maintain separate variables to keep track on when you modified metadata of a file in the Keywords Panel, Metadata Panel or by one of the many other means.
The history is not accessible via variables (complex struct, never requested) but via the v1/files endpoint.

The history is one of the most overlooked features in IMatch for 'normal' users - it was added initially for commercial and institutional users.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook