6 Replies Latest reply on Nov 17, 2008 10:08 AM by escouten

    How to find Collection name or Catalog name for an exported photo

      Hi

      I've written a plugin to exprt images to an inhouse image archive system.

      I've got everything working but would like to know if it's possible to retreive the name of a collection or catalog to which each image belongs.

      The LrCatalog does not seem to have a "name" or "title" property and the LrPhoto has not "collections" property.

      Is this do-able at all ?

      Wayne
        • 1. Re: How to find Collection name or Catalog name for an exported photo
          Level 1
          Could you use the path, obtainable from the active catalog:

          local cat = LrApplication.activeCatalog()
          local p = cat.path

          If I am not mistaken, the last part of the path (directory name) is also the name of the catalog.
          • 2. Re: How to find Collection name or Catalog name for an exported photo
            No I don't think this is possible with the current SDK.

            The collection context would need to be stored for each photo exported in the situation where a user had created a selection from a collection or set of collections.

            The export context just provides a big bag of LRPhoto objects which do not have any connected information about where in the collection tree (if indeed the user was working within a collection rather than a folder) the photo was when the export was carried out.

            A bit of a shame as I could make use of this feature if the API supported it. We would need something like a LRCollectionContext object that you could get by calling something like LRPhoto.getCollectionContext(). This would then give a collection 'Path' constructed from the collections sets -> collections hierarchy for each of the photos to be rendered.

            Lets hope this can be forthcoming from Adobe in future as it would enhance export hugely. Most of my use of export is for DVD burning, but I can't easily use this to create a useful directory structure on the DVD so I end up have to export to directories and do the burn manually. Very wasteful of time.

            I get the feeling that between LR 1.0 and 2.0 something was done for technical reasons which made the distinction between collection sets and collections necessary. As a result, that might make these kinds of operations a bit more complex. I see now that in LR2.0 I cannot select 2 collections and see all the images in that pair of collections as one virtual set. The 2 collections now need to be grouped into an explicit collection set. This is less flexible than LR 1.0, and I guess means that any API dealing with collections might be a bit unstable, or marked by whatever underlies this (from my point of view) downgrade in the functionality of the collections. I'd be interested to see a comment from someone at Adobe about this as I think its a dissapointing feature of LR2.0 and I'd truly love to hear that this is something that will go away in future release so that we can see the flexibility of LR 1.0 back again.... and an export API with collection capabilities exposed.
            • 3. Re: How to find Collection name or Catalog name for an exported photo
              I was was checking if its possible to use the collections as the "folder structure" for the export. unfortunately I realized it is not supported as yet.

              Maybe Adobe can consider adding in the Export Location section a new option like 'Put in Subfolder' called 'Put in Current Collection Folder' which will export the images to folders named after the collection hierarchy or have a parameter that can be used that will bring back the collection hierarchy.

              I would appreciate if Adobe can kindly comment on this or consider creating a function to check the collection set\collection associated with an image.
              • 4. Re: How to find Collection name or Catalog name for an exported photo
                escouten Adobe Employee
                @Wayne: Catalogs don't really have a "name" as such, aside from the filename. You can retrieve that by calling LrApplication.activeCatalog.path. The functions in LrPathUtils will help you strip that down from the full path to the portion of interest.

                @Paul: Providing deeper access to collections and other parts of the data model is definitely on the radar for future versions of the SDK.

                @Assaf: The challenge here is knowing what collection to use. A single photo could be in no collections, one collection, or 500 collections. Which one would you use for the subfolder?
                • 5. Re: How to find Collection name or Catalog name for an exported photo
                  I just downloaded the SDK today, because I wanted to check for the ability to do this. When I didn't see a direct way, I thought I'd check the forums. I was hoping to find that photo:getFormattedMetadata( key ) would support an undocumented "collections" key.

                  However, it seems to me you could possibly do this, with limited support. Would it work to query catalog::findPhotos with expected collection names? If so, you could support some limited set of collection names, then churn through them till one returned your photo you are about to export.

                  Is this technically possible? I've just taken a guess by looking at the API. I don't know how easy it is to get a catalog object.
                  • 6. Re: How to find Collection name or Catalog name for an exported photo
                    escouten Adobe Employee
                    You can get access to the current catalog via LrApplication.activeCatalog.

                    Your idea about using catalog:findPhotos (note: in Lua, it's a single colon, not the C++-like double colon) is probably the best that can be done with the current SDK. There isn't really any way to walk the list of collections.