![]() ![]() On Linux I have run this with 600 files, and it took 11. Windoze may have a problem with long lists of files, so you my need to do it using an argfile. 'STDOUT:' () if isinstance(res.stdout, bytes) else res.stdout) Res = n(batchup, capture_output=True)Įrrdata=('STDERR:\n' () if isinstance(res.stderr, bytes) else res.stderr exiftool will handle any number of files at a time, so to process a bunch of files, and extract specific metadata fields, this goes about 8 times faster on my laptop: def meta_for_batch(fieldlist, filelist):īatchup = fieldlist filelist ![]() This still turns up in searches, but using stay open etc, is barely faster than just running up subprocess individually for each file. directory find and execute on every document found. Print(json.dumps(tadata_lookup, indent=3)) tadata_lookup = self.get_metadata(FileLoc) Return json.loads(self.execute("-G", "-j", "-n", *FileLoc))įor dirname, dirnames, filenames in os.walk(locDir): > 30 (str.join("\n", args))ĪttributeError: 'ExifTool' object has no attribute 'process' return follow ERROR using Python 3.8.10 and IPYTHON Otherwise the program will hang because the while loop inside execute() won't stop The second is that you have to decode the byte series returned by os.read(): output = os.read(fd, 4096).decode('utf-8')ĮDIT for Windows: To get this working on Windows, the sentinel need to be changed into "\r\n" The first is an additional argument to subprocess.Popen: self.process = subprocess.Popen( To get this to work in python 3 two small changes are needed. This class is written as a context manager to ensure the process is exited if you are done. Return json.loads(self.execute("-G", "-j", "-n", *filenames)) Stdin=subprocess.PIPE, stdout=subprocess.PIPE)ĭef _exit_(self, exc_type, exc_value, traceback): ![]() I also included get_metadata() to read the metadata in JSON format: import subprocessĭef _init_(self, executable="/usr/bin/exiftool"): Here's a simple class that launches an exiftool process and features an execute() method to send commands to that process. ExifTool supports JSON output, which is probably the best option for reading the metadata. You can then send commands to the process via stdin, and read the output on stdout. Add -r to recurse into subdirectories.To avoid launching a new process for each image, you should start exiftool using the -stay_open flag. Add -overwrite_original to suppress the creation of backup files. You would either include an -ext for each possible filetype, or you could use -ext xmp (two dashes) to exclude the xmp files. The command needs the inclusion of the -ext (extension) option to avoid processing the XMP files themselves. So your command would be along these lines:Įxiftool -ext EXT -tagsfromfile %d%f.xmp xmp2exif.args -GPSLatitudeRef -GPSLongitudeRef -r DIR So this needs to be explicitly addressed. The reference directions (North/South/East/West) are supposed to be included in the XMP GPSLatitude/ GPSLongitude tags. These tags is not part of the Exif 2.31 metadata for XMP specification, which covers the GPS tags for XMP. Now, there's a problem with the XMP you list and that is the existence of GPSLatitudeRef/ GPSLongitudeRef. This will allow tags in the XMP file to be copied to the correct place in the EXIF group. The best thing to do would be to grab the xmp2exif.args file and place that in the same directory as exiftool. The command needs to be altered a bit due to some irregularities in the XMP sample you give. See exiftool's Metadata Sidecar Files example #15 I'm wondering if there is any way to import this kind of information into the raw/jpeg/whatever file or if there is a way to import such information using lightroom.Īny ideas are welcome, thanks in advance. The worst of this is the date of file, if you scan a picture 1 and then you set its real creation date (let's say 1), it will remain 1 and reflect it as photoshop:DateCreated tag in the XMP file. I've exported a big amount of pictures from iPhoto and apparently apple exports original file with a sidecar XMP file including the details. Pipe it into grep and get the YYYYMMDD and add hyphens to create YYYY-MM-DD. Pipe it into grep, get the Title, and add ' - ' to the end. Below is what I think needs to happen: Grab the filename. Not sure if this can be achieved with exiftool or if there's a better alternative. Desired metadata Title from filename: Title - YYYY-MM-DD. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |