partly OT: KDE: Notification when plugging in camera (ptp) and RAW dl script

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

partly OT: KDE: Notification when plugging in camera (ptp) and RAW dl script

Sebastian Schubert-2
Hi,

I wrote a script to download the raw files from my ptp driven camera.
This is more convinient for me.  Especially, I can customize the naming
scheme (see below).

I want to have KDE 3.5.10 to offer me the possibility to just run this
script when plugging in the camera.  kde shows this auto-start menu I
want to adjust. Ok, I added another item to the 'camera' drop down menu
which should just start my script in a terminal.

The problem is that I only get an error:

Error - KIOExec
The file or folder / does not exist.

wtf? The script does not use anything from kde (only gphoto2 and
exif-tools), so the problem is definitly not the script but kde. The
script is executable.

Any idea?


Now a bit more on-topic: my ideal naming scheme looks like:

DATE-TIME-NUMBER.EXTENSION

in the folder

YEAR-MONTH/YEAR-MONTH-DAY

where DATE and TIME are taken from the capture date and time and number
is just the necessary number to differentiate between pictures taken in
the very same second in the TIME (and DATE) field.  It starts with 01
and increases if necessary (I guess there won't be >99 pictures per second in the
near future, so to digits will suffice...).  Maybe you want to add a
similar mechanism to digikam; the counter number which is offered on
0.9.4 has no real meaning AFAIKS...

The script:

#!/bin/bash

extension=CR2
FOLDER=/home/sebschub/Dokumente/Bilder/RAW


extensionLC=`echo $extension | tr "[:upper:]" "[:lower:]"`

echo Getting RAW files from camera

mkdir $FOLDER/temp
cd $FOLDER/temp

echo Temporary saving to $FOLDER/temp

gphoto2 --get-all-raw-data

for i in *.$extension; do
    # Datum fuer Dateinamen
    date_stamp=`exiftool -DateTimeOriginal -d "%Y%m%d-%H%M%S" $i`
    yyyymmdd_hhmmss=$(expr substr "`echo $date_stamp`" 22 36)

    # Datum fuer Verzeichnisse mit Bindestrichen
    date_stamp=`exiftool -DateTimeOriginal -d "%Y-%m-%d" $i`
    yyyymmdd=$(expr substr "`echo $date_stamp`" 22 32)
    yyyymm=$(expr substr "`echo $yyyymmdd$`" 1 7)

    mkdir -p ../$yyyymm/$yyyymmdd

    unique_num=1
    i_renamed="../$yyyymm/$yyyymmdd/$yyyymmdd_hhmmss-`printf "%02i" $unique_num`.$extensionLC"
    while [ -e $i_renamed ]; do
        unique_num=$[$unique_num+1]
        i_renamed="../$yyyymm/$yyyymmdd/$yyyymmdd_hhmmss-`printf "%02i" $unique_num`.$extensionLC"
    done
    mv $i $i_renamed
    echo "$i -> $i_renamed"
done

cd ..

rmdir $FOLDER/temp
echo Removing temporary folder $FOLDER/temp

echo FINISHED
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users