Bug 318357 - GROUP : group by regular expression [patch].
Summary: GROUP : group by regular expression [patch].
Status: CONFIRMED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-ItemGroup (show other bugs)
Version: 7.0.0
Platform: Other All
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
: 121310 457415 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-14 18:21 UTC by Christoph Anton Mitterer
Modified: 2023-08-01 15:13 UTC (History)
16 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Implement "group by regex" menu item and configuration dialogue (17.50 KB, patch)
2014-01-27 23:24 UTC, kde
Details
Screenshot of the "group by regex" context menu item (51.36 KB, image/png)
2014-01-27 23:25 UTC, kde
Details
Screenshot of the "group by regex" configuration dialogue (121.02 KB, image/png)
2014-01-27 23:27 UTC, kde
Details
Implement "group by regex" menu item and configuration dialogue (17.50 KB, patch)
2014-02-17 19:56 UTC, kde
Details
Implement "group by regex" menu item and configuration dialogue Boost-regex is used in favour of Qregex since Boost features real PCRE syntax (including greedy/non-greedy selection that doesn't need to be hardcoded into the application). (17.78 KB, patch)
2014-05-13 19:29 UTC, kde
Details
remerged patch against 4.5 (18.60 KB, patch)
2014-10-13 22:53 UTC, kde
Details
Screenshot of the "group by filename" configuration dialogue (94.58 KB, image/png)
2015-01-19 21:58 UTC, kde
Details
Screenshot of the "group by filename" context menu item (81.46 KB, image/png)
2015-01-19 21:59 UTC, kde
Details
remerged "group by filename" patch against 4.7 (22.18 KB, patch)
2015-01-19 22:01 UTC, kde
Details
Updated patch for the frameworks branch (23.24 KB, patch)
2015-03-31 21:25 UTC, Ulf Rompe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Anton Mitterer 2013-04-14 18:21:56 UTC
Hi.

It seems that one can already group images together in digikam, but this happens only manually (e.g. selecting them and then tell it to group them).

What I'd like to see is regular expression (ideally PCRE) based grouping rules. Perhaps even on a per folder basis (maybe with subfolders inheriting the rules from parent folders, if none are explicitly set or cleared).

WIth that one could easily do things like:
a) Group images:
foo\..+

b) a) Group images:
foo\.raw
foo\.jpeg
foo\.jpg
but no others

c) Group images:
foo\..+
but not
foo\.png

d) mightier things like, group
foo(-.+|).*
which I'd find handy cause I use about the following system:
The base image (typically the raw) is called after it's SHA1, e.g.
c5da46c6497eebe7634a6a02279490e9bbcb5efe.raw
images derived from it (e.g. JPEGs) have some string attached
c5da46c6497eebe7634a6a02279490e9bbcb5efe-foobarWhatever.jpeg

Now two problems come up.
1) Obviously we can't write "foo" in the regexps to mark the characters that should be identical on all grouped images.
I would probably solve this by adding a field, which of the subpatterns (i.e. the stuff in "(...)" ) needs to be identical.
This way one could e.g. write:
"^(.*)\.(jpeg|jpg|raw)$";1
To tell, for a file to be grouped, subpattern 1 must be identical and apart from that any file ending with a dot . and jpeg, jpg or raw.
Or my example above with the hashsums:
"^(.*)(-.+|)\.(jpeg|jpg)$";1
To tell, for a file to be grouped, subpattern 1 must be identical, and either followed by a dash - and one or more arbitrary characters (or by nothing)... and then followed by a dot . and followed by some extensions.


2) There need to be a way to select the "primary" image, i.e. those which is opened to be viewed, or from which tumbnails are created, etc.
Either one could do this by another regexp and/or by file flags like "most recently created/modified".


Of course all that would be quite a complex system, on the other hand I think it would be worth it, as it allows for very mighty grouping mechanisms to be used.


Cheers,
Chris.

Reproducible: Always
Comment 1 Christoph Anton Mitterer 2013-04-15 13:03:39 UTC
One way for having such stuff per directory would be to add .digikam files with such configurations in such directories :)
Comment 2 kde 2014-01-27 23:17:20 UTC
We just finished implementing a somewhat similar feature called "Group Selected Images By Regex" - see the following post:

https://plus.google.com/107260423308980038020/posts/2RNd1c9YksN
Comment 3 kde 2014-01-27 23:24:35 UTC
Created attachment 84861 [details]
Implement "group by regex" menu item and configuration dialogue

Boost-regex is used in favour of Qregex since Boost features real PCRE syntax (including greedy/non-greedy selection that doesn't need to be hardcoded into the application).
Comment 4 kde 2014-01-27 23:25:57 UTC
Created attachment 84862 [details]
Screenshot of the "group by regex" context menu item
Comment 5 kde 2014-01-27 23:27:10 UTC
Created attachment 84863 [details]
Screenshot of the "group by regex" configuration dialogue
Comment 6 Christoph Anton Mitterer 2014-01-28 00:47:29 UTC
Hey.

I think you really should consider to make this per-directory configurable... like I proposed by storing it in a .digikam file or so,... or perhaps also via XATTRs (XATTRs alone are not enough, since these are not usable in all cases).
And one should probably make such setting _optionally_ inheritable to subdirectories (unless another .digikam file overrides again.

Also, I think (2) form above is not possible right now, right?

Cheers,
Chris.
Comment 7 kde 2014-02-17 19:56:20 UTC
Created attachment 85200 [details]
Implement "group by regex" menu item and configuration dialogue

remerged patch
Comment 8 kde 2014-05-13 19:29:25 UTC
Created attachment 86614 [details]
Implement "group by regex" menu item and configuration dialogue Boost-regex is used in favour of Qregex since Boost features real PCRE syntax (including greedy/non-greedy selection that doesn't need to be hardcoded into the application).
Comment 9 Jasper 2014-10-09 10:43:18 UTC
The patch cannot work against dk git as albumsettings.cpp does not exist (for example). Any chance of an updated patch, or better, inclusion in digikam?
Cheers
Comment 10 kde 2014-10-13 22:53:09 UTC
Created attachment 89119 [details]
remerged patch against 4.5

Implement "group by regex" menu item and configuration dialogue Boost-regex is used in favour of Qregex since Boost features real PCRE syntax (including greedy/non-greedy selection that doesn't need to be hardcoded into the application).
Comment 11 Jasper 2014-10-14 00:34:34 UTC
Thanks for the patch.
 I am a regex NooB, so not sure if the failure to group images is due to my lack of understanding, or digikam being buggy atm (<1 min unresponsive..).
 I tried:
^.\..$
to group jpg and raw together.  But no change 8(
 My asumption was that having selected a whole bunch of images the jpg's and the cr2's would be grouped.

Trying to understand how the above regex creates the group with http://regex101.com/r/gT3vD6/1  but failing 8)

Also tried one from the history... no change (not suprised there 8)

This is an essential feature IMHO if _only_ to group jpg and raw, not to mention what else you must be able to do! What do we need to do to help support this becoming part of mainline as a user?
Cheers
Comment 12 kde 2015-01-19 21:58:54 UTC
Created attachment 90528 [details]
Screenshot of the "group by filename" configuration dialogue
Comment 13 kde 2015-01-19 21:59:58 UTC
Created attachment 90529 [details]
Screenshot of the "group by filename" context menu item
Comment 14 kde 2015-01-19 22:01:46 UTC
Created attachment 90531 [details]
remerged "group by filename" patch against 4.7
Comment 15 caulier.gilles 2015-01-29 08:01:54 UTC
As i don't recieve a reponse from your post on mailing list, i CC my message in this file :

As i already said, I'm not favorable to include Regular Expression
rules in digiKam GUI. It's not users friendly. Using RegEx in source code is not a problem of course.

For the rest of features, there is no problem...

digiKam for KDE4 is frozen for new features (git/master). Only bugfixes will be introduced in this code. This want mean that patch must be adapted to "frameworks" git branch, where new features are introduced. Details about digiKam for KF5 can be found here :

https://techbase.kde.org/Projects/Digikam/CodingSprint2014

- Patch must be ported to pure Qt5. You must drop KDE API use in your patch. The
plan is to limit KDE dependencies in digiKam later, in goal to make it more portable in the future.

Gilles Caulier
Comment 16 Christoph Anton Mitterer 2015-01-29 23:48:45 UTC
(In reply to Gilles Caulier from comment #15)
> As i don't recieve a reponse from your post on mailing list, i CC my message
> in this file :
Whom do you mean?
 
> As i already said, I'm not favorable to include Regular Expression
> rules in digiKam GUI. It's not users friendly.
I don't really see any problem... one can either disable the feature per default or provide a default which will work for many users (e.g. to group same name with different .ext).

Since digikam strives to be a professional photo management/collection software, I think a feature like the regexp-based grouping is really important (since all pros have their pics usually in different "versions".

> Using RegEx in source code is
> not a problem of course.
Which makes the whole thing basically uninteresting, when it's a) just a patch never merged (and thus never gets into distros) or b) there is just one set of rules (which like doesn't fit what one wants.


Cheers,
Chris.
Comment 17 Ulf Rompe 2015-03-31 21:25:50 UTC
Created attachment 91835 [details]
Updated patch for the frameworks branch

The patch has been updated to use KF5/QT5 and the frameworks branch.
Comment 18 Christoph Anton Mitterer 2016-06-12 03:03:39 UTC
Hey.

Anything new on this? Any chances to see that implemented?

I think any concerns about this being allegedly not user friendly can be easily resolved by hiding it per default under some "advanced" options or whatever.

Cheers,
Chris
Comment 19 john 2016-08-13 12:38:40 UTC
As i understood it i thought this patch was added to digikam 5, so i compiled from source but i don't see it in context menu?

Being able to group by filename is a no brainer, why is this not merged/included in 5.0.0 ?
Comment 20 Karsten de Freese 2017-04-02 10:48:54 UTC
*** This bug has been confirmed by popular vote. ***
Comment 21 Martin 2017-06-09 20:15:10 UTC
Are there any news? It would nice if I export a image from darktable for example digikam should understand that and add to the group automatically
Comment 22 Caio S. Souza 2018-03-24 15:09:19 UTC
This is a must have feature when working with multiple versions of the same photo developed on external software (like Darktable). I have files like filename.nef, filename_v1.tiff, filename_v2.tiff, filename_v1.jpeg, filename_v2.jpeg. It'd be much easier to manage these versions if they were grouped together automatically.
Comment 23 Martin 2020-02-14 19:36:11 UTC
Are there any news?
Comment 24 Thomas Steffen 2020-05-02 17:07:07 UTC
It would be great if you could automatically group JPG and RAW of the same image instead of having to do it manually every time!
Comment 25 caulier.gilles 2022-01-21 03:31:06 UTC
*** Bug 121310 has been marked as a duplicate of this bug. ***
Comment 26 Xtal 2022-07-14 00:38:11 UTC
Is this feature ever going to be added?  I've been hoping for this for years.

This is the one-and-only reason I'm still using Lightroom to manage all my files, I'd love to ditch it entirely, because Digikam does everything else I need for file management already, and it's so much faster than Lightroom.

I'm aware that you can do it on a per-folder basis, but that's way too tedious when you're navigating 100s of folders, especially if you want to disable it for a bit, and having to constantly check which folder is in which view individually.

Just after a simple global toggle to group RAW+JPG as shown in the screenshot from 2015: https://bugsfiles.kde.org/attachment.cgi?id=90528
Comment 27 Maik Qualmann 2022-07-14 08:28:21 UTC
I checked the patch again. This patch never automatically grouped the items in the view to RAW and JPG. As now, the items must be selected manually. So the same behavior as it is now also available. You can select all items in the view and choose group by filename.
The patch cannot be applied due to the changes in the current code and for the reasons mentioned (use of Boost and regular expression for end users).

Maik
Comment 28 Martin 2022-07-14 10:38:00 UTC
@Maik if I update the patch and make it more userfriendly would it be accepted even if there is regular expression?

It could be added also two test fields so the user can directly test if the regular expression is working or not
Comment 29 kde 2022-07-14 10:52:15 UTC
Dreams would come true.

Btw. if I remember well the original patch allows to select as many pictures as you want, chose group, and all the related ones are recognized.

Best regards, Sebastian
Comment 30 Maik Qualmann 2022-07-14 11:29:10 UTC
(In reply to kde from comment #29)
> Dreams would come true.
> 
> Btw. if I remember well the original patch allows to select as many pictures
> as you want, chose group, and all the related ones are recognized.

The current implementation of grouping of file names, does exactly the same, you can select as many items as you want and only the items with the same basis name are grouped and the smallest item with the file size is determined as the leader thumbnail.

For example, the patch would enable the grouping of versioned files.

This patch does not allow automatic dynamic grouping in the view. Which I would reject at the moment. Since we would have too many string comparisons with many items and this would slow down the view.

A automatic grouping during import via the import tool could be implemented without problems by the current changes in digiKam-8.0.0.

Maik
Comment 31 Maik Qualmann 2022-07-14 11:41:54 UTC
@Gilles, regular expression in the GUI with preview? Difficult. I don't know anyone who deals with photography and who could write a regular expression. May certainly give more users in the Linux world.
I would prefer selectable predefined actions in a combo box, e.g. grouping for Lightroom, grouping for Darktable etc.

Maik
Comment 32 caulier.gilles 2022-07-14 11:48:06 UTC
Hi Maik,

Well perhaps in Darktable, but as i hate the Darktable GUI, i will not investigate.

KPhotoAlbum has something based on regular expression to query the database in the past. I'm not sure if this feature still exists.

Else, proprietary program don't use regular expression, as i know.

In all case, regular expression is a not intuitive excepted for the experts. I work under Linux since 35 years now, my skill is at a good level, but i never be fluent with regular expression. It's a powerful but a complex programing language which is out of scope for digiKam.

And, yes, most of users want simple options which hide regular expressions used in background.

Regular expression go in opposite of GUI ergonomic rules.

Gilles
Comment 33 kde 2022-07-14 12:37:37 UTC
Hello,
@Gilles, in my eyes Digikam is a very professional tool - so it should not hurt to have some kind of regular expression possibilities somewhere in the settings. 
The fact that we don't find so much Regular Expressions in proprietary software should not stop us from equipping open source software with them. So please be open-minded - even if you personally don't use regex.
Predefined grouping possibilities is also a very good approach - Darktable should be supported in any case.
Best regards, Sebastian
Comment 34 Martin 2022-07-14 14:10:38 UTC
@Maik if I update the patch and make it more userfriendly would it be accepted even if there is regular expression?

It could be added also two test fields so the user can directly test if the regular expression is working or not
Comment 35 Christoph Anton Mitterer 2022-07-14 22:55:14 UTC
There could simply be a default regexp which groups files with any known picture extensions together, so anyone not familiar with them could just switch the option on and use the default, while anyone needing more powerful stuff could customise the regexp.
Comment 36 caulier.gilles 2023-05-02 07:31:02 UTC
*** Bug 457415 has been marked as a duplicate of this bug. ***
Comment 37 Xtal 2023-06-28 03:37:44 UTC
I've put in a request for a feature to simply make the existing "group by filename" feature more usable via a keyboard shortcut: 

https://bugs.kde.org/show_bug.cgi?id=471521

I know it doesn't replace this issue here, but might be useful to any of you who simply want an easy way to group JPG + RAW.

So please give it some votes if you would also like that keyboard shortcut added too.
Comment 38 Jan van Bekkum 2023-06-28 05:04:59 UTC
The proposed change wouldn't help me. I want to group filenames generated by an Insta360 ONE X2, for example
LRV_20220908_074532_11_397.insv
VID_20220908_074532_00_397.insv
VID_20220908_074532_10_397.insv

In general XXX_YYYYMMDD_HHMMSS_XX_nnn.insv

However, grouping by time does the job for me. Therefore I have no longer an issue.
Comment 39 Christoph Anton Mitterer 2023-07-01 22:38:31 UTC
I still think that allowing the full power of selection via regular expressions for experts would be very desirable, while at the same time there should be some presets or so, that allow usage by average users not familiar with regexps (e.g. grouping by filename extension... maybe even for both only the final one, that is everything after the last `.`, or any, that is everything after the first `.`).
Comment 40 Jan van Bekkum 2023-07-06 06:33:04 UTC
I ran into a second use case for which I would love this functionality.

I need to create proxy files of my video clips for smooth editing. They contain the same information as the original file, but with lower bitrate and lower resolution. The original file has name XXXXX.MOV, the proxy becomes XXXXX.MOV.mxf. I would like to group both files in bulk (one movie may contain 200 clips) to be able to systematically give the original clip and the proxy the same tags and labels, without entering tags and labels twice.
Comment 41 Maik Qualmann 2023-07-06 19:14:48 UTC
Git commit e0a28a41593d2cc7258a1518cb29a0d8192acef3 by Maik Qualmann.
Committed on 06/07/2023 at 19:14.
Pushed by mqualmann into branch 'master'.

group by file names use only the base name

M  +3    -3    core/app/items/utils/itemviewutilities.cpp

https://invent.kde.org/graphics/digikam/-/commit/e0a28a41593d2cc7258a1518cb29a0d8192acef3
Comment 42 Maik Qualmann 2023-07-06 19:16:55 UTC
The commit will now also group XXXXX.MOV and XXXXX.MOV.mxf. Available from digiKam-8.2.0.

Maik
Comment 43 Maik Qualmann 2023-08-01 15:13:04 UTC
*** Bug 472881 has been marked as a duplicate of this bug. ***