Collecting, filtering, sorting in DT by version number

Is there a way to create a collection filter or any other way to use version # to narrow down a collection? For instance, If at some point in time created many duplicates of many different images, and at a later time want to find only the duplicates, how can that be accomplished?

I see this was posted previously Collections: filter on duplicate version #? but I’m resurrecting the question since it doesn’t seem to have been answered and I have the same question (I tried to reply on that post but I don’t know what happened, so I deleted my reply there).

dt 5.2, Windows 10.

At some point in time there seems to have been a way to have a collection by version simply by going to the metadata editor > preferences > add ‘version’ and enabling it to make it visible within the collection module. I enabled every metadata item with the word “visible” in it, and they all appear in the collections’ metadata section, but the only drop-down that appears for every item with the word “version” is “not defined”.

Is there an answer/hack/workaround/LUA script/etc. to do this?

dt 5.2, Windows 10.

At some point in time there seems to have been a way to have a collection by version simply by going to the metadata editor > preferences > add ‘version’ and enabling it to make it visible within the collection module. I enabled every metadata item with the word “visible” in it, and they all appear in the collections’ metadata section, but the only drop-down that appears for every item with the word “version” is “not defined”.

Is there an answer/hack/workaround/LUA script/etc. to do this?

1 Like

I just encountered a case where this functionality would be nice to have and had the same question.

I tried using the version metadata you mentioned and it seems to work for me, I just had to add the version name manually.

If you name the version something searchable and distinct enough like “version2” you can search for this value in the collection rules with new rule → metadata → search.

This is “good enough” for me but having to remember to add a version manually is something I’m definitely going to forget.

Otherwise…

I threw together a quick and dirty lua script that will just print out any duplicates. It’s not elegant though. It sorts the entire images database by filename and then ID and iterates through them and compares the current filename and ID to the previous filename and ID. It’s a big assumption that the lowest ID will always be the original, I don’t know if that’s always true.

I think these can be displayed in the lighttable. It might be possible to only apply this to the current collection rules, then you can just show duplicates in whatever other filters you’ve applied.

This is a seriously rough attempt but feel free to mess with it. I’ll maybe keep working on it to make it nicer to use if the above ideas are possible.

duplicate_finder.zip (2.7 KB)

2 Likes

Thanks for taking the time to put together a LUA script – it worked as advertised. I have since figured out that most of what I need to do can be done using the collections module and choosing “group” in the darktable section at the bottom. This shows all of the files which have a duplicate, grouping them by the group leader number (the group leader’s ‘image id’ is the group number. In parentheses to the right of the group number is the number of images in the group—if 4 copies were made of the original, the number would be ‘5’ = 1 original plus 4 copies.

If your LUA script could also group then sort by group id, that might be helpful. Having a list to copy and paste into a text file might come in handy for reference?

1 Like

Looking again with some fresh eyes and not late night bleariness, boy I didn’t notice some of the things in the data.

I didn’t connect the dots that the group Id is the original image, so that’s more helpful for the sorting and such. There’s also a version column that seems to increment for each duplicate.

So finding those duplicates is probably even easier than I thought in some cases. For my use case from the other night, I don’t actually care what the originating images are, I just want to see anything that is a duplicate.

I’ll try to mess around with this some more when I have some free time. I’ve been enjoying making a few lua scripts for some wacky use cases.

2 Likes