Skip to content

apple_music

diapason.connectors.apple_music

Apple Music connector -- reads tracks from the local Music.app via AppleScript.

Uses osascript subprocess calls to query Music.app on macOS. No API keys or network access required; everything stays local.

Requires macOS (sys.platform == "darwin") and the Music app to be available.

AppleMusicConnector

Bases: BaseConnector

Read tracks from the local Music.app library via AppleScript.

Only works on macOS where osascript is available and Music.app is installed (ships with the OS).

disconnect()

No-op -- local connector with no credentials to revoke.

is_connected()

Return True if running on macOS and Music.app responds.

sync(*, since=None, cursor=None)

Query Music.app for all tracks and yield one Document per track.

Parameters

since: If provided, only yield tracks whose last-played date is after this datetime. cursor: Not used for this local connector (included for API compatibility).

Yields

Document One document per track in the Music library.

sync_status()

Return sync progress from the most recent :meth:sync call.