Anyone here ever scripted the exiv2 executable (in BASH)?
I've been trying to move a script that adds keywords from Exiftool (which seems to be getting slower -- natch; it's written in Perl) to Exiv2, 20+ times faster as it's written in 'good' (just ask the author) C++. But the issues I'm having are the following:
Code:
#!/bin/bash and to answer the question before it's asked: I have tried several times to "restore" (I was on it years ago) my credentials on Exvi2 Forum. I have even corresponded via email with Andreas Huggel, to no avail as of this date (30102018). Carver |
as far as I remember I suggested you to use shellcheck to check your script. Actually there is a serious issue, which might cause your problem. But first I would like to tell you I have no idea what is it all about. But I know it is not related to exiv2 at all, but the shell script itself. If you wish to see how it works please insert set -xv at the beginning and you will see how your lines are evaluated/understood by bash and also how are they really executed (which was told already too).
But return back to the error (what shellcheck found): Code:
Line 11: Code:
4 function dav () { Later you use $f but I have no idea if it was the right value or not... (you could easily check it with set -xv) |
Sorry, I forgot to mention that I ran shellcheck (both local and online), and it gives
Code:
SC2094: Make sure not to read and write the same file in the same pipeline. I will give set -xv a shot and see what it shows. Carver |
you still don't understand. You use the same variable $f for two different purposes. I'm really sure it is not what the script supposed to do.
(actually the shellcheck message is a bit misleading, it recognized there is something wrong, but the info is not really correct. Probably I will report it to the team). |
The line of code, as I understand it
Code:
while IFS="^" read -r f k The line Code:
/usr/bin/exiv2 --keep -M"add Iptc.Application2.Keywords $taxt" -M"add Xmp.dc.subject $taxt" "$f" I'm thinking the whole routine, maybe the whole script, makes use of a "false array" and that's why I still get odd bits of the string written as one and only one keyword. Example: the second word, blonde, in the test file I'm using was the only one written to the JPEG the last time I ran the script (using set -xv). Carver PS: Please do report the misinformation to shellcheck/github. I would appreciate it. |
Again, I think the problem is in that second line in function twokey, line 5 of the whole script. It keeps "picking" the first string after the first comma. I remember my original script (from years ago, not the one I posted here) had an echo showing which keyword was being added to foo.jpg. I added that echo and with a test file it echo'd one word (blonde, in this case).
Now I'm thinking of reverting to a bash 3 or earlier bash 4 method: invoking the comma as a second IFS, for the string of keywords. I just need a nudge in the right direction. Carver |
Solved elsewhere, with the help of one of the maintainers of exiv2.
Thanks all the same. Carver |
Quote:
Thank you. |
All times are GMT -5. The time now is 04:22 PM. |