13 Replies Latest reply on Jul 15, 2010 4:16 AM by abazizis

    Feature Request: DateTimeImageModified & DateTimeMetadataModified

    areohbee Level 5

      At the moment, we have:

       

      DateTimeOriginal - clear.

      DateTimeDigitized - clear.

      DateTime - of what???

       

       

      I would like to see:

       

      DateTimeImageModified - date-time of last develop setting change that affects the image - to support plugins that export images without metadata (or may not care about metadata changes just yet), so they can detect if an image is out of date.

       

      DateTimeMetadataModified - to support plugins that process metadata, so they can detect changes requiring an update.

       

      DateTimeLastModified - A one-stop-shop for determinining if there have been any changes to a photo (this would actually be the greater of the two  above if they were added at the same time). Allows coding that first detects if anything has changed, then if so process - or look more closely at whats changed and then decide...

       

      Rob

        • 1. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
          Lichtzeichenanlage

          Hi,

           

          I've just seen that you can filter images by "edit date". Perhaps that helps you a bit.

           

          s = {

               id = "B3E644B0-6F1C-4725-8BB9-5E46C1557FFD",

               internalName = "DateModified",

               title = "DateModified",

               type = "LibrarySmartCollection",

               value = {

                    {

                         criteria = "touchTime",

                         operation = "==",

                         value = "2010-06-06",

                         value2 = "2010-06-06",

                    },

                    combine = "intersect",

               },

               version = 0,

          }

          1 person found this helpful
          • 2. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
            Lichtzeichenanlage Level 1

            Okay - looks like photo:getRawMetadata('lastEditTime') is the equivalent of the touchTime

            1 person found this helpful
            • 3. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
              areohbee Level 5

              Lichtzeichenanlage,

               

              Thanks for pointing this out - it does help.

               

              Rob

              • 4. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                abazizis

                I would like to know what change this property.. I have been using it to check for last time photo was updated and compare it to a time a photo has been published... simple enough... right.. wrong.. it seem to me that the lastEditTime has the mind of it own and are not predictable.. sometime it stays put.. but most of the time it will increase on you..Consider these statements..

                 

                            local edtDTN = tonumber ( photo:getRawMetadata( 'lastEditTime' ) )
                                            and tonumber ( photo:getRawMetadata( 'lastEditTime' ) )
                                            or 0
                                           
                            local pubDTN = tonumber ( photo:getPropertyForPlugin( _PLUGIN, 'stock_pubDTN' ) )
                                            and tonumber ( photo:getPropertyForPlugin( _PLUGIN, 'stock_pubDTN' ) )
                                            or 0
                           
                            local inSet = renderPhotoId == stockPhotoId
                            local edited = edtDTN > pubDTN
                           
                            local needUpload = false

                 

                            if not inSet then
                                needUpload = true
                            elseif edited then
                                needUpload = true
                            end

                It seems to me that the lastEditTime seem to jump ahead of publishedTime.. could it be that when I publish the photo the lastEditTime got change as well... really need to figure this thing out...if not it will definitely makes my workflow more complex that it already is..

                 

                I do notice that before publishing Lightroom create a snapshot of the photo.. does that constitute event that change lastEditTime..

                • 5. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                  areohbee Level 5

                  I think you may have answered your own question in the course of asking it:

                   

                  Last-edit-time seems to be advanced any time any thing having to do with the photo changes. I haven't checked it against publish status, but this is likely the culprit.

                   

                  Sometimes we (or at least I) really need ways to determine what has changed, not just if something has changed. In my cases so far, there is a big difference between whether the image has changed and therefore requires uploading, or just the metadata has changed - which is uploaded separately. On the other hand, I thought the publish interface was supposed to take care of all this good stuff, no?

                   

                  Definitely it would be better if last-edit-time were not updated just due to a publish/export...

                   

                  Rob

                  • 6. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                    abazizis Level 1

                    Rob... I just figured it out why the last editTime changed.. when ever you published the plugin save the latest photo snapshot. Saving snapshot apparently add to the history thus considered editing the photo... I would say that more information about the photo will be very-very good indeed... imageLastEditTime and metadataLastEditTime.... would help a lot in my plugin..

                    • 7. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                      areohbee Level 5

                      abazizis,

                       

                      Yeah, I just had another case come up where I'm trying to update custom (develop) metadata whenever an image is modified, but as soon as I update the custom metadata it looks like the image has changed (using last-edit-time)...

                       

                      I found a work-around, but still...

                       

                      Rob

                      • 8. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                        abazizis Level 1

                        Would you care to share how you work around that. Hopefully can do my plugin a whole lot of good..

                        • 9. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                          areohbee Level 5

                          This may or may not help since it kinda depends on context, but here it is:

                           

                          This is part of an asynchronous task in a constant (periodic) loop:

                           

                                      local photo = catalog:getTargetPhoto()
                                      if photo then
                                          if lastPhoto then
                                              if photo == lastPhoto then
                                                  lastEditTime = photo:getRawMetadata( 'lastEditTime' )
                                                  if lastEditTime > lastUpdateTime then
                                                      doit = true
                                                  else
                                                      doit = false
                                                  end
                                              else
                                                  doit = true
                                              end
                                          else
                                              doit = true
                                          end
                                      else
                                          doit = false
                                      end

                                      if doit then
                                          pcallStatus = LrTasks.pcall( catalog.withWriteAccessDo, catalog, "DevMeta Auto-Update", function()
                                              DevMeta._updatePhoto( photo ) -- causes last-edit-time to be advanced.
                                          end )
                                          if pcallStatus then
                                              -- LrDialogs.message( 'Updated' )
                                              lastPhoto = photo
                                              lastEditTime = photo:getRawMetadata( 'lastEditTime' )
                                              lastUpdateTime = lastEditTime
                                          else
                                              -- LrDialogs.message( "Unable to update metadata for " .. photo:getRawMetadata( 'path' ) )
                                              -- break
                                              -- ignore - this error always happens until dismissing the plugin manager.
                                          end
                                      else
                                          -- LrDialogs.message( 'Not Updated' )
                                      end

                           

                          Rob

                          • 10. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                            abazizis Level 1

                            Hmm... I guess it is not relevant to me.. thanks... I am looking at comparing the same photo...

                             

                            Local doPublish

                            for _, photo in photos do

                              If photo then

                                 Local lastEditTime = photo:getRawMetadata( 'lastEditTime' )

                                 Local lastPublishTime = photo:getPropertyForPlugin( 'lastPublishTime' )

                                 If lastEditTime > lastPublishedTime then

                                    doPublish = true

                                 else

                                    doPublish = false

                                 end

                              end

                            end

                            • 11. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                              areohbee Level 5

                              abazizis wrote:

                               

                              Hmm... I guess it is not relevant to me.. thanks... I am looking at comparing the same photo...

                               

                              I was afraid of that. It would seem that somehow you need to distinguish between a "last-edit" due to the publishing and a "last-edit" due to a user edit. I guess I don't have the answer - just restating the problem...

                               

                              Rob

                              • 12. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                                areohbee Level 5

                                abazizis,

                                 

                                One possible work-around - don't store the publish-time in the photo metadata. Instead, store it in a lua table, key'd by uuid. It can be written to a text file for persistence - maybe even in lua format, to be re-read using dofile.

                                 

                                Rob

                                • 13. Re: Feature Request: DateTimeImageModified & DateTimeMetadataModified
                                  abazizis Level 1

                                  Found a workaround... Apparently there is a meta field called last edit count.. I can use it instead and do a simple arithmetic to get it to compare edited or not..