ExifTool Forum

ExifTool => Newbies => Topic started by: danjde on October 30, 2020, 07:02:49 AM

Title: Rightly format output data from remote image
Post by: danjde on October 30, 2020, 07:02:49 AM
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
Title: Re: Rightly format output data from remote image
Post by: Luuk2005 on October 30, 2020, 11:34:07 AM
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 -
Title: Re: Rightly format output data from remote image
Post by: danjde on October 30, 2020, 02:26:08 PM
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!


Title: Re: Rightly format output data from remote image
Post by: 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
Title: Re: Rightly format output data from remote image
Post by: StarGeek on October 30, 2020, 02:54:50 PM
See Common Date Format Codes (https://exiftool.org/filename.html#codes) for other codes for the -d (dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat)
Title: Re: Rightly format output data from remote image
Post by: 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.
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!

Title: Re: Rightly format output data from remote image
Post by: danjde on October 31, 2020, 02:44:18 PM
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 (https://exiftool.org/filename.html#codes) for other codes for the -d (dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat)


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