Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rhettbull/macos_mditem_metadata

Access macOS Spotlight metadata on files from Python. Also includes JSON data for all common metadata keys.
https://github.com/rhettbull/macos_mditem_metadata

apple macos metadata spotlight

Last synced: 1 day ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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](https://developer.apple.com/documentation/coreservices/1427080-mditemcopyattribute?language=objc) 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:

```json
{
"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](https://developer.apple.com/documentation/foundation/nsurlresourcekey) values that are accessible via the [NSURL getResourceValue:forKey:error:](https://developer.apple.com/documentation/foundation/nsurl/1408874-getresourcevalue?language=objc) 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](https://developer.apple.com/documentation/coreservices?language=objc) framework called from Python through the [pyobjc](https://pyobjc.readthedocs.io/en/latest/) bridge. `setmd.py` shows how to use the undocumented `MDItemSetAttribute` function to set metadata attributes.