Marking album/image metadata "dirty"

I'm developing a scripted personal iPhoto export chain that sets all of the metadata into the image files themselves. It utilizes sidecar .xmp files for the albums. It then uploads them to the album directory store. This effectively puts all metadata into the filesystem, save comments. In terms of iPhoto export, it handles title, description, keywords, rating*, and even the new zp:Thumbnail tags (set for the image tagged "Thumbnail").

For the last step of export, I'd really like to automate the process of marking a given album as "dirty" so that its metadata will be rescanned. My understanding is that this involves setting the mtime for the appropriate items in the database to '0'. I have a few questions about this:

1. Is it possible to mark as dirty the metadata in an individual album, separately from images it contains? For example if album.xmp were updated, but none of the images themselves were.

2. Is there a URL callback that can be directly accessed which will mark as dirty the metadata in some album (e.g. /path/to/album?reset-metadata or some such)?

3. If you only set mtimes to 0 but do not initiate the "Garbage Collection", will the meta data be regenerated "on demand" whenever those albums are viewed, similar to new albums? This would make the export much more responsive.

Thanks!

[* Since "Rating" is a valid EXIF tag, are there plans to parse that tag to set image rating? ]

Comments

  • Setting the mtime of an object to dirty makes just that object dirty. So setting the mtime of an album will cause only that album's metadata to be repopulated, not the images within the album.

    We have not implemented a "mark it dirty" function.

    When an image is instantiated it's mtime is compared against the database. If it is "newer" then the metadata is repopulated. So setting mtime ot 0 will cause the on-demand repopulation.

    Currently we have no plans to parse the rating EXIF tag. You should crate a new feature ticket for that.
  • Thanks. Is there a then any way to set the mtime of an album by itself? Perhaps a database approach would be preferable, for then you could set precisely (and only) the albums and images that have been updated.
  • acrylian Administrator, Developer
    Zenphoto generally is filesystem based so that will always have priority. I have no idea if you can change the metadata/mtime of a folder actually. I never tried that. A very quick google of "modify directory mtime php" got this:
    http://geovoyagers.de/earth/programmierung/exif2folder

    Not looked at or tried, but maybe that will help you.
  • For objects decending from persistentobject you can directly set fields using the `object->set(field,value)` method followed by a `object->save()`
  • Thanks, both. I'm a bit confused. My understanding is that the database copy of the mtime needs to be modified to mark something (album, image) "dirty". If simply updating the mtime of files and or directories were sufficient to have zenphoto notice that they are outdated, then what would be the point of the "refresh metadata" album functionality?
  • I guess you need to read the documentation, especially the object model stuff. The above code does noting to the mtime of files/folders, it updates the field in the object.

    BTW, you could actually update the mtime of the files and folders, since Zenphoto compares that to the value retained by the object.
  • Thanks. I read through the Object model documentation, and any other documentation I could find on updating metadata, but could not find any information on this (nor did a full site search for "mtime" reveal much).

    You said:

    BTW, you could actually update the mtime of the files and folders, since Zenphoto compares that to the value retained by the object.

    This sounds very promising, but I'm having trouble reproducing it. I make a test album, call it "album". Since it's new, zenphoto creates a new zp_albums entry for it, recording its mtime, and the metadata from the album.xmp sidecar file I also created. So far so good.

    Later, in the albums filesystem on the server, I change some metadata in the sidecar file, and then update the mtime on both the album directory itself and album.xmp file (using touch, verified by stat). Then I reload the album in the zenphoto browser window. Nothing has been updated; the old information persists in the database. I reload its parent album, still no update. I edit the album and clear the cache. Still outdated. Only if I edit the album and `Refresh Metadata` (which typically hangs in a reloading state) is the zp_albums record updated with the new mtime/metadata.

    So, apologies if I'm missing something basic, but I'd love to know if it's possible to, as the thread says, mark an album and/or image dirty by (for example) updating its mtime, so that any metadata within it will be reread from disk, and the corresponding database record updated, the next time it is accessed or displayed?

    Thanks and sorry for the slow uptake.
Sign In or Register to comment.