[KPhotoAlbum] More patches

Robert Krawitz rlk at alum.mit.edu
Sat Aug 15 16:06:22 BST 2015


On Sat, 15 Aug 2015 16:47:36 +0200, Johannes Zarl-Zierl wrote:
> ...resending because I was sending from the wrong address before..
> On Sunday 09 August 2015 14:11:01 Robert Krawitz wrote:
>> The logic is still not right.  This structuring, in particular, is
>> incorrect:
>
> Yes, it is:
>
> for(datum : data)
> {
>   if (datum.key == *.LensModel)
>   {
>     value = datum.value;
>     break;
>   }
>   if (datum.key == *.LensIDNumber)
>     value = datum.value;
>   if (datum.key == *.LensType && value.isEmpty())
>     value = datum.value;
> }
>
> Ordering A:
> Exif.LensType = "lt"
> Exif.LensIDNumber = "id"
> Exif.LensModel = "lm"

...

It's more confusing that way, and if we later need to add more
heuristics, it's going to make the code more complicated.  Even with
possible multiple loops, kph uses something like 1% CPU time; it's
spending essentially all of its time waiting for I/O.

>> Also, the canonHack thing isn't the right way to go about it; other
>> cameras may return bogus values.  Those need to be detected and
>> ignored.
>
> How do you propose we detect arbitrary bogus values?

The most obvious to me is that if LensType looks like an integer with
no translation, that we keep looking for Lens and LensModel.  Having
something meaningful is better than not.  Certainly, however, -1 looks
like a default/error value; it's never going to be translatable.

>> Finally, Exif.CanonCS.Lens is a triple of elements.  If it's converted
>> directly to a string, it will look something like
>> 
>> 135 18 1
>
> If you call ExifDatum::toString() this is true. Calling ExifDatum::print(ExifData) interpretes the value and gives something like this:
> "5.4 - 16.2 mm"

Ah.
-- 
Robert Krawitz                                     <rlk at alum.mit.edu>

***  MIT Engineers   A Proud Tradition   http://mitathletics.com  ***
Member of the League for Programming Freedom  --  http://ProgFree.org
Project lead for Gutenprint   --    http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton



More information about the Kphotoalbum mailing list