The %filename var used in the import script seems to not work as intended

Paweł Breguła pawel.bregula at pabre.pl
Sat Jun 15 23:11:55 BST 2024


Hello,

I'm struggling with custom script for image import. I had this working 
in the past (2+ years back, cannot remind exactly when, and IIRC that 
was on Windows, now I'm on Linux).
I've been trying with digiKam 8.2.0 and 8.3.0 - with the exact same result.
What I'm trying to achieve is to import images from a directory - only 
jpeg's, renaming them on the fly, and copying raw files to another 
directory (and also rename them accordingly).
I use the Import -> Add Images. Then I select JPG/TIFF on the bottom 
selector. Then in the right tab: Settings - for the rename I have 
something like:
ALBUMNAME-[date:"yyyyMMdd-hhmmss"]{unique}.[ext]{lower}{removedoubles}
and for the Scripts:
~/digikam-raw-archive.sh "%orgpath" "%orgfilename" "%filename"
And I have the rotage jpegs automatically also selected.

The script itself:

#!/bin/bash RAWDIR=/something/RAW fp="$1" orgfilename=$(basename -- 
"$2") ext="${orgfilename##*.}" fn="${orgfilename%.*}" 
filename=$(basename -- "$3") ext2="${filename##*.}" fn2="${filename%.*}" 
if [ -f "${fp}${fn}.PEF" ]; then cp "${fp}${fn}.PEF" 
"$RAWDIR/${fn2}.pef"; fi #Pentax if [ -f "${fp}${fn}.CR3" ]; then cp 
"${fp}${fn}.CR3" "$RAWDIR/${fn2}.cr3"; fi #Canon if [ -f 
"${fp}${fn}.RW2" ]; then cp "${fp}${fn}.RW2" "$RAWDIR/${fn2}.rw2"; fi 
#Panasonic exit 0


And the issue is, that the %filename in that case is not the renamed 
filename (which I believe it was some time ago), but e.g.:
Camera-dwflqi-c0640a26.digikamtempfile.P1000194.rw2

I was thinking, maybe the "rotate jpegs on the fly" is responsible, but 
no - disabling it has no effect.
jpegs are imported with correct "renamed" name (although, when importing 
a large number of them, I can see, that at first, they are imported to 
the destination directory with those "digikamtempfile" name, and are 
renamed later on).

Is this how this should work? I'm not sure if this is a bug worth 
submitting, or feature, or I'm simply doing something wrong...

Best regards
PaBre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/digikam-users/attachments/20240616/59420cb2/attachment.htm>


More information about the Digikam-users mailing list