Skip to content

Access macOS Spotlight metadata on files from Python. Also includes JSON data for all common metadata keys.

License

Notifications You must be signed in to change notification settings

RhetTbull/macos_mditem_metadata

Repository files navigation

Common Metadata Attributes accessible on macOS via MDItemCopyAttribute

This repository contains a set of JSON files that describe the metadata attributes that are accessible on macOS via the MDItemCopyAttribute function. The JSON files are generated by the copy_attributes.py file in this repository.

The JSON files contain a list of dictionaries, each dictionary representing a metadata attribute. The dictionary contains the following keys:

    {
        "name": "kMDItemAppleLoopDescriptors",
        "description": "Specifies multiple pieces of descriptive information about a loop.",
        "type": "CFArray of CFStrings",
        "version": "macOS 10.4+"
    }

The name key is the name of the attribute as it appears in the CoreServices framework. The description key is a description of the attribute as it appears in the Apple documentation. The type key is the type of the attribute. The version key is the version of macOS that the attribute was introduced in. Deprecated attributes are not included.

The file nsurl_resource_keys.json contains the NSURLResourceKey values that are accessible via the NSURL getResourceValue:forKey:error: method. This file was generated by copy_nsurl_keys.py.

The data was last collected on 2024-09-24.

The included getmd.py and setmd.py show how to get and set metadata attributes using the CoreServices framework called from Python through the pyobjc bridge. setmd.py shows how to use the undocumented MDItemSetAttribute function to set metadata attributes.

About

Access macOS Spotlight metadata on files from Python. Also includes JSON data for all common metadata keys.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages