integration with tags from OS X Mavericks

Started by pewang, October 24, 2013, 05:32:56 PM

Previous topic - Next topic

pewang

Is there a way to extract the tags created in OS X 10.9's (new) tag feature using exiftool?
Thanks
Jeremi

Phil Harvey

Hi Jeremi,

This would only be possible if the information is written to the file.  Does the file size change when you create a tag?  Or maybe the information is written in the file's resource fork, in which case ExifTool will report a different ResourceForkSize.  If it is in the file, a sample would be useful.  If it is in the resource fork, you would need to use a utility like Stuffit to preserve this when uploading.  You can either attach a sample here, or email it to me (philharvey66 at gmail.com).

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

pewang

Thanks so much for the swift reply,
Indeed and unfortunately, the file size doesn't change.
will look into it...
Thanks
Jeremi

fintelkai

I'm looking into ExifTool & OS X Mavericks as well. What I would like to do is to

1. read the Mavericks tags for PDF files (easiest for that is the tag tool at https://github.com/jdberry/tag)
2. use ExifTool to write the same tags as PDF keywords into the PDF file.

My issue: ExifTool when it modifies the PDF file wipes out the Mavericks tags.

Mavericks tags are stored as extended file attributes. And apparently ExifTool does not retain these when it creates a modified PDF file.

I have attached a sample pdf file (I have zipped it to try to protect the metadata). It has the Mavericks tags "sample" and "exiftool". These can be displayed in OS X on the command line as follows:

mdls -name kMDItemUserTags Sample.pdf

The output is:


MDItemUserTags = (
    sample,
    exiftool
)


In machine format, the tags can be displayed with

xattr -p com.apple.metadata:_kMDItemUserTags Sample.pdf

which results in


62 70 6C 69 73 74 30 30 A2 01 02 58 73 61 6D 70
6C 65 0A 30 5A 65 78 69 66 74 6F 6F 6C 0A 30 08
0B 14 00 00 00 00 00 00 01 01 00 00 00 00 00 00
00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 1F


When I run exiftool on the file, the extended attribute is wiped out. So, I run

exiftool -Keywords="sample, exiftool" Sample.pdf

This creates a new Sample.pdf (also in my zip archive as Sample-exiftool-modified.pdf), which has the keywords embedded in the pdf, as desired. But now there are no tags in the extended attribute anymore.

mdls -name kMDItemUserTags Sample.pdf

now returns


kMDItemUserTags = (null)


And

xattr -px com.apple.metadata:_kMDItemUserTags Sample.pdf

returns


xattr: Sample.pdf: No such xattr: com.apple.metadata:_kMDItemUserTags


My bug report/feature request: please do not wipe out OS X extended file attributes.

Phil Harvey

Quote from: fintelkai on December 20, 2013, 12:10:09 PM
My issue: ExifTool when it modifies the PDF file wipes out the Mavericks tags.

Did you try the -overwrite_original_in_place option?

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

fintelkai

Thanks, Phil, I just discovered this myself. Should have RTFM. Yes, -overwrite_original_in_place does it nicely for me. Awesome. I see a very useful new workflow coming together.