Bug 331194

Summary: SCAN : prevent trailing white spaces in camera model/maker names [patch]
Product: [Applications] digikam Reporter: Romain Henriet <romain.pub>
Component: Database-ScanAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 3.5.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.0
Attachments: MakeModelTrimmed.patch

Description Romain Henriet 2014-02-16 16:59:54 UTC
I tried to use Focal analysing script and it generated 2 pages for my Pentax K-x and 2 pages for my Samsung NX1000. 
After searching why, I discovered that some photos have camera model "K-x" and some others have model "K-x   "  (with trailing spaces). The same for "NX1000" and "NX1000  ".
Maybe Digikam should remove trailing and leading spaces before registering fields in database.

Reproducible: Always

Steps to Reproduce:
1. Open "advanced search" dialog
2. Reset search options
3. In "Model" field, type "K-x" and press the "Try" button
4. Result contains about 1000 photos
5. Now, type "K-x "   (one trailing space) in "Model" field and press the "Try" button again
6. Result contains about 150 photos
Comment 1 caulier.gilles 2015-05-10 18:33:45 UTC
Can you provide a some sample images to test. Please share files through web service, not KDE bugzilla which is limited about file size attachments. 

Gilles Caulier
Comment 2 caulier.gilles 2015-05-10 18:38:08 UTC
Maik,

Here i think patch will be simple to register formatted camera info in database.

I already do the job for Image Properties and Tooltips view, but it's only to show info in GUI, not to register data in DB. Look here :

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/libs/imageproperties/imagepropertiestab.cpp#L835

Gilles
Comment 3 Romain Henriet 2015-05-17 13:31:16 UTC
Hello,
here are two photos : http://dl.free.fr/llYqGUTRT
"111215_Chat_1.jpg" is found with "K-x" and "K-x ".
"140907_Fougères_17.jpg" is only found with "K-x".
Comment 4 Maik Qualmann 2015-05-18 17:42:06 UTC
Created attachment 92689 [details]
MakeModelTrimmed.patch

This patch removes spaces at the beginning and end of camera make and model, when reading the metadata from the image into the database.

Note: A rescan of the metadata with the maintenance tool is obliges to update the database.

Maik
Comment 5 caulier.gilles 2015-05-18 18:14:57 UTC
Patch sound fine for me...

Gilles
Comment 6 Maik Qualmann 2015-05-18 19:24:34 UTC
Git commit af054ea68f3afc3a4f265e7a825a4885781d563e by Maik Qualmann.
Committed on 18/05/2015 at 19:18.
Pushed by mqualmann into branch 'master'.

apply patch #92689 to remove trailing white spaces in camera make and model
FIXED-IN: 4.11.0

M  +2    -1    NEWS
M  +8    -2    libs/dmetadata/dmetadata.cpp

http://commits.kde.org/digikam/af054ea68f3afc3a4f265e7a825a4885781d563e
Comment 7 caulier.gilles 2015-05-18 20:54:28 UTC
Git commit 0fe7437395ba1b55814c47889c2371b3f49ca88e by Gilles Caulier.
Committed on 18/05/2015 at 20:53.
Pushed by cgilles into branch 'frameworks'.

backport commit #af054ea68f3afc3a4f265e7a825a4885781d563e from git/master to framework branch

M  +8    -2    libs/dmetadata/dmetadata.cpp

http://commits.kde.org/digikam/0fe7437395ba1b55814c47889c2371b3f49ca88e