Import variable for burst

Hello,
I have historically renamed all my imported photos by date/time/model. Maybe not the best idea but it works for me and I have all my library on this model.
In darktable, the renaming pattern is
$(EXIF.YEAR)-$(EXIF.MONTH)-$(EXIF.DAY)-$(EXIF.HOUR)h$(EXIF.MINUTE)min$(EXIF.SECOND)s ($(FILE.NAME:-2:2)) $(MODEL).$(FILE_EXTENSION)

I inserted the $(FILE.NAME:-2:2) to get a unique identifier when I have a sequence of photos taken at exactly the same time in burst mode. If I don’t add a sort of sequence number, only one file for each timestamp remains after import.
Is there a way to get a unique identifier if and only if several photos have the same timestamp? Photomechanic, LR and C1 do this already.
My camera does not record milliseconds unfortunately.
Thanks,
Nicolas

You could try using $(ID) which is the numeric image id in the database (therefore it is unique).

1 Like

But that $(ID) would get added to any name, not just to those part of a burst, as @nwinspeare requested.

What OP requests, requires access to the metadata from the other imported files.
I think each file is treated individually, with no reference to (metadata from) earlier files. The only check is for existing filenames, and that can be done by the OS. So darktable cannot modify a filename based on (meta)data from another file.

One option might be to have darktable add a sequence number if the proposed filename already exists. But that makes a mess when files are accidentally imported a 2nd time…


Note that you cannot fully rely on the order in which files are imported. It’s reasonable to expect import in filename order or by capture date, but that’s not mentioned in the manual.
In practice, import will be in order, unless files have been deleted in camera. That would leave “holes” in the directory listing, which can be filled in with later captures.

Yes, I was hoping for an automatic adding of letters for example (A,B,C…) at the end of files if they are already present on the disk. It works at the export stage (with numbers) and would be useful for import too.

Adding them on export just creates an extra file. Not really problematic in most cases.

Adding a sequence code on import means that when you import some files again by mistake, you add a duplicate image (un-edited), which means an extra file, extra entries in the database (with different metadata if you already added keywords, captions, etc), and possibly an extra sidecar. More work to clean up, and if you already made duplicate edits in dt from the first import, potentially very messy.

It can be done, but may require a bit more thought than just “file exists? add a sequence code…”

I might just be a chud, but I use the original file name to give uniqueness when renaming.

2 Likes

I use this:

$(EXIF.YEAR)$(EXIF.MONTH)$(EXIF.DAY)_$(EXIF.HOUR)$(EXIF.MINUTE)$(EXIF.SECOND)_$(JOBCODE)_$(SEQUENCE).$(FILE_EXTENSION)

If there are multiple images at the same second (same timestamp), the sequence number is different.