Rightly format output data from remote image

Started by danjde, October 30, 2020, 07:02:49 AM

Previous topic - Next topic

danjde

Hi Devs!
I would like to obtain remote exif data and format the output as Italian convention (%d/%m/%Y).

I've try:

curl -s https://3x1t.org/Wqz4sXz/img/IMG_20201021_155424.jpg | exiftool -n -p '$datetimeoriginal' -fast -

But the output is as UK convention:

2020:10:21 15:54:26

How I give the italian output?


I know that it's a very silly question but that is the life..   :o

Many thanks!

Davide

Luuk2005

#1
Please not to use -n with -d 'DateFormat' because -n is prejudice against the DateFormat...
curl -s https://3x1t.org/Wqz4sXz/img/IMG_20201021_155424.jpg | exiftool -d '%d/%m/%Y' -p  $DateTimeOriginal  -Fast -

But if the -n is to be mandatory, then we can use..
%curl% -s https://3x1t.org/Wqz4sXz/img/IMG_20201021_155424.jpg | exiftool -n -p  '${DateTimeOriginal;s/^(\d{4}):(\d\d):(\d\d).*/$3\/$2\/$1/}' -Fast -
Windows8.1-64bit,  exiftool-v12.84(standalone),  sed-v4.0.7

danjde

Well Luuk2005!
I've try the second code and works fine, the first give me only the output "-fast".

Would you be kind enough to even tell me how get the date too, in format hour and minutes ->  "15:54"?

Many thanks!



Phil Harvey

You need the quotes around '$DateTimeOriginal' in the first command.  To add the time, do this:

curl -s https://3x1t.org/Wqz4sXz/img/IMG_20201021_155424.jpg | exiftool -d '%d/%m/%Y %H:%M' -p '$datetimeoriginal' -fast -

- 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 ($).

StarGeek

* 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).

Luuk2005

Lol, Phil and StarGeek are like the Flash! Im just coming to say the same things, since '$datetimeoriginal' is in your post.
Im Windows and not realized that -p in your shell needs quotes around $. The ugly way, but only if you needed -n for something else...
curl -s https://3x1t.org/Wqz4sXz/img/IMG_20201021_155424.jpg | exiftool -n -p  '${DateTimeOriginal;s/^(\d{4}):(\d\d):(\d\d) (\d\d:\d\d).*/$3\/$2\/$1 \4/}' -Fast -


So its easier to see that -d 'DateFormat' is much to be preferred!

Windows8.1-64bit,  exiftool-v12.84(standalone),  sed-v4.0.7

danjde

Quote from: Phil Harvey on October 30, 2020, 02:40:48 PM
You need the quotes around '$DateTimeOriginal' in the first command.  To add the time, do this:

curl -s https://3x1t.org/Wqz4sXz/img/IMG_20201021_155424.jpg | exiftool -d '%d/%m/%Y %H:%M' -p '$datetimeoriginal' -fast -

- Phil



WAW! Just what I was looking for Phil Harvey!

Quote from: StarGeek on October 30, 2020, 02:54:50 PM
See Common Date Format Codes for other codes for the -d (dateFormat) option


Thanks StarGeek, your information is very useful! I'll treasure this for the rest of my code ;-)



Quote from: Luuk2005 on October 30, 2020, 03:16:47 PM
Lol, Phil and StarGeek are like the Flash! Im just coming to say the same things, since '$datetimeoriginal' is in your post.
[...]

thank you too Luuk2005, burned on the photo finish :-D



Many  thanks to all! You were all very kind!


Davide