John_R_Ellis's profile
Champion

Champion

 • 

6K Messages

 • 

103.7K Points

Wed, Mar 21, 2012 2:16 AM

Closed

Solved

Lightroom SDK: Bug in photo:getRawMetadata ("durationInSeconds")?

In LR 3, the field "durationInSeconds" returned by photo:getRawMetadata() is a number. But in LR 4, it's a userdata that tostring() shows as "RatioTime( 1847/6 )". Some tedious experimentation (absent documentation) shows that the method toNumber() will convert it to a number.

Was it intentional to return this field as a built-in object? I suspect that this is a bug, that the intention was to convert the RatioTime to a number before returning it to the client caller. All other SDK objects have names that start with "Lr".

Official Solution

Champion

 • 

6K Messages

 • 

103.7K Points

10 y ago

This is fixed in LR 4.1 RC2.

44 Messages

 • 

620 Points

10 y ago

Yes it appears this call is now returning a "RatioTime." I agree this is a bug. This is fallout from new video functionality in LR4. For backwards compatibility this should return a number, not a RatioTime.

It would be nice to have a "durationInRatioTime" field as well if additional accuracy is required, but as you pointed out it shouldn't be a "RatioTime" object- probably just a table with a denominator and numerator.

I will file and track this issue. Thanks!

Champion

 • 

6K Messages

 • 

103.7K Points

Thanks.