PyObjC DiscRecording Framework

12.1 · active · verified Tue Apr 14

PyObjC-framework-DiscRecording provides Python wrappers for Apple's DiscRecording framework on macOS, enabling interaction with CD/DVD burning hardware and related functionalities. It is part of the larger PyObjC project, which provides access to macOS frameworks from Python. The library is actively maintained with frequent updates to align with new macOS SDK versions and Python releases, currently at version 12.1.

Warnings

Install

Imports

Quickstart

This example demonstrates how to import the DiscRecording framework and list all detected disc burning devices on the system, printing their basic information. This uses the `DRDevice` class to query device properties.

import DiscRecording
import objc

def list_disc_devices():
    devices = DiscRecording.DRDevice.allDevices()
    if not devices:
        print("No disc burning devices found.")
        return

    print("Available Disc Devices:")
    for device in devices:
        print(f"  Name: {device.displayName()}")
        print(f"  Vendor: {device.vendorName()}")
        print(f"  Product: {device.productName()}")
        print(f"  Bus: {device.busName()}")
        print(f"  Write Capabilities: {device.writeCapabilities()['DRDeviceCanWriteDisc']}")
        print(f"  Can Burn: {device.canBurn()}")
        print("  ---")

if __name__ == "__main__":
    # Ensure the Objective-C runtime is initialized
    # (often handled automatically in app contexts, but explicit for scripts)
    list_disc_devices()

view raw JSON →