[Originally posted by janfri on 2008-08-18 18:05:11-07]Hello!
In the output of the exiftool comandline-application there is no distinction between the field separator comma and a comma in the value of a list tag. For example
# setting 3 values
$ exiftool -keywords='foo' -keywords='bar' -keywords='baz' some_file.jpg
# setting 2 values, one with a comma
$ exiftool -keywords='foo' -keywords='bar, baz' another_file.jpg
# the output is identical
$ exiftool -keywords some_file.jpg
Keywords: foo, bar, baz
$ exiftool -keywords some_file.jpg
Keywords: foo, bar, baz
It would be nice if the comma in the value would be escaped for example with a backslash. So the second example would return
Keywords: foo, bar\, baz and can be distinguish from the first.
Btw. The output of the commandline-application is very well structured and super simple to parse. Thanks a lot.
Best regards
Jan Friedrich
[Originally posted by exiftool on 2008-08-18 18:17:20-07]
Hi Jan,
You can use the -b option to extract a single specific tag,
then a newline is used to separate different items.
Other than that, you can also write a bit of Perl yourself
to use the exiftool libraries and output the information
in any form you want.
- Phil
[Originally posted by janfri on 2008-08-18 18:46:26-07]Hello Phil,
thanks a lot for your fast reply. Both of your solutions will work in most cases but for my context it doesn't really help:
I've written a Ruby library which parses the whole output of exiftool for a specific file and encapsulates it into a Ruby object. (You can find it on
Rubyforge or
Gitorious.org.)
The main point is that all new tags of a new exiftool version are supported immediately without adapting the Ruby code. :-)
Therefore I don't want to parse some tags (Keywords, SupplementalCategories, ...) in a special way and using the -b option isn't practicable.
On the other side I don't want to write an additional piece of code which a user of my library has to install. At the moment he has only to install the exiftool commandline-application and my Ruby lib and it works, even on Windows systems.
Ok, if you don't want to escape the comma how about a commandline option for getting multiple lines of list values? For example
Keywords: foo
Keywords: bar, baz
Regards,
Jan
[Originally posted by exiftool on 2008-08-19 18:46:06-07]
Hi Jan,
I try to avoid adding addition options unless I can see no other
recourse. ExifTool is already too complex, and each additional
option means more documentation to confuse the average user.
Having said that, a -sep option to specify the separator
to use in lists would be perfect for you. I have had this request
before, so I will weigh the pros and cons of adding a new option.
Give me a while to think about this.
- Phil
[Originally posted by janfri on 2008-08-28 17:55:02-07]
Hi Phil,
thanks a lot for the new -sep option in version 7.41.
Regards
Jan