On Mon, Sep 1, 2014 at 8:52 PM, Moritz Schallaböck <
[email protected]> wrote:
> Hi guys,
>
> I took my holiday snaps with exposure bracketing and JPEG+RAW, so I ended
> up with six versions of the same image. I wrote a little Lua script to
> autogroup these images.
>
> Images that were taken in the same second (more specifically, the
> exif_datetime string) are put in the same group. I would have hoped to have
> a better basis for the decision, but there doesn't seem to be anything
> there.
>
> That said, apart from making the lighttable view a less cluttered, there
> doesn't seem to be much you can do with groups -- I would have hoped you
> could batch-rank or delete whole groups, but I don't think you can. Oh
> well; less clutter is a start.
>
you can... with lua
one of the problem we have with DT is the kind of behaviour and shortucts
each developer want is highly tied to his workflow
for example, there is a feature-request that pops up regularly to have a
"rate and move to next" image shortcut... it's not a bad idea per-se, but
other people will want a "rate and do not move"
"rate and move to next skipping group" "rate and move to next with a rating
of 0"
all of these are valid use-case but we can't (and won't) flood our UI with
every single type of workflow
This problem is one of the reasons I've added the lua API. With lua you can
create your own shortcuts and then map them the way you please. We are
still in the discovery phase of this feature and the lua API is far from
complete with regards to UI elements, but you can already do quite a lot of
stuff with regards to grouping...
>
> I figured it might be useful for someone out there. No guarantee that this
> won't mangle your library, of course, but it worked fine for me (on
> Darktable unstable). :) Thanks to Jeremy Rosen for pointing me into the
> right direction in IRC.
>
> Installation: As with other scripts, add the code to a new file
> autogroup.lua in the ~/.config/darktable/lua folder and add require
> "autogroup" to your luarc.
>
> Usage: Assign a shortcut for the autogroup function in the settings,
> select images to be autogrouped, hit the shortcut.
>
>
did you add it to
http://darktable.org/redmine/projects/darktable/wiki/LuaScripts ? it would
be nice to do that :)
> Cheers
> Moritz
>
> PS: Devs, a function to reload all Lua scripts without restarting
> Darktable would make script development much faster.
>
>
yes, I have thought of that, but it's quite tricky to do...
you can easily do a shortcut to read and execute a script (using the
builtin dofile function) and master has a d-bus API to send lua commands to
a running darktable
moreover, if you script is only manipulating the database, you can "require
darktable" from within an external script without launching the UI
dumping the lua environement and reloading it completely is tricky
though... Lua can do stuff to DT that is hard to revert and does stuff
within the init phase of DT that is hard to do at any other point (like
adding new exporters or preferences)
so dumping and reloading might breakt DT in unexpected way, so I havn't
spent time doing that...
> dt = require "darktable"
>
> local function callback()
> pics_by_second = {}
>
>
you probably want that variable to be local. no harm, but you might as well
>
>
for key,pic in ipairs(dt.gui.selection()) do
> if pics_by_second[pic.exif_datetime_taken] == nil then
> pics_by_second[pic.exif_datetime_taken] = {}
> end
>
> curgroup = pics_by_second[pic.exif_datetime_taken]
> curgroup[pic.id] = pic
> end
>
> created_count = 0
>
> for _,group in pairs(pics_by_second) do
> firstpic = nil
> for _,pic in pairs(group) do
> if firstpic == nil then
> firstpic = pic
> else
> pic.group_with(pic, firstpic)
> end
> end
>
> end
>
> end
>
> dt.register_event("shortcut", callback, "autogroup images taken in the
> same second")
>
since you implement a single function and that function has no parameters,
some users might want to directly call it from rc.lua to group
automatically at DT start time
it might also be a good idea to trigger it on the post-import-film event to
automatically group images at import time...
>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Darktable-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/darktable-users
>
>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Darktable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/darktable-users