Bug 492941

Summary: Fractional seconds formatter value (zzz) not being read and applied to filename
Product: [Applications] digikam Reporter: Matt Baker <kde.bugs>
Component: AdvancedRename-fileAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version First Reported In: 8.5.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 8.5.0
Sentry Crash Report:
Attachments: Import view preview file name
Rename view file name preview
Test image

Description Matt Baker 2024-09-10 13:16:15 UTC
Created attachment 173526 [details]
Import view preview file name

SUMMARY

The fractional / sub seconds value of an image is not being read or applied to the filename. For example, with a format code of [date:"yyyy-MM-dd hh-mm-ss.zzz"], the zzz part is always 000 when displayed in the "New name" column and when applying the rename operation.

Note however, when in Import view, the fractional seconds element is correctly displayed in the example output field when selecting an image, but when applying the format, the value also goes to 000.

STEPS TO REPRODUCE - Renamer View
1. Select image
2. Press F2 / Rename
3. Enter [date:"yyyy-MM-dd hh-mm-ss.zzz"] into format / name field

OBSERVED RESULT - Renamer View
All image names in "New Name" column are 000 where zzz format specifier is used.

EXPECTED RESULT - Renamer View
The fractional seconds value is displayed and applied correctly.

-----

STEPS TO REPRODUCE - Import View
1. Import from a device
2. In the File Renaming Options section, enable Customise and set the field to [date:"yyyy-MM-dd hh-mm-ss.zzz"]
3. Click on any of the images and observe the previewed name in the File Renaming Options.

OBSERVED RESULT - Import View
Preview file name is correct with the zzz section showing fractional seconds, but the actual import and rename process results in 000 for the zzz section of the file name.

EXPECTED RESULT - Import View
Both previewed file name and actual file name match, and both have fractional seconds correctly read from the file.

SOFTWARE/OS VERSIONS
Windows 10 22H2 19045.4529

digiKam
Build date: 2024-09-04 13:02 (target: RelWithDebInfo)
Revision: 933e4d03eddd94118a8dd16b134f571342bc9bc0
Branch: master


ADDITIONAL INFORMATION
Mentioned in https://bugs.kde.org/show_bug.cgi?id=492007#c7
Comment 1 Matt Baker 2024-09-10 13:17:00 UTC
Created attachment 173527 [details]
Rename view file name preview
Comment 2 Maik Qualmann 2024-09-10 13:28:16 UTC
This is not a bug, only if a fractional second is present in the date in the DB, it can be adopted. The date usually comes from the original date in the metadata, but this rarely has a fractional second.

Maik
Comment 3 Matt Baker 2024-09-10 13:45:46 UTC
Thanks Maik. Okay, I can see your point of view for the renamer view but the import section seems like a bug:

"Note however, when in Import view, the fractional seconds element is correctly displayed in the example output field when selecting an image, but when applying the format, the value also goes to 000."
Comment 5 Maik Qualmann 2024-09-10 13:53:26 UTC
Please upload the image for testing.

Maik
Comment 8 Matt Baker 2024-09-10 14:07:05 UTC
Comment on attachment 173530 [details]
Test image

>https://1drv.ms/i/s!Ajr10IwsuvM9hNRmCdaMu-Iz1qxl4Q?e=oKLhNj
Comment 9 Matt Baker 2024-09-10 14:07:36 UTC
Comment on attachment 173530 [details]
Test image

<img src="https://1drv.ms/i/s!Ajr10IwsuvM9hNRmCdaMu-Iz1qxl4Q?e=oKLhNj">
Comment 10 Matt Baker 2024-09-10 14:11:41 UTC
Comment on attachment 173530 [details]
Test image

<!DOCTYPE html>
<html>
<head>
<title>Test image</title>
</head>

<body>
<a href="https://1drv.ms/i/s!Ajr10IwsuvM9hNRmCdaMu-Iz1qxl4Q?e=oKLhNj">https://1drv.ms/i/s!Ajr10IwsuvM9hNRmCdaMu-Iz1qxl4Q?e=oKLhNj</a>
</body>

</html>
Comment 11 Matt Baker 2024-09-10 14:12:18 UTC
Comment on attachment 173530 [details]
Test image

<!DOCTYPE html>
<html>
<head>
<title>Test image</title>
</head>

<body>
<a href="https://1drv.ms/i/s!Ajr10IwsuvM9hNRmCdaMu-Iz1qxl4Q?e=oKLhNj">https://1drv.ms/i/s!Ajr10IwsuvM9hNRmCdaMu-Iz1qxl4Q?e=oKLhNj</a>
</body>

</html>
Comment 12 Matt Baker 2024-09-10 14:13:53 UTC
Oh no. What a mess. I didn't realise editing an attachment created a new comment each time...

File is too large for upload. Link to file: https://1drv.ms/i/s!Ajr10IwsuvM9hNRmCdaMu-Iz1qxl4Q?e=oKLhNj
Comment 13 Maik Qualmann 2024-09-10 18:12:36 UTC
Git commit 5ff55ff03218bfc2d119e5251520cd68b40d220d by Maik Qualmann.
Committed on 10/09/2024 at 18:11.
Pushed by mqualmann into branch 'master'.

add support for fractional second when importing metadata

M  +1    -1    NEWS
M  +4    -0    core/utilities/import/main/importui.cpp

https://invent.kde.org/graphics/digikam/-/commit/5ff55ff03218bfc2d119e5251520cd68b40d220d
Comment 14 Maik Qualmann 2024-09-10 18:17:06 UTC
The general adoption of the fractional second into the database would not be a problem with SQLite. However, our MySQL database schema does not currently support time specifications with fractional seconds. This would require a major update for a MySQL database, so we will postpone this to a later digiKam version.

Maik
Comment 15 Matt Baker 2024-09-11 00:36:01 UTC
(In reply to Maik Qualmann from comment #14)
> The general adoption of the fractional second into the database would not be
> a problem with SQLite. However, our MySQL database schema does not currently
> support time specifications with fractional seconds. This would require a
> major update for a MySQL database, so we will postpone this to a later
> digiKam version.
> 
> Maik

Thanks Maik. I'll give this a try when the weekly build is ready.
Comment 16 Matt Baker 2024-09-17 22:09:20 UTC
Just tried the nightly build and it's now including the fractional data. Thanks!

However, the value shown in the preview doesn't match what is actually being used as the file name for some reason.

This is on the import view.
The following image shows 2024-09-17 20-49-53.160.JPG as the filename preview with the renaming option set to [date:"yyyy-MM-dd hh-mm-ss.zzz"], but when I import the file, it names it to 2024-09-17 20-49-52.449.JPG

Image: https://1drv.ms/i/s!Ajr10IwsuvM9hNUU-qDlR0n_8tpNXw?e=dbzJ93
Comment 17 Maik Qualmann 2024-09-18 05:45:38 UTC
The date view in the import tool can only be an approximate preview. It depends on the settings in the digiKam camera setup whether file metadata is read (makes the connection slower). Otherwise the date used comes from the file date.

Maik