exif direct from camera's SD to pc

Started by bowen73, May 08, 2017, 07:20:13 PM

Previous topic - Next topic

bowen73

Ive had some great help getting the exif to work from a folder and transfer to another etc,  but now just trying to streamline it....

currently i have:  exiftool -p -overwrite_original '-directory</home/pi/ftp/$gpsaltitude#' -@ ~/Documents/scan.txt ~/Pictures

this grabs images from a folder adds exif into and moves to another folder.  now im trying to skip a process and when a camera is plugged into the pi, it picks up the images from there.  (unless i have another script to move images from camera to the pictures directory)

when i plug the camera into the pi it shows as gphoto2://[usb:001,002]/  but when i put this location into the script instead of ~/Pictures i get an error saying the directory is not found??

sorry if its off topic, but thought its kinda related as im trying to exif from camera then transfer using exiftool.

thanks

Hayo Baan

That doesn't look like a valid file path to me... Have you already tried escaping the squared brackets and comma in that path? gphoto2://\[usb:001\,002\]/
Also, can you perform ls on that path? If so, exiftool should just work. If not, you'll first need to move the images to a location accessible by normal file commands.
Hayo Baan – Photography
Web: www.hayobaan.nl

StarGeek

Quote from: Hayo Baan on May 09, 2017, 01:32:37 AM
That doesn't look like a valid file path to me...

Yeah, looks more like an URL.  I'd suggest asking around the Pi forums. 
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

bowen73

that was when i plugged the camera in and said do i want to open an explorer window.  so it has the file structure etc and that is in the top bar for the location.

Ive since found this script and it does work and downloads the images from the camera....but i have no idea where as i cant find where its put them!  :-s  when i run it again it says the file already exists and do i want to overwrite??  but they are no where to be found!  any idead??


01 #!/bin/bash
02 DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
03 while [ -z ${DEVICE} ]
04         do
05         sleep 1
06         DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
07 done
08 cd /media/usb0/
09 mkdir "`date --iso-8601`" && cd $_
10 gphoto2 --get-all-files
11 exiftool -r -d %Y%m%d-%H%M%S.%%e "-FileName<DateTimeOriginal" .

Phil Harvey

Quote08 cd /media/usb0/
09 mkdir "`date --iso-8601`" && cd $_

Try looking in /media/usb0/DATE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bowen73

Quote from: Phil Harvey on May 09, 2017, 08:08:40 AM
Quote08 cd /media/usb0/
09 mkdir "`date --iso-8601`" && cd $_

Try looking in /media/usb0/DATE

- Phil

doh!  :-[

i think i looked there before and presumed it was the mounted camera not the transfered files.  even did a search for all files containing dsc and returned nothing...    feeling rather stupid now...haha   so i better change the cd/media/usb to a location then.  i thought the script would drag the images of the camera and follow the exif function not move them then move again as i wanted to erase the images from the camera when processed, but at least i know now :-)

bowen73

now ive hit another snag...

#!/bin/bash

DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
while [ -z ${DEVICE} ]
        do
        sleep 1
        DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
done
cd /home/pi/Pictures
gphoto2 --get-all-files --force-overwrite
exiftool -p -overwrite_original '-directory</home/pi/ftp/$gpsaltitude#' -@ /home/pi/Documents/scan.txt /home/pi/Pictures

cd /home/pi/ftp

#Start FTP Process

ncftp -u username -p password 172.24.60.141 << EOF
put -r *
bye
EOF

rm -rf /home/pi/ftp/*


i am getting this error and all i've added is the gphoto to grab the images from the camera

Warning: [minor] Tag 'gpsaltitude' not defined -

Phil Harvey

Quote'-directory</home/pi/ftp/$gpsaltitude#'

This requires that GPSAltitude tag exists in the file.  If it doesn't you will get the warning you are seeing.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bowen73

Quote from: Phil Harvey on May 09, 2017, 10:36:46 AM
Quote'-directory</home/pi/ftp/$gpsaltitude#'

This requires that GPSAltitude tag exists in the file.  If it doesn't you will get the warning you are seeing.

- Phil

is that the file as in the image?  i thought the exiftool would create and add the tag that it pics up from the txt file,  unless i need to change the commands the other way around so it adds the tag before creating a folder to move them into, otherwise where isnt a tag to read?

Phil Harvey

Yes.  GPSAltitude must exist in the image file.  If you want to define a dynamic tag for immediate use, you can add a line like this to your scan.txt file:

-userparam
mytag=12.345


then do this on the command line:

'-directory</home/pi/ftp/$mytag'

but in this case, you might just as well do this in scan.txt:

-directory</home/pi/ftp/12.345

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).