News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

HTTP Server alternative to stay_open

Started by sebutzu, June 10, 2023, 04:28:06 PM

Previous topic - Next topic

sebutzu

I am trying to use exiftool from C# with stay open true. I am running in all kinds of issues. I am not the only one wanting to use exiftool as a "library". I was just thinking if it would be easily possible to add a simple http server inside exiftool, so that instead of communicating via stdin, stdout for sending commands, you could communicate via http calls. Also in future maybe give access to more "internal APIs" of exiftool that are now available directly from PERL, via the http server option.

Phil Harvey

Wow, that sounds like a security nightmare ready to happen.

I don't know if I want to touch this idea.

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

sebutzu

So the only way to use exiftool from other pieces of code is using stay_open. Or are there other alternatives that I do not know of (without needing perl)? It is still very difficult for me to "communicate" with exiftool in a "standard" way by using stay_open...because using simple options is a nightmare for struct metadata, using -j -struct seems to work when reading tags (still not sure if all tags are kept in json or if duplicates they are skipped), but trying to write tags in json format does not work, so somehow I need to read json from the output stream of exiftool, but write something else, that is some kind of perl specific format if I want to set the value for a struct field using json format. It is quite a fight to make a simple read-write wrapper on top of exiftool. I am not sure what would be the best option, but I am quite hopeless.
I have not tried yet xml options instead of json...

Phil Harvey

All I can say is that you need to serialize structures when writing them via the command line.  The algorithm to do this is simple.  I wouldn't call it a nightmare.

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

Phil Harvey

#4
Just for the heck of it, I'll add a new API StructFormat option to allow reading/writing JSON-format serialized structures.

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

sebutzu

Thank you very much!
Will it be possible to set values in JSON format also for other tags that are not XMP - like keywords=["k1","k2"] ?
Would it be also possible to have the listx option available as JSON format (maybe called listj)?