[KPhotoAlbum] Command line filtering

Robert Krawitz rlk at alum.mit.edu
Fri Feb 22 03:59:23 GMT 2019


On Wed, 20 Feb 2019 21:37:18 -0500 (EST), Robert Krawitz wrote:
> On Sat, 16 Feb 2019 19:17:08 -0500, Robert Krawitz wrote:
>> For a project I might or might not do, I was thinking of writing a
>> script to list the images in an index.xml file, with optional
>> filtering on the command line or via a file.
>>
>> The filter "syntax" would actually be a perl expression.  This sounds
>> inefficient, but it can be done via creating the loop as a string with
>> the filter expression embedded, and then eval'ing the entire loop.
>> One-off tags like filename, start/end date, height, width etc. would
>> be expressed as simple variables; an invocation might look like
>>
>> kpa-filter index.xml '($height * $width > 20000000) && (has_keyword("foo") || matches_person("krawitz") || matches_category("Places", "USA"))'
>>
>> or put the expression in a file and use it via -f.  The output would
>> be a list of filenames.
>>
>> Do people think this would be interesting?  I should warn everyone
>> that the next month will be very busy for me (I'm hoping it will be,
>> at any rate) depending upon how deep we go in the NCAA Division III
>> basketball postseason.
>
> I managed to squeeze in some time (the upside of installs that take a
> long time :-) ) to implement something quick and dirty that does this;
> I stuck it in contrib for people to play with.  It does not handle
> EXIF data at this time, but there's no question that that would be
> useful.  Slurping in the EXIF data would add considerable overhead in
> the cases it isn't needed.

I did add the EXIF support.  It does add some overhead, but not as bad
as I expected; it adds about 25%, but you can turn it off if you're
not using it.  SQLite is rather fast.
-- 
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