8 Replies Latest reply on Jun 12, 2009 5:02 AM by john beardsworth

    Label value

    john beardsworth Adobe Community Professional & MVP

      Is it possible to obtain the numerical value of the label?

       

      photo:getFormattedMetadata('label') returns the string value, so Red, Yellow etc, or whatever is in the colour label set at the time the value was assigned. I would like to return 6, 7 etc - the goal is to roundtrip the colour to iView/Expression Media.

       

      Can this be done?

       

      John

        • 1. Re: Label value
          DawMatt Level 3

          johnbeardy wrote:

           

          Is it possible to obtain the numerical value of the label?

           

          photo:getFormattedMetadata('label') returns the string value, so Red, Yellow etc, or whatever is in the colour label set at the time the value was assigned. I would like to return 6, 7 etc - the goal is to roundtrip the colour to iView/Expression Media.

           

          Can this be done?

           

          John

          Hi John,

           

          I think the short answer is no.

           

          Metadata tagsets support a superset of what the getFormattedMetadata() function can access.  Just take the 'com.adobe.' off the front of the value and getFormattedMetadata should (might) be able to return the value.  A quick scan of my metadata tagsets plugin (its open source) found the following label metadata was available:

                  'com.adobe.label',

                  -- label: (string) The name of assigned color label

                  'com.adobe.colorLabels',

                  'com.adobe.colorLabels.string', -- Label

                  'com.adobe.ratingAndLabel', -- Rating and Label

           

          Fundamental problem is the label is just a text string.  The UI might have a keyboard shortcut to assign it and Adobe might even use enums internally to help the UI work, but it is never really considered a numeric item.

           

          I suggest you create a wrapper function with the equivalent of a case statement to turn the value into a number. Sounds like you need the functionality but I seriously doubt Adobe would have exposed it.


          Matt

          • 2. Re: Label value
            john beardsworth Adobe Community Professional & MVP

            Yes, in one sense I was looking for confirmation, Matt, so thanks. Perhaps getFormattedMetadata really should be able to return the numerical shortcut for the current label? If the label matches a choice in the current Color Label Set, return the number. Otherwise return 0?

             

            John

            • 3. Re: Label value
              DawMatt Level 3

              johnbeardy wrote:

               

              Yes, in one sense I was looking for confirmation, Matt, so thanks. Perhaps getFormattedMetadata really should be able to return the numerical shortcut for the current label? If the label matches a choice in the current Color Label Set, return the number. Otherwise return 0?

              I think you've just pointed out why this would be too fragile for Adobe to want to implement.  It would be highly dependent upon what Color Label Set is currently selected and so could rarely work for people who use multiple Color Label Sets.

               

              Which I guess brings us back to your original point.  If they had a permanent record of the color, not just the label, in the metadata that would resolve the problem.  So I guess it is feature request time?

               

              Matt

              • 4. Re: Label value
                john beardsworth Adobe Community Professional & MVP

                Well, I wouldn't say that's a problem for Adobe to implement - just a quick comparison. The fragility is in the mind of whoever uses the loosely-controlled colour label field for long term metadata!

                 

                John

                • 5. Re: Label value
                  DawMatt Level 3

                  johnbeardy wrote:

                   

                  Well, I wouldn't say that's a problem for Adobe to implement - just a quick comparison.

                  Thats why I said they wouldn't want to implement the feature.  They'd receive too many bug reports due to users not using the metadata field properly,  then later wonder why the SDK returns the information they actually stored instead of what they meant to store.

                   

                  Matt

                  • 6. Re: Label value
                    escouten Adobe Employee

                    IMHO getFormattedMetadata is doing the right thing as it stands.

                     

                    What would be nice is if getRawMetadata would return either the number or unlabeled name of the color ('red', 'yellow', 'other', 'none', etc.) of the label.

                     

                    That isn't in the 2.x SDK. (I just checked to see if it happened to be there and didn't get documented. It wasn't. ) Added to the (greatly overloaded) list of things to consider for 3.0 SDK.

                    • 7. Re: Label value
                      DawMatt Level 3

                      escouten wrote:

                       

                      IMHO getFormattedMetadata is doing the right thing as it stands.

                       

                      What would be nice is if getRawMetadata would return either the number or unlabeled name of the color ('red', 'yellow', 'other', 'none', etc.) of the label.

                      That sounds like a good approach.  Alternatively could have a separate labelColor item that could return that data and keep label for the actual text value there.

                       

                      Just noticed this function used for smart collection style functionality:

                      catalog:findPhotos( args )

                      ...
                                        o criteria: (string) The metadata field or fields to search for values that match the given value in a way specified by the operation. Valid values are:
                                         ...
                                          "labelColor" (enum) One of: 1 (red), 2 (yellow), 3 (green), 4 (blue), 5 (purple), "custom" (any label not currently assigned to a color), "none"

                       

                      If John was really against writing his own wrapper function I'm sure he could manufacture a search that could check whether the target photos matched an individual colour.  It would be incredibly inefficient (is my photo labelled red? No.  Is it labelled yellow? No.  How about...) but it could be done.

                       

                      Matt

                      • 8. Re: Label value
                        john beardsworth Adobe Community Professional & MVP

                        A getRawMetadata approach would work fine here.

                         

                        Life's too short to write that wrapper function!

                         

                        John