Get keywords from multiple files

Started by Joanna Carter, October 15, 2020, 07:31:35 AM

Previous topic - Next topic

Joanna Carter

Greetings.

Going around in circles once again.

I need to get any keywords from files at a number of URLs.

Given that getting them from one is asynchronous, how do I do it for more than one URL? Construct a single command that contains multiple repetitions of the same command, each with their own URL?

Phil Harvey

Hi Joanna,

I guess you're referring to this previous post.

But I still don't understand your situation.  ExifTool doesn't deal with URL's, it deals with files, and you just put the names of all the files you want to process on the command line.  If the files aren't available all at the same time then you will need to run separate commands, but this may be done with a single instance of ExifTool using the -stay_open and -execute features.

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

Joanna Carter

Hi Phil

Well, I've used my Swift wrapper to call

exiftool -short -json -IPTC:Keywords JNA_0031.NEF and, as long as I only do it directly on one file, things seem to be fine.

However, when I have a list of files and call it in a tight loop (from the Swift code), the CPU starts to sweat and I sometimes end up with over 1000% CPU when retrieving from 5 files.

These calls are being made on a background thread.

If I call all the thread code without calling exiftool (returning dummy data), there is no problem.

This may or may not be a problem with ExifTool but, so far, it seems like it.

Any ideas?

Phil Harvey

It sounds like you are launching a new copy of exiftool for each file being processed, and that your system doesn't have the resources to handle this many copies of exiftool running.  You should

1. Avoid launching a new instance of exiftool for each file.  Instead use the -stay_open feature to re-use an instance after it processes each file.

2. Limit the number of concurrent exiftool processes.

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