Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/rhettbull/macos_mditem_metadata
- Owner: RhetTbull
- License: unlicense
- Created: 2022-09-24T16:41:01.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-11T03:54:44.000Z (about 2 years ago)
- Last Synced: 2023-03-05T14:24:21.649Z (over 1 year ago)
- Topics: apple, macos, metadata, spotlight
- Language: Python
- Homepage:
- Size: 25.4 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.