Music Module Reference

New in version 0.0.1.

Control the macOS Music application using JXA-like syntax.

Classes:

MusicObjectClass(value)

An enumeration.

XAMusicAirPlayDevice(properties)

An AirPlay device.

XAMusicAirPlayDeviceList(properties[, filter])

A wrapper around lists of AirPlay devices that employs fast enumeration techniques.

XAMusicApplication(properties)

A class for managing and interacting with Music.app.

XAMusicArtwork(properties)

An artwork in media apps.

XAMusicArtworkList(properties[, filter])

A wrapper around lists of music artworks that employs fast enumeration techniques.

XAMusicAudioCDPlaylist(properties)

An audio CD playlist in Music.app.

XAMusicAudioCDPlaylistList(properties[, filter])

A wrapper around lists of audio CD playlists that employs fast enumeration techniques.

XAMusicAudioCDTrack(properties)

An audio CD track in Music.app.

XAMusicAudioCDTrackList(properties[, filter])

A wrapper around lists of music audio CD tracks that employs fast enumeration techniques.

XAMusicBrowserWindow(properties)

A browser window of media apps.

XAMusicBrowserWindowList(properties[, filter])

A wrapper around lists of music browser windows that employs fast enumeration techniques.

XAMusicEQPreset(properties)

An equalizer preset in Music.app.

XAMusicEQPresetList(properties[, filter])

A wrapper around lists of equalizer presets that employs fast enumeration techniques.

XAMusicEQWindow(properties)

An equalizer window in Music.app.

XAMusicEQWindowList(properties[, filter])

A wrapper around lists of music equalizer windows that employs fast enumeration techniques.

XAMusicEncoder(properties)

An encoder in Music.app.

XAMusicEncoderList(properties[, filter])

A wrapper around lists of encoders that employs fast enumeration techniques.

XAMusicFileTrack(properties)

A file track in media apps.

XAMusicFileTrackList(properties[, filter])

A wrapper around lists of music file tracks that employs fast enumeration techniques.

XAMusicFolderPlaylist(properties)

A folder playlist in media apps.

XAMusicFolderPlaylistList(properties[, filter])

A wrapper around lists of music folder playlists that employs fast enumeration techniques.

XAMusicItem(properties)

A generic class with methods common to the various playable media classes in media apps.

XAMusicItemList(properties[, filter, obj_class])

A wrapper around lists of music items that employs fast enumeration techniques.

XAMusicLibraryPlaylist(properties)

The library playlist in media apps.

XAMusicLibraryPlaylistList(properties[, filter])

A wrapper around lists of library playlists that employs fast enumeration techniques.

XAMusicMiniplayerWindow(properties)

A miniplayer window in Music.app.

XAMusicMiniplayerWindowList(properties[, filter])

A wrapper around lists of music miniplayer windows that employs fast enumeration techniques.

XAMusicPlaylist(properties)

A playlist in Music.app.

XAMusicPlaylistList(properties[, filter, ...])

A wrapper around lists of playlists that employs fast enumeration techniques.

XAMusicPlaylistWindow(properties)

A playlist window in media apps.

XAMusicPlaylistWindowList(properties[, filter])

A wrapper around lists of music playlist windows that employs fast enumeration techniques.

XAMusicRadioTunerPlaylist(properties)

A radio playlist in Music.app.

XAMusicRadioTunerPlaylistList(properties[, ...])

A wrapper around lists of radio tuner playlists that employs fast enumeration techniques.

XAMusicSharedTrack(properties)

A shared track in media apps.

XAMusicSharedTrackList(properties[, filter])

A wrapper around lists of music shared tracks that employs fast enumeration techniques.

XAMusicSource(properties)

A media source in Music.app.

XAMusicSourceList(properties[, filter])

A wrapper around lists of sources that employs fast enumeration techniques.

XAMusicSubscriptionPlaylist(properties)

A subscription playlist from Apple Music in Music.app.

XAMusicSubscriptionPlaylistList(properties)

A wrapper around lists of subscription playlists that employs fast enumeration techniques.

XAMusicTrack(properties)

A class for managing and interacting with tracks in Music.app.

XAMusicTrackList(properties[, filter, obj_class])

A wrapper around lists of music tracks that employs fast enumeration techniques.

XAMusicURLTrack(properties)

A URL track in media apps.

XAMusicURLTrackList(properties[, filter])

A wrapper around lists of music URL tracks that employs fast enumeration techniques.

XAMusicUserPlaylist(properties)

A user-created playlist in Music.app.

XAMusicUserPlaylistList(properties[, filter])

A wrapper around lists of music user playlists that employs fast enumeration techniques.

XAMusicVideoWindow(properties)

A video window in media apps.

XAMusicVideoWindowList(properties[, filter])

A wrapper around lists of music video windows that employs fast enumeration techniques.

XAMusicVisual(properties)

A music visual in Music.app.

XAMusicVisualList(properties[, filter])

A wrapper around lists of music visuals that employs fast enumeration techniques.

XAMusicWindow(properties)

A window of Music.app.

XAMusicWindowList(properties[, filter, ...])

A wrapper around lists of music windows that employs fast enumeration techniques.

class PyXA.apps.Music.MusicObjectClass(value)[source]

Bases: Enum

An enumeration.

Attributes:

AIRPLAY_DEVICE

APPLICATION

ARTWORK

AUDIO_CD_PLAYLIST

AUDIO_CD_TRACK

BROWSER_WINDOW

ENCODER

EQ_PRESET

EQ_WINDOW

FILE_TRACK

FOLDER_PlAYLIST

ITEM

LIBRARY_PLAYLIST

MINIPLAYER_WINDOW

PLAYLIST

PLAYLIST_WINDOW

RADIO_TUNER_PLAYLIST

SHARED_TRACK

SOURCE

SUBSCRIPTION_PLAYLIST

TRACK

URL_TRACK

USER_PLAYLIST

VIDEO_WINDOW

VISUAL

WINDOW

AIRPLAY_DEVICE = 'cAPD'
APPLICATION = 'capp'
ARTWORK = 'cArt'
AUDIO_CD_PLAYLIST = 'cCDP'
AUDIO_CD_TRACK = 'cCDT'
BROWSER_WINDOW = 'cBrW'
ENCODER = 'cEnc'
EQ_PRESET = 'cEQP'
EQ_WINDOW = 'cEQW'
FILE_TRACK = 'cFlT'
FOLDER_PlAYLIST = 'cFoP'
ITEM = 'cobj'
LIBRARY_PLAYLIST = 'cLiP'
MINIPLAYER_WINDOW = 'cMPW'
PLAYLIST = 'cPly'
PLAYLIST_WINDOW = 'cPlW'
RADIO_TUNER_PLAYLIST = 'cRTP'
SHARED_TRACK = 'cShT'
SOURCE = 'cSrc'
SUBSCRIPTION_PLAYLIST = 'cSuP'
TRACK = 'cTrk'
URL_TRACK = 'cURT'
USER_PLAYLIST = 'cUsP'
VIDEO_WINDOW = 'cNPW'
VISUAL = 'cVis'
WINDOW = 'cwin'
class PyXA.apps.Music.XAMusicAirPlayDevice(properties)[source]

Bases: XAMusicItem

An AirPlay device.

New in version 0.0.7.

Attributes:

active

Whether the device is currently being played to.

available

Whether the device is currently available.

kind

The kind of the device.

network_address

The MAC address of the device.

protected

Whether the device is password/passcode protected.

selected

Whether the device is currently selected.

sound_volume

The output volume for the device from 0 to 100.

supports_audio

Whether the device supports audio playback.

supports_video

Whether the device supports video playback.

property active: bool

Whether the device is currently being played to.

property available: bool

Whether the device is currently available.

property kind: DeviceKind

The kind of the device.

property network_address: str

The MAC address of the device.

property protected: bool

Whether the device is password/passcode protected.

property selected: bool

Whether the device is currently selected.

property sound_volume: int

The output volume for the device from 0 to 100.

property supports_audio: bool

Whether the device supports audio playback.

property supports_video: bool

Whether the device supports video playback.

class PyXA.apps.Music.XAMusicAirPlayDeviceList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicItemList

A wrapper around lists of AirPlay devices that employs fast enumeration techniques.

All properties of AirPlay devices can be called as methods on the wrapped list, returning a list containing each devices’s value for the property.

New in version 0.0.7.

Methods:

active()

available()

by_active(active)

by_available(available)

by_kind(kind)

by_network_address(network_address)

by_protected(protected)

by_selected(selected)

by_sound_volume(sound_volume)

by_supports_audio(supports_audio)

by_supports_video(supports_video)

kind()

network_address()

protected()

selected()

sound_volume()

supports_audio()

supports_video()

active() list[bool][source]
available() list[bool][source]
by_active(active: bool) XAMusicAirPlayDevice | None[source]
by_available(available: bool) XAMusicAirPlayDevice | None[source]
by_kind(kind: DeviceKind) XAMusicAirPlayDevice | None[source]
by_network_address(network_address: str) XAMusicAirPlayDevice | None[source]
by_protected(protected: bool) XAMusicAirPlayDevice | None[source]
by_selected(selected: bool) XAMusicAirPlayDevice | None[source]
by_sound_volume(sound_volume: int) XAMusicAirPlayDevice | None[source]
by_supports_audio(supports_audio: bool) XAMusicAirPlayDevice | None[source]
by_supports_video(supports_video: bool) XAMusicAirPlayDevice | None[source]
kind() list[DeviceKind][source]
network_address() list[str][source]
protected() list[bool][source]
selected() list[bool][source]
sound_volume() list[int][source]
supports_audio() list[bool][source]
supports_video() list[bool][source]
class PyXA.apps.Music.XAMusicApplication(properties)[source]

Bases: XASBApplication, XACanOpenPath

A class for managing and interacting with Music.app.

See also

XAMusicWindow, class:XAMusicSource, XAMusicPlaylist, XAMusicTrack

New in version 0.0.1.

Classes:

DeviceKind(value)

Kinds of devices.

MediaKind(value)

Types of media items.

ObjectType(value)

Types of objects that can be created using the make() method.

PlayerState(value)

States of the music player.

PlaylistKind(value)

Types of special playlists.

PrintSetting(value)

Options to use when printing.

RatingKind(value)

Types of ratings for media items.

RepeatMode(value)

Options for how to repeat playback.

SearchFilter(value)

Filter restrictions on search results.

ShuffleMode(value)

Options for how to shuffle playback.

SourceKind(value)

Types of sources for media items.

iCloudStatus(value)

iCloud statuses of media items.

Methods:

add_to_playlist(urls, playlist)

airplay_devices([filter])

Returns a list of AirPlay devices, as PyXA objects, matching the given filter.

audio_cd_playlists([filter])

Returns a list of audio CD playlists, as PyXA objects, matching the given filter.

audio_cd_tracks([filter])

Returns a list of audio CD tracks, as PyXA objects, matching the given filter.

back_track()

Restarts the current track or returns to the previous track if playback is currently at the start.

browser_windows([filter])

Returns a list of browser windows, as PyXA objects, matching the given filter.

encoders([filter])

Returns a list of encoders, as PyXA objects, matching the given filter.

eq_presets([filter])

Returns a list of EQ presets, as PyXA objects, matching the given filter.

eq_windows([filter])

Returns a list of EQ windows, as PyXA objects, matching the given filter.

fast_forward()

Repeated skip forward in the track until resume() is called.

file_tracks([filter])

Returns a list of file tracks, as PyXA objects, matching the given filter.

library_playlists([filter])

Returns a list of library playlists, as PyXA objects, matching the given filter.

make(specifier, properties[, data])

Creates a new element of the given specifier class without adding it to any list.

miniplayer_windows([filter])

Returns a list of miniplayer windows, as PyXA objects, matching the given filter.

next_track()

Advances to the next track in the current playlist.

open_location(video_url)

Opens and plays an video stream URL or iTunes Store URL.

pause()

Pauses the current track.

play([item, play_once])

Plays the specified TV item (e.g. track, playlist, etc.).

playlist_windows([filter])

Returns a list of playlist windows, as PyXA objects, matching the given filter.

playlists([filter])

Returns a list of playlists, as PyXA objects, matching the given filter.

playpause()

Toggles the playing/paused state of the current track.

previous_track()

Returns to the previous track in the current playlist.

radio_tuner_playlists([filter])

Returns a list of radio tuner playlists, as PyXA objects, matching the given filter.

resume()

Returns to normal playback after calls to fast_forward() or rewind().

rewind()

Repeatedly skip backward in the track until resume() is called.

set_volume(new_volume)

Sets the volume of playback.

shared_tracks([filter])

Returns a list of shared tracks, as PyXA objects, matching the given filter.

sources([filter])

Returns a list of sources, as PyXA objects, matching the given filter.

stop()

Stops playback of the current track.

subscription_playlists([filter])

Returns a list of subscription playlists, as PyXA objects, matching the given filter.

tracks([filter])

Returns a list of tracks, as PyXA objects, matching the given filter.

url_tracks([filter])

Returns a list of URL tracks, as PyXA objects, matching the given filter.

user_playlists([filter])

Returns a list of user playlists, as PyXA objects, matching the given filter.

video_windows([filter])

Returns a list of video windows, as PyXA objects, matching the given filter.

visuals([filter])

Returns a list of visuals, as PyXA objects, matching the given filter.

Attributes:

airplay_enabled

Whether AirPlay is currently enabled.

converting

Whether a track is currently being converted.

current_airplay_devices

The currently selected AirPlay devices.

current_encoder

The currently selected encoder.

current_eq_preset

The currently selected equalizer preset.

current_playlist

The playlist containing the currently targeted track.

current_stream_title

The name of the currently streaming track.

current_stream_url

The URL of the currently streaming track.

current_track

The currently playing (or paused but not stopped) track.

current_visual

The currently selected visual plug-in.

eq_enabled

Whether the equalizer is enabled.

fixed_indexing

Whether the track indices are independent of the order of the current playlist or not.

frontmost

Whether the application is active or not.

full_screen

Whether the app is fullscreen or not.

mute

Whether sound output is muted or not.

name

The name of the application.

player_position

The time elapsed in the current track.

player_state

Whether the player is playing, paused, stopped, fast forwarding, or rewinding.

selection

The selected media items.

shuffle_enabled

Whether songs are played in random order.

shuffle_mode

The playback shuffle mode.

song_repeat

The playback repeat mode.

sound_volume

The sound output volume.

version

The version of the application.

visuals_enabled

Whether visuals are currently displayed.

class DeviceKind(value)[source]

Bases: Enum

Kinds of devices.

Attributes:

AIRPLAY_DEVICE

An AirPlay-enabled device

AIRPORT_EXPRESS

An airport express device

APPLE_TV

An Apple TV device

BLUETOOTH_DEVICE

A BlueTooth-enabled device

COMPUTER

A computer device

HOMEPOD

A HomePod device

UNKNOWN

An unknown device

AIRPLAY_DEVICE = 1799442511

An AirPlay-enabled device

AIRPORT_EXPRESS = 1799442520

An airport express device

APPLE_TV = 1799442516

An Apple TV device

BLUETOOTH_DEVICE = 1799442498

A BlueTooth-enabled device

COMPUTER = 1799442499

A computer device

HOMEPOD = 1799442504

A HomePod device

UNKNOWN = 1799442517

An unknown device

class MediaKind(value)[source]

Bases: Enum

Types of media items.

Attributes:

MUSIC_VIDEO

A music video media item

SONG

A song media item

UNKNOWN

An unknown media item kind

MUSIC_VIDEO = 1800823894

A music video media item

SONG = 1800234067

A song media item

UNKNOWN = 1800760939

An unknown media item kind

class ObjectType(value)[source]

Bases: Enum

Types of objects that can be created using the make() method.

Attributes:

AIRPLAY_DEVICE

ARTWORK

AUDIO_CD_PLAYLIST

AUDIO_CD_TRACK

BROWSER_WINDOW

ENCODER

EQ_PRESET

EQ_WINDOW

FILE_TRACK

FOLDER_PLAYLIST

LIBRARY_PLAYLIST

MINIPLAYER_WINDOW

PLAYLIST

PLAYLIST_WINDOW

RADIO_TUNER_PLAYLIST

SHARED_TRACK

SOURCE

SUBSCRIPTION_PLAYLIST

TRACK

URL_TRACK

USER_PLAYLIST

VIDEO_WINDOW

VISUAL

WINDOW

AIRPLAY_DEVICE = 'airplay_device'
ARTWORK = 'artwork'
AUDIO_CD_PLAYLIST = 'audio_cd_playlist'
AUDIO_CD_TRACK = 'audio_cd_track'
BROWSER_WINDOW = 'browser_window'
ENCODER = 'encoder'
EQ_PRESET = 'eq_preset'
EQ_WINDOW = 'eq_window'
FILE_TRACK = 'file_track'
FOLDER_PLAYLIST = 'folder_playlist'
LIBRARY_PLAYLIST = 'library_playlist'
MINIPLAYER_WINDOW = 'miniplayer_window'
PLAYLIST = 'playlist'
PLAYLIST_WINDOW = 'playlist_window'
RADIO_TUNER_PLAYLIST = 'radio_tuner_playlist'
SHARED_TRACK = 'shared_track'
SOURCE = 'source'
SUBSCRIPTION_PLAYLIST = 'subscription_playlist'
TRACK = 'track'
URL_TRACK = 'url_track'
USER_PLAYLIST = 'user_playlist'
VIDEO_WINDOW = 'video_window'
VISUAL = 'visual'
WINDOW = 'window'
class PlayerState(value)[source]

Bases: Enum

States of the music player.

Attributes:

FAST_FORWARDING

The player is fast forwarding

PAUSED

The player is paused

PLAYING

The player is playing

REWINDING

The player is rewinding

STOPPED

The player is stopped

FAST_FORWARDING = 1800426310

The player is fast forwarding

PAUSED = 1800426352

The player is paused

PLAYING = 1800426320

The player is playing

REWINDING = 1800426322

The player is rewinding

STOPPED = 1800426323

The player is stopped

class PlaylistKind(value)[source]

Bases: Enum

Types of special playlists.

Attributes:

FOLDER

A folder

GENIUS

A smart playlist

LIBRARY

The system library playlist

MUSIC

A playlist containing music items

NONE

An unknown playlist kind

PURCHASED_MUSIC

The purchased music playlist

UNKNOWN

An unknown playlist kind

USER

A user-created playlist

USER_LIBRARY

The user's library

FOLDER = 1800630342

A folder

GENIUS = 1800630343

A smart playlist

LIBRARY = 1800630348

The system library playlist

MUSIC = 1800630362

A playlist containing music items

NONE = 1800302446

An unknown playlist kind

PURCHASED_MUSIC = 1800630349

The purchased music playlist

UNKNOWN = 0

An unknown playlist kind

USER = 1666544464

A user-created playlist

USER_LIBRARY = 1665952080

The user’s library

class PrintSetting(value)[source]

Bases: Enum

Options to use when printing.

Attributes:

ALBUM_LISTING

A listing of a playlist grouped by album

CD_INSERT

A printout of the playlist for jewel case inserts

DETAILED_ERROR_HANDLING

Print a detailed report of PostScript errors

STANDARD_ERROR_HANDLING

Standard PostScript error handling

TRACK_LISTING

A basic listing of tracks within a playlist

ALBUM_LISTING = 1799449698

A listing of a playlist grouped by album

CD_INSERT = 1799570537

A printout of the playlist for jewel case inserts

DETAILED_ERROR_HANDLING = 1819763828

Print a detailed report of PostScript errors

STANDARD_ERROR_HANDLING = 1819767668

Standard PostScript error handling

TRACK_LISTING = 1800696427

A basic listing of tracks within a playlist

class RatingKind(value)[source]

Bases: Enum

Types of ratings for media items.

Attributes:

COMPUTED

A computer generated rating

USER

A user-inputted rating

COMPUTED = 1800565827

A computer generated rating

USER = 1800565845

A user-inputted rating

class RepeatMode(value)[source]

Bases: Enum

Options for how to repeat playback.

Attributes:

ALL

All media items in the current playlist will be repeated

OFF

Playback does not repeat

ONE

The currently playing media item will be repeated

ALL = 1799449708

All media items in the current playlist will be repeated

OFF = 1800564815

Playback does not repeat

ONE = 1800564785

The currently playing media item will be repeated

class SearchFilter(value)[source]

Bases: Enum

Filter restrictions on search results.

Attributes:

ALBUMS

Search albums

ALL

Search all

ARTISTS

Search artists

COMPOSERS

Search composers

DISPLAYED

Search the currently displayed playlist

NAMES

Search track names only

ALBUMS = 1800630860

Search albums

ALL = 1799449708

Search all

ARTISTS = 1800630866

Search artists

COMPOSERS = 1800630851

Search composers

DISPLAYED = 1800630870

Search the currently displayed playlist

NAMES = 1800630867

Search track names only

class ShuffleMode(value)[source]

Bases: Enum

Options for how to shuffle playback.

Attributes:

ALBUMS

Shuffle by album

GROUPINGS

Shuffle by grouping

SONGS

Shuffle by song

ALBUMS = 1800628289

Shuffle by album

GROUPINGS = 1800628295

Shuffle by grouping

SONGS = 1800628307

Shuffle by song

class SourceKind(value)[source]

Bases: Enum

Types of sources for media items.

Attributes:

AUDIO_CD

A CD source

ITUNES_STORE

The iTunes Store source

LIBRARY

A library source

MP3_CD

An MP3 file source

RADIO_TUNER

A radio source

SHARED_LIBRARY

A shared library source

UNKNOWN

An unknown source

AUDIO_CD = 1799439172

A CD source

ITUNES_STORE = 1799967827

The iTunes Store source

LIBRARY = 1800169826

A library source

MP3_CD = 1800225604

An MP3 file source

RADIO_TUNER = 1800697198

A radio source

SHARED_LIBRARY = 1800628324

A shared library source

UNKNOWN = 1800760939

An unknown source

add_to_playlist(urls: list[str | NSURL], playlist)[source]
airplay_devices(filter: dict | None = None) XAMusicAirPlayDeviceList[source]

Returns a list of AirPlay devices, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned AirPlay devices will have, or None

Returns:

The list of devices

Return type:

XAMusicAirPlayDeviceList

Example:

>>> import PyXA
>>> app = PyXA.Application("Music")
>>> print(app.airplay_devices())
<<class 'PyXA.apps.Music.XAMusicAirPlayDeviceList'>['ExampleUser\'s MacBook Pro']>

New in version 0.0.7.

property airplay_enabled: bool

Whether AirPlay is currently enabled.

audio_cd_playlists(filter: dict | None = None) XAMusicAudioCDPlaylistList[source]

Returns a list of audio CD playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned playlists will have, or None

Returns:

The list of audio CD playlists

Return type:

XAMusicAudioCDPlaylistList

New in version 0.2.1.

audio_cd_tracks(filter: dict | None = None) XAMusicAudioCDTrackList[source]

Returns a list of audio CD tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned tracks will have, or None

Returns:

The list of audio CD tracks

Return type:

XAMusicAudioCDTrackList

New in version 0.2.1.

back_track() XAMusicApplication[source]

Restarts the current track or returns to the previous track if playback is currently at the start.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

browser_windows(filter: dict | None = None) XAMusicBrowserWindowList[source]

Returns a list of browser windows, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned browser windows will have, or None

Returns:

The list of windows

Return type:

XAMusicBrowserWindowList

New in version 0.0.1.

property converting: bool

Whether a track is currently being converted.

property current_airplay_devices: XAMusicAirPlayDeviceList

The currently selected AirPlay devices.

property current_encoder: XAMusicEncoder

The currently selected encoder.

property current_eq_preset: XAMusicEQPreset

The currently selected equalizer preset.

property current_playlist: XAMusicPlaylist

The playlist containing the currently targeted track.

property current_stream_title: str

The name of the currently streaming track.

property current_stream_url: str

The URL of the currently streaming track.

property current_track: XAMusicTrack

The currently playing (or paused but not stopped) track.

property current_visual: XAMusicVisual

The currently selected visual plug-in.

encoders(filter: dict | None = None) XAMusicEncoderList[source]

Returns a list of encoders, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned encoders will have, or None

Returns:

The list of encoders

Return type:

XAMusicEncoderList

New in version 0.0.7.

property eq_enabled: bool

Whether the equalizer is enabled.

eq_presets(filter: dict | None = None) XAMusicEQPresetList[source]

Returns a list of EQ presets, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned EQ presets will have, or None

Returns:

The list of presets

Return type:

XAMusicEQPresetList

New in version 0.0.7.

eq_windows(filter: dict | None = None) XAMusicEQWindowList[source]

Returns a list of EQ windows, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned EQ windows will have, or None

Returns:

The list of windows

Return type:

XAMusicEQWindowList

New in version 0.0.7.

fast_forward() XAMusicApplication[source]

Repeated skip forward in the track until resume() is called.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

See also

rewind(), resume()

New in version 0.0.1.

file_tracks(filter: dict | None = None) XAMusicFileTrackList[source]

Returns a list of file tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned tracks will have, or None

Returns:

The list of file tracks

Return type:

XAMusicFileTrackList

New in version 0.2.1.

property fixed_indexing: bool

Whether the track indices are independent of the order of the current playlist or not.

property frontmost: bool

Whether the application is active or not.

property full_screen: bool

Whether the app is fullscreen or not.

class iCloudStatus(value)[source]

Bases: Enum

iCloud statuses of media items.

Attributes:

DUPLICATE

A duplicate media item

ERROR

A media item unavailable due to an error

INELIGIBLE

A media item ineligible for listening

MATCHED

A matched media item

NOT_UPLOADED

A non-uploaded media item

NO_LONGER_AVAILABLE

A media item unavailable due to expiration

PURCHASED

A purchased media item

REMOVED

A removed media item

SUBSCRIPTION

A media item obtained via a subscription to Apple Music

UNKNOWN

Unknown cloud status

UPLOADED

An unloaded media item

DUPLICATE = 1799648624

A duplicate media item

ERROR = 1799713394

A media item unavailable due to an error

INELIGIBLE = 1800562026

A media item ineligible for listening

MATCHED = 1800233332

A matched media item

NOT_UPLOADED = 1800761424

A non-uploaded media item

NO_LONGER_AVAILABLE = 1800562038

A media item unavailable due to expiration

PURCHASED = 1800435058

A purchased media item

REMOVED = 1800562029

A removed media item

SUBSCRIPTION = 1800631650

A media item obtained via a subscription to Apple Music

UNKNOWN = 1800760939

Unknown cloud status

UPLOADED = 1800761452

An unloaded media item

library_playlists(filter: dict | None = None) XAMusicLibraryPlaylistList[source]

Returns a list of library playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned playlists will have, or None

Returns:

The list of library playlists

Return type:

XAMusicLibraryPlaylistList

New in version 0.2.1.

make(specifier: str | ObjectType, properties: dict, data: Any | None = None)[source]

Creates a new element of the given specifier class without adding it to any list.

Use XABase.XAList.push() to push the element onto a list. Valid specifiers are: playlist, user playlist, folder playlist, library playlist, audio CD playlist, radio tuner playlist, subscription playlist, track, URL track, shared track, audio CD track, file track, AirPlay device, artwork, window, browser window, EQ window, miniplayer window, playlist window, video window, visual, source, EQ preset, or encoder.

Parameters:
  • specifier (Union[str, XAMusicApplication.ObjectType]) – The classname of the object to create

  • properties (dict) – The properties to give the object

  • data (Any, optional) – The data to initialize the object with, defaults to None

Returns:

A PyXA wrapped form of the object

Return type:

XABase.XAObject

Example:

Make a new folder playlist and push it onto the list of playlists

>>> import PyXA
>>> app = PyXA.Music()
>>> new_playlist = app.make("folder_playlist", {"name": "Example Playlist"})
>>> app.playlists().push(new_playlist)

New in version 0.2.2.

miniplayer_windows(filter: dict | None = None) XAMusicMiniplayerWindowList[source]

Returns a list of miniplayer windows, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned miniplayer windows will have, or None

Returns:

The list of windows

Return type:

XAMusicMiniplayWindowList

New in version 0.0.7.

property mute: bool

Whether sound output is muted or not.

property name: str

The name of the application.

next_track() XAMusicApplication[source]

Advances to the next track in the current playlist.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

open_location(video_url: str) XAMusicApplication[source]

Opens and plays an video stream URL or iTunes Store URL.

Parameters:

audio_url (str) – The URL of an audio stream (e.g. a web address to an MP3 file) or an item in the iTunes Store.

Returns:

_description_

Return type:

XAMusicApplication

New in version 0.0.1.

pause() XAMusicApplication[source]

Pauses the current track.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

play(item: XAMusicItem | None = None, play_once: bool = True) XAMusicApplication[source]

Plays the specified TV item (e.g. track, playlist, etc.). If no item is provided, this plays the current track from its current player position.

Parameters:

item (_XAMusicItem, optional) – The track, playlist, or video to play, defaults to None

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

property player_position: float

The time elapsed in the current track.

property player_state: PlayerState

Whether the player is playing, paused, stopped, fast forwarding, or rewinding.

playlist_windows(filter: dict | None = None) XAMusicPlaylistWindowList[source]

Returns a list of playlist windows, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned playlist windows will have, or None

Returns:

The list of windows

Return type:

XAMusicPlaylistWindowList

New in version 0.0.1.

playlists(filter: dict | None = None) XAMusicPlaylistList[source]

Returns a list of playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned playlists will have, or None

Returns:

The list of playlists

Return type:

XAMusicPlaylistList

New in version 0.0.1.

playpause() XAMusicApplication[source]

Toggles the playing/paused state of the current track.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

See also

play(), pause(), stop()

New in version 0.0.1.

previous_track() XAMusicApplication[source]

Returns to the previous track in the current playlist.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

radio_tuner_playlists(filter: dict | None = None) XAMusicRadioTunerPlaylistList[source]

Returns a list of radio tuner playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned playlists will have, or None

Returns:

The list of radio tuner playlists

Return type:

XAMusicRadioTunerPlaylistList

New in version 0.2.1.

resume() XAMusicApplication[source]

Returns to normal playback after calls to fast_forward() or rewind().

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

rewind() XAMusicApplication[source]

Repeatedly skip backward in the track until resume() is called.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

property selection: XAMusicItemList

The selected media items.

set_volume(new_volume: float) XAMusicApplication[source]

Sets the volume of playback.

Parameters:

new_volume (float) – The desired volume of playback.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

shared_tracks(filter: dict | None = None) XAMusicSharedTrackList[source]

Returns a list of shared tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned tracks will have, or None

Returns:

The list of shared tracks

Return type:

XAMusicSharedTrackList

New in version 0.2.1.

property shuffle_enabled: bool

Whether songs are played in random order.

property shuffle_mode: ShuffleMode

The playback shuffle mode.

property song_repeat: RepeatMode

The playback repeat mode.

property sound_volume: int

The sound output volume.

sources(filter: dict | None = None) XAMusicSourceList[source]

Returns a list of sources, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned sources will have, or None

Returns:

The list of sources

Return type:

XAMusicSourceList

New in version 0.0.1.

stop() XAMusicApplication[source]

Stops playback of the current track. Subsequent playback will start from the beginning of the track.

Returns:

A reference to the TV application object.

Return type:

XAMusicApplication

New in version 0.0.1.

subscription_playlists(filter: dict | None = None) XAMusicSubscriptionPlaylistList[source]

Returns a list of subscription playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned playlists will have, or None

Returns:

The list of subscription playlists

Return type:

XAMusicSubscriptionPlaylistList

New in version 0.2.1.

tracks(filter: dict | None = None) XAMusicTrackList[source]

Returns a list of tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned tracks will have, or None

Returns:

The list of tracks

Return type:

XAMusicTrackList

New in version 0.0.1.

url_tracks(filter: dict | None = None) XAMusicURLTrackList[source]

Returns a list of URL tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned tracks will have, or None

Returns:

The list of URL tracks

Return type:

XAMusicURLTrackList

New in version 0.2.1.

user_playlists(filter: dict | None = None) XAMusicUserPlaylistList[source]

Returns a list of user playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned playlists will have, or None

Returns:

The list of user playlists

Return type:

XAMusicUserPlaylistList

New in version 0.2.1.

property version: str

The version of the application.

video_windows(filter: dict | None = None) XAMusicVideoWindowList[source]

Returns a list of video windows, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned video windows will have, or None

Returns:

The list of windows

Return type:

XAMusicVideoWindowList

New in version 0.0.1.

visuals(filter: dict | None = None) XAMusicVisualList[source]

Returns a list of visuals, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned visuals will have, or None

Returns:

The list of visuals

Return type:

XAMusicVisualList

New in version 0.0.7.

property visuals_enabled: bool

Whether visuals are currently displayed.

class PyXA.apps.Music.XAMusicArtwork(properties)[source]

Bases: XAMusicItem

An artwork in media apps.

New in version 0.0.1.

Attributes:

data

The data for the artwork in the form of a picture.

downloaded

Whether the artwork was downloaded by media apps.

format

The data format for the artwork.

kind

The kind/purpose of the artwork.

object_description

The string description of the artwork.

raw_data

The data for the artwork in original format.

property data: XAImage

The data for the artwork in the form of a picture.

property downloaded: bool

Whether the artwork was downloaded by media apps.

property format: int

The data format for the artwork.

property kind: int

The kind/purpose of the artwork.

property object_description: str

The string description of the artwork.

property raw_data: bytes

The data for the artwork in original format.

class PyXA.apps.Music.XAMusicArtworkList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicItemList

A wrapper around lists of music artworks that employs fast enumeration techniques.

All properties of music artworks can be called as methods on the wrapped list, returning a list containing each artworks’s value for the property.

New in version 0.0.7.

Methods:

by_data(data)

by_downloaded(downloaded)

by_format(format)

by_kind(kind)

by_object_description(object_description)

by_raw_data(raw_data)

data()

downloaded()

format()

kind()

object_description()

raw_data()

by_data(data: XAImage) XAMusicArtwork | None[source]
by_downloaded(downloaded: bool) XAMusicArtwork | None[source]
by_format(format: int) XAMusicArtwork | None[source]
by_kind(kind: int) XAMusicArtwork | None[source]
by_object_description(object_description: str) XAMusicArtwork | None[source]
by_raw_data(raw_data: bytes) XAMusicArtwork | None[source]
data() list[XAImage][source]
downloaded() list[bool][source]
format() list[int][source]
kind() list[int][source]
object_description() list[str][source]
raw_data() list[bytes][source]
class PyXA.apps.Music.XAMusicAudioCDPlaylist(properties)[source]

Bases: XAMusicPlaylist

An audio CD playlist in Music.app.

New in version 0.0.7.

Attributes:

artist

The artist of the CD.

compilation

Whether the CD is a compilation album.

composer

The composer of the CD.

disc_count

The total number of discs in the CD's album.

disc_number

The index of the CD disc in the source album.

genre

The genre of the CD.

year

The year the album was recorded/released.

Methods:

audio_cd_tracks([filter])

Returns a list of audio CD tracks, as PyXA objects, matching the given filter.

property artist: str

The artist of the CD.

audio_cd_tracks(filter: dict | None = None) XAMusicAudioCDTrackList[source]

Returns a list of audio CD tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned audio CD tracks will have, or None

Returns:

The list of audio CD tracks

Return type:

XAMusicAudioCDTrackList

New in version 0.0.7.

property compilation: bool

Whether the CD is a compilation album.

property composer: str

The composer of the CD.

property disc_count: int

The total number of discs in the CD’s album.

property disc_number: int

The index of the CD disc in the source album.

property genre: str

The genre of the CD.

property year: int

The year the album was recorded/released.

class PyXA.apps.Music.XAMusicAudioCDPlaylistList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicPlaylistList

A wrapper around lists of audio CD playlists that employs fast enumeration techniques.

All properties of audio CD playlists can be called as methods on the wrapped list, returning a list containing each playlist’s value for the property.

New in version 0.0.7.

Methods:

artist()

by_artist(artist)

by_compilation(compilation)

by_composer(composer)

by_disc_count(disc_count)

by_disc_number(disc_number)

by_genre(genre)

by_year(year)

compilation()

composer()

disc_count()

disc_number()

genre()

year()

artist() list[str][source]
by_artist(artist: str) XAMusicAudioCDPlaylist | None[source]
by_compilation(compilation: bool) XAMusicAudioCDPlaylist | None[source]
by_composer(composer: str) XAMusicAudioCDPlaylist | None[source]
by_disc_count(disc_count: int) XAMusicAudioCDPlaylist | None[source]
by_disc_number(disc_number: int) XAMusicAudioCDPlaylist | None[source]
by_genre(genre: str) XAMusicAudioCDPlaylist | None[source]
by_year(year: int) XAMusicAudioCDPlaylist | None[source]
compilation() list[bool][source]
composer() list[str][source]
disc_count() list[int][source]
disc_number() list[int][source]
genre() list[str][source]
year() list[int][source]
class PyXA.apps.Music.XAMusicAudioCDTrack(properties)[source]

Bases: XAMusicTrack

An audio CD track in Music.app.

New in version 0.0.1.

Attributes:

location

The location of the file represented by the track.

property location: XAPath

The location of the file represented by the track.

class PyXA.apps.Music.XAMusicAudioCDTrackList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicTrackList

A wrapper around lists of music audio CD tracks that employs fast enumeration techniques.

All properties of music audio CD tracks can be called as methods on the wrapped list, returning a list containing each track’s value for the property.

New in version 0.0.7.

Methods:

by_location(location)

location()

by_location(location: XAURL) XAMusicAudioCDTrack | None[source]
location() list[XAURL][source]
class PyXA.apps.Music.XAMusicBrowserWindow(properties)[source]

Bases: XAMusicWindow

A browser window of media apps.

New in version 0.0.1.

Attributes:

selection

The selected tracks.

view

The playlist currently displayed in the window.

property selection: XAMusicTrackList

The selected tracks.

property view: XAMusicPlaylist

The playlist currently displayed in the window.

class PyXA.apps.Music.XAMusicBrowserWindowList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicWindowList

A wrapper around lists of music browser windows that employs fast enumeration techniques.

All properties of music browser windows can be called as methods on the wrapped list, returning a list containing each windows’s value for the property.

New in version 0.0.7.

Methods:

by_selection(selection)

by_view(view)

selection()

view()

by_selection(selection: XAMusicTrackList) XAMusicPlaylistWindow | None[source]
by_view(view: XAMusicPlaylist) XAMusicPlaylistWindow | None[source]
selection() XAMusicTrackList[source]
view() XAMusicPlaylistList[source]
class PyXA.apps.Music.XAMusicEQPreset(properties)[source]

Bases: XAMusicItem

An equalizer preset in Music.app.

New in version 0.0.7.

Attributes:

band1

The 32 Hz band level (-12.0 dB to +12.0 dB).

band10

The 16 kHz band level (-12.0 dB to +12.0 dB).

band2

The 64 Hz band level (-12.0 dB to +12.0 dB).

band3

The 125 HZ band level (-12.0 dB to +12.0 dB).

band4

The 250 Hz band level (-12.0 dB to +12.0 dB).

band5

The 500 Hz band level (-12.0 dB to +12.0 dB).

band6

The 1 kHz band level (-12.0 dB to +12.0 dB).

band7

The 2 kHz band level (-12.0 dB to +12.0 dB).

band8

The 4 kHz band level (-12.0 dB to +12.0 dB).

band9

The 8 kHz band level (-12.0 dB to +12.0 dB).

modifiable

Whether the preset can be modified.

preamp

The equalizer preamp level (-12.0 dB to +12.0 dB).

update_tracks

Whether tracks using the preset are updated when the preset is renamed or deleted.

property band1: float

The 32 Hz band level (-12.0 dB to +12.0 dB).

property band10: float

The 16 kHz band level (-12.0 dB to +12.0 dB).

property band2: float

The 64 Hz band level (-12.0 dB to +12.0 dB).

property band3: float

The 125 HZ band level (-12.0 dB to +12.0 dB).

property band4: float

The 250 Hz band level (-12.0 dB to +12.0 dB).

property band5: float

The 500 Hz band level (-12.0 dB to +12.0 dB).

property band6: float

The 1 kHz band level (-12.0 dB to +12.0 dB).

property band7: float

The 2 kHz band level (-12.0 dB to +12.0 dB).

property band8: float

The 4 kHz band level (-12.0 dB to +12.0 dB).

property band9: float

The 8 kHz band level (-12.0 dB to +12.0 dB).

property modifiable: bool

Whether the preset can be modified.

property preamp: float

The equalizer preamp level (-12.0 dB to +12.0 dB).

property update_tracks: bool

Whether tracks using the preset are updated when the preset is renamed or deleted.

class PyXA.apps.Music.XAMusicEQPresetList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicItemList

A wrapper around lists of equalizer presets that employs fast enumeration techniques.

All properties of equalizer presets can be called as methods on the wrapped list, returning a list containing each preset’s value for the property.

See also

XAMusicEQPreset

New in version 0.0.7.

Methods:

band1()

band10()

band2()

band3()

band4()

band5()

band6()

band7()

band8()

band9()

by_band1(band1)

by_band10(band10)

by_band2(band2)

by_band3(band3)

by_band4(band4)

by_band5(band5)

by_band6(band6)

by_band7(band7)

by_band8(band8)

by_band9(band9)

by_modifiable(modifiable)

by_preamp(preamp)

by_update_tracks(update_tracks)

modifiable()

preamp()

update_tracks()

band1() list[float][source]
band10() list[float][source]
band2() list[float][source]
band3() list[float][source]
band4() list[float][source]
band5() list[float][source]
band6() list[float][source]
band7() list[float][source]
band8() list[float][source]
band9() list[float][source]
by_band1(band1: float) XAMusicEQPreset | None[source]
by_band10(band10: float) XAMusicEQPreset | None[source]
by_band2(band2: float) XAMusicEQPreset | None[source]
by_band3(band3: float) XAMusicEQPreset | None[source]
by_band4(band4: float) XAMusicEQPreset | None[source]
by_band5(band5: float) XAMusicEQPreset | None[source]
by_band6(band6: float) XAMusicEQPreset | None[source]
by_band7(band7: float) XAMusicEQPreset | None[source]
by_band8(band8: float) XAMusicEQPreset | None[source]
by_band9(band9: float) XAMusicEQPreset | None[source]
by_modifiable(modifiable: bool) XAMusicEQPreset | None[source]
by_preamp(preamp: float) XAMusicEQPreset | None[source]
by_update_tracks(update_tracks: bool) XAMusicEQPreset | None[source]
modifiable() list[bool][source]
preamp() list[float][source]
update_tracks() list[bool][source]
class PyXA.apps.Music.XAMusicEQWindow(properties)[source]

Bases: XAMusicWindow

An equalizer window in Music.app.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicEQWindowList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicWindowList

A wrapper around lists of music equalizer windows that employs fast enumeration techniques.

All properties of music equalizer windows can be called as methods on the wrapped list, returning a list containing each windows’s value for the property.

See also

XAMusicEQWindow

New in version 0.0.7.

class PyXA.apps.Music.XAMusicEncoder(properties)[source]

Bases: XAMusicItem

An encoder in Music.app.

New in version 0.0.7.

Attributes:

format

The data format created by the encoder.

property format: str

The data format created by the encoder.

class PyXA.apps.Music.XAMusicEncoderList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicItemList

A wrapper around lists of encoders that employs fast enumeration techniques.

All properties of encoders can be called as methods on the wrapped list, returning a list containing each encoders’s value for the property.

See also

XAMusicEncoder

New in version 0.0.7.

Methods:

by_format(format)

format()

by_format(format: str) XAMusicEncoder | None[source]
format() list[str][source]
class PyXA.apps.Music.XAMusicFileTrack(properties)[source]

Bases: XAMusicTrack

A file track in media apps.

New in version 0.0.1.

Attributes:

location

The location of the file represented by the track.

property location: XAPath

The location of the file represented by the track.

class PyXA.apps.Music.XAMusicFileTrackList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicTrackList

A wrapper around lists of music file tracks that employs fast enumeration techniques.

All properties of music file tracks can be called as methods on the wrapped list, returning a list containing each track’s value for the property.

New in version 0.0.7.

Methods:

by_location(location)

location()

by_location(location: XAURL) XAMusicFileTrack | None[source]
location() list[XAURL][source]
class PyXA.apps.Music.XAMusicFolderPlaylist(properties)[source]

Bases: XAMusicUserPlaylist

A folder playlist in media apps.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicFolderPlaylistList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicUserPlaylistList

A wrapper around lists of music folder playlists that employs fast enumeration techniques.

All properties of music folder playlists can be called as methods on the wrapped list, returning a list containing each playlist’s value for the property.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicItem(properties)[source]

Bases: XAObject

A generic class with methods common to the various playable media classes in media apps.

New in version 0.0.1.

Attributes:

container

The container of the item.

id

The ID of the item.

index

The index of the item in the internal application order.

name

The name of the item.

object_class

persistent_id

The constant unique identifier for the item.

properties

Every property of the item.

Methods:

download()

Downloads the item into the local library.

get_clipboard_representation()

Gets a clipboard-codable representation of the music item.

reveal()

Reveals the item in the media apps window.

property container: XAObject

The container of the item.

download() XAMusicItem[source]

Downloads the item into the local library.

Returns:

A reference to the TV item object.

Return type:

XAMusicItem

New in version 0.0.1.

get_clipboard_representation() str[source]

Gets a clipboard-codable representation of the music item.

When a music item is copied to the clipboard, the name of the music item is added to the clipboard.

Returns:

The name of the music item

Return type:

str

New in version 0.0.8.

property id: int

The ID of the item.

property index: int

The index of the item in the internal application order.

property name: str

The name of the item.

property object_class
property persistent_id: str

The constant unique identifier for the item.

property properties: dict

Every property of the item.

reveal() XAMusicItem[source]

Reveals the item in the media apps window.

Returns:

A reference to the TV item object.

Return type:

XAMusicItem

See also

select()

New in version 0.0.1.

class PyXA.apps.Music.XAMusicItemList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XAList

A wrapper around lists of music items that employs fast enumeration techniques.

All properties of music items can be called as methods on the wrapped list, returning a list containing each item’s value for the property.

New in version 0.0.7.

Methods:

by_container(container)

by_id(id)

by_index(index)

by_name(name)

by_persistent_id(persistent_id)

by_properties(properties)

container()

get_clipboard_representation()

Gets a clipboard-codable representation of each music item in the list.

id()

index()

Returns the index of the first occurrence of the element in the list, or -1 if no such element exists in the list.

name()

persistent_id()

properties()

by_container(container: XAObject) XAMusicItem | None[source]
by_id(id: int) XAMusicItem | None[source]
by_index(index: int) XAMusicItem | None[source]
by_name(name: str) XAMusicItem | None[source]
by_persistent_id(persistent_id: str) XAMusicItem | None[source]
by_properties(properties: dict) XAMusicItem | None[source]
container() list[XAObject][source]
get_clipboard_representation() list[str][source]

Gets a clipboard-codable representation of each music item in the list.

When a list of music items is copied to the clipboard, the name of each item is added to the clipboard.

Returns:

A list of track names

Return type:

list[str]

New in version 0.0.8.

id() list[int][source]
index() list[int][source]

Returns the index of the first occurrence of the element in the list, or -1 if no such element exists in the list.

New in version 0.1.2.

name() list[str][source]
persistent_id() list[str][source]
properties() list[dict][source]
class PyXA.apps.Music.XAMusicLibraryPlaylist(properties)[source]

Bases: XAMusicPlaylist

The library playlist in media apps.

New in version 0.0.1.

Methods:

file_tracks([filter])

Returns a list of file tracks, as PyXA objects, matching the given filter.

shared_tracks([filter])

Returns a list of shared tracks, as PyXA objects, matching the given filter.

url_tracks([filter])

Returns a list of URL tracks, as PyXA objects, matching the given filter.

file_tracks(filter: dict | None = None) XAMusicFileTrackList[source]

Returns a list of file tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned file tracks will have, or None

Returns:

The list of file tracks

Return type:

XAMusicFileTrackList

New in version 0.0.7.

shared_tracks(filter: dict | None = None) XAMusicSharedTrackList[source]

Returns a list of shared tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned shared tracks will have, or None

Returns:

The list of shared tracks

Return type:

XAMusicSharedTrackList

New in version 0.0.7.

url_tracks(filter: dict | None = None) XAMusicURLTrackList[source]

Returns a list of URL tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned URL tracks will have, or None

Returns:

The list of URL tracks

Return type:

XAMusicURLTrackList

New in version 0.0.7.

class PyXA.apps.Music.XAMusicLibraryPlaylistList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicPlaylistList

A wrapper around lists of library playlists that employs fast enumeration techniques.

All properties of library playlists can be called as methods on the wrapped list, returning a list containing each playlist’s value for the property.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicMiniplayerWindow(properties)[source]

Bases: XAMusicWindow

A miniplayer window in Music.app.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicMiniplayerWindowList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicWindowList

A wrapper around lists of music miniplayer windows that employs fast enumeration techniques.

All properties of music minipplayer windows can be called as methods on the wrapped list, returning a list containing each windows’s value for the property.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicPlaylist(properties)[source]

Bases: XAMusicItem

A playlist in Music.app.

New in version 0.0.1.

Methods:

add_tracks(*tracks)

Add one or more tracks to this playlist.

artworks([filter])

Returns a list of artworks, as PyXA objects, matching the given filter.

duplicate([location])

Duplicates the playlist to the specified source or folder playlist.

move(location)

Moves the playlist to the specified source or folder playlist.

play()

Starts playback of the playlist, beginning with the first track in the list.

search(query[, type])

tracks([filter])

Returns a list of tracks, as PyXA objects, matching the given filter.

Attributes:

disliked

Whether the playlist is disliked.

duration

The total length of all tracks in seconds.

loved

Whether the playlist is loved.

name

The name of the playlist.

object_description

The string description of the playlist.

parent

The folder containing the playlist, if any.

size

The total size of all tracks in the playlist in bytes.

special_kind

The special playlist kind.

time

The length of all tracks in the playlist in MM:SS format.

visible

Whether the playlist is visible in the source list.

add_tracks(*tracks: XAMusicTrackList | list[XAMusicTrack])[source]

Add one or more tracks to this playlist.

Parameters:

tracks (Union[XAMusicTrackList, list[XAMusicTrack]]) – The list of tracks to add to this playlist

New in version 0.2.2.

artworks(filter: dict | None = None) XAMusicArtworkList[source]

Returns a list of artworks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned artworks will have, or None

Returns:

The list of artworks

Return type:

XAMusicArtworkList

New in version 0.0.7.

property disliked: bool

Whether the playlist is disliked.

duplicate(location: XAMusicSource | XAMusicFolderPlaylist | None = None)[source]

Duplicates the playlist to the specified source or folder playlist.

Parameters:

location (Union[XAMusicSource, XAMusicFolderPlaylist, None], optional) – The source or folder playlist to duplicate this playlist to, or None to duplicate into the parent of this playlist, defaults to None

New in version 0.2.2.

property duration: int

The total length of all tracks in seconds.

property loved: bool

Whether the playlist is loved.

move(location: XAMusicSource | XAMusicFolderPlaylist)[source]

Moves the playlist to the specified source or folder playlist.

Parameters:

location (Union[XAMusicSource, XAMusicPlaylist]) – The source or folder playlist to move this playlist to

New in version 0.2.2.

property name: str

The name of the playlist.

property object_description: str

The string description of the playlist.

property parent: XAMusicPlaylist

The folder containing the playlist, if any.

play()[source]

Starts playback of the playlist, beginning with the first track in the list.

New in version 0.2.1.

search(query: str, type: Literal['all', 'artists', 'albums', 'displayed', 'tracks'] = 'displayed')[source]
property size: int

The total size of all tracks in the playlist in bytes.

property special_kind: PlaylistKind

The special playlist kind.

property time: str

The length of all tracks in the playlist in MM:SS format.

tracks(filter: dict | None = None) XAMusicTrackList[source]

Returns a list of tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned tracks will have, or None

Returns:

The list of tracks

Return type:

XAMusicTrackList

New in version 0.0.7.

property visible: bool

Whether the playlist is visible in the source list.

class PyXA.apps.Music.XAMusicPlaylistList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XAMusicItemList

A wrapper around lists of playlists that employs fast enumeration techniques.

All properties of playlists can be called as methods on the wrapped list, returning a list containing each playlist’s value for the property.

See also

XAMusicPlaylist

New in version 0.0.7.

Methods:

by_disliked(disliked)

by_duration(duration)

by_loved(loved)

by_name(name)

by_object_description(object_description)

by_parent(parent)

by_size(size)

by_special_kind(special_kind)

by_time(time)

by_visible(visible)

disliked()

duration()

loved()

name()

object_description()

parent()

push(*elements)

Appends the object referenced by the provided PyXA wrapper to the end of the list.

size()

special_kind()

time()

visible()

by_disliked(disliked: bool) XAMusicPlaylist | None[source]
by_duration(duration: int) XAMusicPlaylist | None[source]
by_loved(loved: bool) XAMusicPlaylist | None[source]
by_name(name: str) XAMusicPlaylist | None[source]
by_object_description(object_description: str) XAMusicPlaylist | None[source]
by_parent(parent: XAMusicPlaylist) XAMusicPlaylist | None[source]
by_size(size: int) XAMusicPlaylist | None[source]
by_special_kind(special_kind: PlaylistKind) XAMusicPlaylist | None[source]
by_time(time: str) XAMusicPlaylist | None[source]
by_visible(visible: bool) XAMusicPlaylist | None[source]
disliked() list[bool][source]
duration() list[int][source]
loved() list[bool][source]
name() list[str][source]
object_description() list[str][source]
parent() XAMusicPlaylistList[source]
push(*elements: list[XAMusicPlaylist]) XAMusicPlaylist | list[XAMusicPlaylist] | None[source]

Appends the object referenced by the provided PyXA wrapper to the end of the list.

New in version 0.0.3.

size() list[int][source]
special_kind() list[PlaylistKind][source]
time() list[str][source]
visible() list[bool][source]
class PyXA.apps.Music.XAMusicPlaylistWindow(properties)[source]

Bases: XAMusicWindow

A playlist window in media apps.

New in version 0.0.1.

Attributes:

selection

The selected tracks.

view

The playlist currently displayed in the window.

property selection: XAMusicTrackList

The selected tracks.

property view: XAMusicPlaylist

The playlist currently displayed in the window.

class PyXA.apps.Music.XAMusicPlaylistWindowList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicWindowList

A wrapper around lists of music playlist windows that employs fast enumeration techniques.

All properties of music playlist windows can be called as methods on the wrapped list, returning a list containing each windows’s value for the property.

New in version 0.0.7.

Methods:

by_selection(selection)

by_view(view)

selection()

view()

by_selection(selection: XAMusicTrackList) XAMusicPlaylistWindow | None[source]
by_view(view: XAMusicPlaylist) XAMusicPlaylistWindow | None[source]
selection() XAMusicTrackList[source]
view() XAMusicPlaylistList[source]
class PyXA.apps.Music.XAMusicRadioTunerPlaylist(properties)[source]

Bases: XAMusicPlaylist

A radio playlist in Music.app.

New in version 0.0.7.

Methods:

url_tracks([filter])

Returns a list of URL tracks, as PyXA objects, matching the given filter.

url_tracks(filter: dict | None = None) XAMusicURLTrackList[source]

Returns a list of URL tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned URL tracks will have, or None

Returns:

The list of URL tracks

Return type:

XAMusicURLTrackList

New in version 0.0.7.

class PyXA.apps.Music.XAMusicRadioTunerPlaylistList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicPlaylistList

A wrapper around lists of radio tuner playlists that employs fast enumeration techniques.

All properties of radio tuner playlists can be called as methods on the wrapped list, returning a list containing each playlist’s value for the property.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicSharedTrack(properties)[source]

Bases: XAMusicTrack

A shared track in media apps.

New in version 0.0.1.

class PyXA.apps.Music.XAMusicSharedTrackList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicTrackList

A wrapper around lists of music shared tracks that employs fast enumeration techniques.

All properties of music shared tracks can be called as methods on the wrapped list, returning a list containing each track’s value for the property.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicSource(properties)[source]

Bases: XAMusicItem

A media source in Music.app.

New in version 0.0.1.

Methods:

audio_cd_playlists([filter])

Returns a list of audio CD playlists, as PyXA objects, matching the given filter.

library_playlists([filter])

Returns a list of library playlists, as PyXA objects, matching the given filter.

playlists([filter])

Returns a list of playlists, as PyXA objects, matching the given filter.

radio_tuner_playlists([filter])

Returns a list of radio tuner playlists, as PyXA objects, matching the given filter.

subscription_playlists([filter])

Returns a list of subscription playlists, as PyXA objects, matching the given filter.

user_playlists([filter])

Returns a list of user playlists, as PyXA objects, matching the given filter.

Attributes:

capacity

The total size of the source, if it has a fixed size.

free_space

The free space on the source, if it has a fixed size.

kind

The source kind.

audio_cd_playlists(filter: dict | None = None) XAMusicAudioCDPlaylistList[source]

Returns a list of audio CD playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned audio CD playlists will have, or None

Returns:

The list of audio CD playlists

Return type:

XAMusicAudioCDPlaylistList

New in version 0.0.7.

property capacity: int

The total size of the source, if it has a fixed size.

property free_space: int

The free space on the source, if it has a fixed size.

property kind: SourceKind

The source kind.

library_playlists(filter: dict | None = None) XAMusicLibraryPlaylistList[source]

Returns a list of library playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned library playlists will have, or None

Returns:

The list of library playlists

Return type:

XAMusicLibraryPlaylistList

New in version 0.0.7.

playlists(filter: dict | None = None) XAMusicPlaylistList[source]

Returns a list of playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned playlists will have, or None

Returns:

The list of playlists

Return type:

XAMusicPlaylistList

New in version 0.0.7.

radio_tuner_playlists(filter: dict | None = None) XAMusicRadioTunerPlaylistList[source]

Returns a list of radio tuner playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned radio tuner playlists will have, or None

Returns:

The list of radio tuner playlists

Return type:

XAMusicRadioTunerPlaylistList

New in version 0.0.7.

subscription_playlists(filter: dict | None = None) XAMusicSubscriptionPlaylistList[source]

Returns a list of subscription playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned subscription playlists will have, or None

Returns:

The list of subscription playlists

Return type:

XAMusicSubscriptionPlaylistList

New in version 0.0.7.

user_playlists(filter: dict | None = None) XAMusicUserPlaylistList[source]

Returns a list of user playlists, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned user playlists will have, or None

Returns:

The list of user playlists

Return type:

XAMusicUserPlaylistList

New in version 0.0.7.

class PyXA.apps.Music.XAMusicSourceList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicItemList

A wrapper around lists of sources that employs fast enumeration techniques.

All properties of sources can be called as methods on the wrapped list, returning a list containing each source’s value for the property.

See also

XAMusicSource

New in version 0.0.7.

Methods:

by_capacity(capacity)

by_free_space(free_space)

by_kind(kind)

capacity()

free_space()

kind()

by_capacity(capacity: int) XAMusicSource | None[source]
by_free_space(free_space: int) XAMusicSource | None[source]
by_kind(kind: SourceKind) XAMusicSource | None[source]
capacity() list[int][source]
free_space() list[int][source]
kind() list[SourceKind][source]
class PyXA.apps.Music.XAMusicSubscriptionPlaylist(properties)[source]

Bases: XAMusicPlaylist

A subscription playlist from Apple Music in Music.app.

New in version 0.0.7.

Methods:

file_tracks([filter])

Returns a list of file tracks, as PyXA objects, matching the given filter.

url_tracks([filter])

Returns a list of URL tracks, as PyXA objects, matching the given filter.

file_tracks(filter: dict | None = None) XAMusicFileTrackList[source]

Returns a list of file tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned file tracks will have, or None

Returns:

The list of file tracks

Return type:

XAMusicFileTrackList

New in version 0.0.7.

url_tracks(filter: dict | None = None) XAMusicURLTrackList[source]

Returns a list of URL tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned URL tracks will have, or None

Returns:

The list of URL tracks

Return type:

XAMusicURLTrackList

New in version 0.0.7.

class PyXA.apps.Music.XAMusicSubscriptionPlaylistList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicPlaylistList

A wrapper around lists of subscription playlists that employs fast enumeration techniques.

All properties of subscription playlists can be called as methods on the wrapped list, returning a list containing each playlist’s value for the property.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicTrack(properties)[source]

Bases: XAMusicItem

A class for managing and interacting with tracks in Music.app.

See also

XAMusicTrackList

New in version 0.0.1.

Attributes:

album

The name of the track's album.

album_artist

The album artist of the track.

album_disliked

Whether the album for the track is disliked.

album_loved

Whether the album for the track is loved.

album_rating

The rating of the track's album.

album_rating_kind

The album's rating kind.

artist

The artist/source of the track.

bit_rate

The track's bitrate in kbps.

bookmark

The bookmark time of the track in seconds.

bookmarkable

Whether the playback position is kept in memory after stopping the track.

bpm

The tempo of the track in beats per minute.

category

The category of the track.

cloud_status

The iCloud status of the track.

comment

User-provided notes on the track.

compilation

Whether the track is from a compilation album.

composer

The composer of the track.

database_id

A unique ID for the track.

date_added

The date the track was added to the current playlist.

disc_count

The number of discs in the source album.

disc_number

The index of the disc containing the track.

disliked

Whether the track is disliked.

downloader_apple_id

The Apple ID of the person who downloaded the track.

downloader_name

The full name of the person who downloaded the track.

duration

Length of the track in seconds.

enabled

Whether the track is able to be played.

episode_id

A unique ID for the episode of the track.

episode_number

The episode number of the track.

eq

The name of the EQ preset of the track.

finish

The time in seconds from the start at which the track stops playing.

gapless

Whether the track is a from a gapless album.

genre

The music/audio genre category of the track.

grouping

The current section/chapter/movement of the track.

kind

A text description of the track.

long_description

A long description for the track.

loved

Whether the track is loved.

lyrics

The lyrics of the track.

media_kind

A description of the track's media type.

modification_date

The last modification date of the track's content.

movement

The movement name of the track.

movement_count

The total number of movements in the work.

movement_number

The index of the movement in the work.

object_description

A string description of the track.

played_count

The number of the times the track has been played.

played_date

The date the track was last played.

purchaser_apple_id

The Apple ID of the person who bought the track.

purchaser_name

The full name of the person who bought the track.

rating

The rating of the track from 0 to 100.

rating_kind

Whether the rating is user-provided or computed.

release_date

The date the track was released.

sample_rate

The sample rate of the track in Hz.

season_number

The number of the season the track belongs to.

show

The name of the show the track belongs to.

shufflable

Whether the track is included when shuffling.

size

The size of the track in bytes.

skipped_count

The number of times the track has been skipped.

skipped_date

The date the track was last skipped.

sort_album

The string used for this track when sorting by album.

sort_album_artist

The string used for this track when sorting by album artist.

sort_artist

The string used for this track when sorting by artist.

sort_composer

The string used for this track when sorting by composer.

sort_name

The string used for this track when sorting by name.

sort_show

The string used for this track when sorting by show.

start

The start time of the track in seconds.

time

HH:MM:SS representation for the duration of the track.

track_count

The number of tracks in the track's album.

track_number

The index of the track within its album.

unplayed

Whether the track has been played before.

volume_adjustment

Volume adjustment setting for this track from -100 to +100.

work

The work name of the track.

year

The year the track was released.

Methods:

artworks([filter])

Returns a list of artworks, as PyXA objects, matching the given filter.

duplicate(location)

Duplicates the track at the specified location.

move(location)

Moves the track to the specified location, copying it if appropriate.

play()

Plays the item.

select()

Selects the item.

property album: str

The name of the track’s album.

property album_artist: str

The album artist of the track.

property album_disliked: bool

Whether the album for the track is disliked.

property album_loved: bool

Whether the album for the track is loved.

property album_rating: int

The rating of the track’s album.

property album_rating_kind: RatingKind

The album’s rating kind.

property artist: str

The artist/source of the track.

artworks(filter: dict | None = None) XAMusicArtworkList[source]

Returns a list of artworks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned artworks will have, or None

Returns:

The list of artworks

Return type:

XAMusicArtworkList

New in version 0.0.7.

property bit_rate: int

The track’s bitrate in kbps.

property bookmark: float

The bookmark time of the track in seconds.

property bookmarkable: bool

Whether the playback position is kept in memory after stopping the track.

property bpm: int

The tempo of the track in beats per minute.

property category: str

The category of the track.

property cloud_status: iCloudStatus

The iCloud status of the track.

property comment: str

User-provided notes on the track.

property compilation: bool

Whether the track is from a compilation album.

property composer: str

The composer of the track.

property database_id: int

A unique ID for the track.

property date_added: datetime

The date the track was added to the current playlist.

property disc_count: int

The number of discs in the source album.

property disc_number: int

The index of the disc containing the track.

property disliked: bool

Whether the track is disliked.

property downloader_apple_id: str

The Apple ID of the person who downloaded the track.

property downloader_name: str

The full name of the person who downloaded the track.

duplicate(location: XAMusicPlaylist | XAMusicSource)[source]

Duplicates the track at the specified location.

Parameters:

location (Union[XAMusicPlaylist, XAMusicSource]) – The location to duplicate the track to

New in version 0.2.2.

property duration: float

Length of the track in seconds.

property enabled: bool

Whether the track is able to be played.

property episode_id: str

A unique ID for the episode of the track.

property episode_number: int

The episode number of the track.

property eq: str

The name of the EQ preset of the track.

property finish: float

The time in seconds from the start at which the track stops playing.

property gapless: bool

Whether the track is a from a gapless album.

property genre: str

The music/audio genre category of the track.

property grouping: str

The current section/chapter/movement of the track.

property kind: str

A text description of the track.

property long_description: str

A long description for the track.

property loved: bool

Whether the track is loved.

property lyrics: str

The lyrics of the track.

property media_kind: MediaKind

A description of the track’s media type.

property modification_date: datetime

The last modification date of the track’s content.

move(location: XAMusicPlaylist | XAMusicSource)[source]

Moves the track to the specified location, copying it if appropriate.

Parameters:

location (Union[XAMusicPlaylist, XAMusicSource]) – The playlist or source to move the track to

New in version 0.2.2.

property movement: str

The movement name of the track.

property movement_count: int

The total number of movements in the work.

property movement_number: int

The index of the movement in the work.

property object_description: str

A string description of the track.

play() XAMusicItem[source]

Plays the item.

Returns:

A reference to the media item object.

Return type:

_XAMusicItem

New in version 0.0.1.

property played_count: int

The number of the times the track has been played.

property played_date: datetime

The date the track was last played.

property purchaser_apple_id: str

The Apple ID of the person who bought the track.

property purchaser_name: str

The full name of the person who bought the track.

property rating: int

The rating of the track from 0 to 100.

property rating_kind: RatingKind

Whether the rating is user-provided or computed.

property release_date: datetime

The date the track was released.

property sample_rate: int

The sample rate of the track in Hz.

property season_number: int

The number of the season the track belongs to.

select() XAMusicItem[source]

Selects the item.

Returns:

A reference to the media item object.

Return type:

XAMusicTrack

See also

reveal()

New in version 0.0.1.

property show: str

The name of the show the track belongs to.

property shufflable: bool

Whether the track is included when shuffling.

property size: int

The size of the track in bytes.

property skipped_count: int

The number of times the track has been skipped.

property skipped_date: datetime

The date the track was last skipped.

property sort_album: str

The string used for this track when sorting by album.

property sort_album_artist: str

The string used for this track when sorting by album artist.

property sort_artist: str

The string used for this track when sorting by artist.

property sort_composer: str

The string used for this track when sorting by composer.

property sort_name: str

The string used for this track when sorting by name.

property sort_show: str

The string used for this track when sorting by show.

property start: float

The start time of the track in seconds.

property time: str

HH:MM:SS representation for the duration of the track.

property track_count: int

The number of tracks in the track’s album.

property track_number: int

The index of the track within its album.

property unplayed: bool

Whether the track has been played before.

property volume_adjustment: int

Volume adjustment setting for this track from -100 to +100.

property work: str

The work name of the track.

property year: int

The year the track was released.

class PyXA.apps.Music.XAMusicTrackList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XAMusicItemList

A wrapper around lists of music tracks that employs fast enumeration techniques.

All properties of music tracks can be called as methods on the wrapped list, returning a list containing each track’s value for the property.

See also

XAMusicTrack

New in version 0.0.7.

Methods:

album()

album_artist()

album_disliked()

album_loved()

album_rating()

album_rating_kind()

artist()

bit_rate()

bookmark()

bookmarkable()

bpm()

by_album(album)

by_album_artist(album_artist)

by_album_disliked(album_disliked)

by_album_loved(album_loved)

by_album_rating(album_rating)

by_album_rating_kind(album_rating_kind)

by_artist(artist)

by_bit_rate(bit_rate)

by_bookmark(bookmark)

by_bookmarkable(bookmarkable)

by_bpm(bpm)

by_category(category)

by_cloud_status(cloud_status)

by_comment(comment)

by_compilation(compilation)

by_composer(composer)

by_database_id(database_id)

by_date_added(date_added)

by_disc_count(disc_count)

by_disc_number(disc_number)

by_disliked(disliked)

by_downloader_apple_id(downloader_apple_id)

by_downloader_name(downloader_name)

by_duration(duration)

by_enabled(enabled)

by_episode_id(episode_id)

by_episode_number(episode_number)

by_eq(eq)

by_finish(finish)

by_gapless(gapless)

by_genre(genre)

by_grouping(grouping)

by_kind(kind)

by_long_description(long_description)

by_loved(loved)

by_lyrics(lyrics)

by_media_kind(media_kind)

by_modification_date(modification_date)

by_movement(movement)

by_movement_count(movement_count)

by_movement_number(movement_number)

by_object_description(object_description)

by_played_count(played_count)

by_played_date(played_date)

by_purchaser_apple_id(purchaser_apple_id)

by_purchaser_name(purchaser_name)

by_rating(rating)

by_rating_kind(rating_kind)

by_release_date(release_date)

by_sample_rate(sample_rate)

by_season_number(season_number)

by_show(show)

by_shufflable(shufflable)

by_size(size)

by_skipped_count(skipped_count)

by_skipped_date(skipped_date)

by_sort_album(sort_album)

by_sort_album_artist(sort_album_artist)

by_sort_artist(sort_artist)

by_sort_composer(sort_composer)

by_sort_name(sort_name)

by_sort_show(sort_show)

by_start(start)

by_time(time)

by_track_count(track_count)

by_track_number(track_number)

by_unplayed(unplayed)

by_volume_adjustment(volume_adjustment)

by_work(work)

by_year(year)

category()

cloud_status()

comment()

compilation()

composer()

database_id()

date_added()

disc_count()

disc_number()

disliked()

downloader_apple_id()

downloader_name()

duration()

enabled()

episode_id()

episode_number()

eq()

finish()

gapless()

genre()

grouping()

kind()

long_description()

loved()

lyrics()

media_kind()

modification_date()

movement()

movement_count()

movement_number()

object_description()

played_count()

played_date()

purchaser_apple_id()

purchaser_name()

rating()

rating_kind()

release_date()

sample_rate()

season_number()

show()

shufflable()

size()

skipped_count()

skipped_date()

sort_album()

sort_album_artist()

sort_artist()

sort_composer()

sort_name()

sort_show()

start()

time()

track_count()

track_number()

unplayed()

volume_adjustment()

work()

year()

album() list[str][source]
album_artist() list[str][source]
album_disliked() list[bool][source]
album_loved() list[bool][source]
album_rating() list[int][source]
album_rating_kind() list[RatingKind][source]
artist() list[str][source]
bit_rate() list[int][source]
bookmark() list[float][source]
bookmarkable() list[bool][source]
bpm() list[int][source]
by_album(album: str) XAMusicTrack | None[source]
by_album_artist(album_artist: str) XAMusicTrack | None[source]
by_album_disliked(album_disliked: bool) XAMusicTrack | None[source]
by_album_loved(album_loved: bool) XAMusicTrack | None[source]
by_album_rating(album_rating: int) XAMusicTrack | None[source]
by_album_rating_kind(album_rating_kind: RatingKind) XAMusicTrack | None[source]
by_artist(artist: str) XAMusicTrack | None[source]
by_bit_rate(bit_rate: int) XAMusicTrack | None[source]
by_bookmark(bookmark: float) XAMusicTrack | None[source]
by_bookmarkable(bookmarkable: bool) XAMusicTrack | None[source]
by_bpm(bpm: int) XAMusicTrack | None[source]
by_category(category: str) XAMusicTrack | None[source]
by_cloud_status(cloud_status: iCloudStatus) XAMusicTrack | None[source]
by_comment(comment: str) XAMusicTrack | None[source]
by_compilation(compilation: bool) XAMusicTrack | None[source]
by_composer(composer: str) XAMusicTrack | None[source]
by_database_id(database_id: int) XAMusicTrack | None[source]
by_date_added(date_added: datetime) XAMusicTrack | None[source]
by_disc_count(disc_count: int) XAMusicTrack | None[source]
by_disc_number(disc_number: int) XAMusicTrack | None[source]
by_disliked(disliked: bool) XAMusicTrack | None[source]
by_downloader_apple_id(downloader_apple_id: str) XAMusicTrack | None[source]
by_downloader_name(downloader_name: str) XAMusicTrack | None[source]
by_duration(duration: float) XAMusicTrack | None[source]
by_enabled(enabled: bool) XAMusicTrack | None[source]
by_episode_id(episode_id: str) XAMusicTrack | None[source]
by_episode_number(episode_number: int) XAMusicTrack | None[source]
by_eq(eq: str) XAMusicTrack | None[source]
by_finish(finish: float) XAMusicTrack | None[source]
by_gapless(gapless: bool) XAMusicTrack | None[source]
by_genre(genre: str) XAMusicTrack | None[source]
by_grouping(grouping: str) XAMusicTrack | None[source]
by_kind(kind: str) XAMusicTrack | None[source]
by_long_description(long_description: str) XAMusicTrack | None[source]
by_loved(loved: bool) XAMusicTrack | None[source]
by_lyrics(lyrics: str) XAMusicTrack | None[source]
by_media_kind(media_kind: MediaKind) XAMusicTrack | None[source]
by_modification_date(modification_date: datetime) XAMusicTrack | None[source]
by_movement(movement: str) XAMusicTrack | None[source]
by_movement_count(movement_count: int) XAMusicTrack | None[source]
by_movement_number(movement_number: int) XAMusicTrack | None[source]
by_object_description(object_description: str) XAMusicTrack | None[source]
by_played_count(played_count: int) XAMusicTrack | None[source]
by_played_date(played_date: datetime) XAMusicTrack | None[source]
by_purchaser_apple_id(purchaser_apple_id: str) XAMusicTrack | None[source]
by_purchaser_name(purchaser_name: str) XAMusicTrack | None[source]
by_rating(rating: int) XAMusicTrack | None[source]
by_rating_kind(rating_kind: RatingKind) XAMusicTrack | None[source]
by_release_date(release_date: datetime) XAMusicTrack | None[source]
by_sample_rate(sample_rate: int) XAMusicTrack | None[source]
by_season_number(season_number: int) XAMusicTrack | None[source]
by_show(show: str) XAMusicTrack | None[source]
by_shufflable(shufflable: bool) XAMusicTrack | None[source]
by_size(size: int) XAMusicTrack | None[source]
by_skipped_count(skipped_count: int) XAMusicTrack | None[source]
by_skipped_date(skipped_date: datetime) XAMusicTrack | None[source]
by_sort_album(sort_album: str) XAMusicTrack | None[source]
by_sort_album_artist(sort_album_artist: str) XAMusicTrack | None[source]
by_sort_artist(sort_artist: str) XAMusicTrack | None[source]
by_sort_composer(sort_composer: str) XAMusicTrack | None[source]
by_sort_name(sort_name: str) XAMusicTrack | None[source]
by_sort_show(sort_show: str) XAMusicTrack | None[source]
by_start(start: float) XAMusicTrack | None[source]
by_time(time: str) XAMusicTrack | None[source]
by_track_count(track_count: int) XAMusicTrack | None[source]
by_track_number(track_number: int) XAMusicTrack | None[source]
by_unplayed(unplayed: bool) XAMusicTrack | None[source]
by_volume_adjustment(volume_adjustment: int) XAMusicTrack | None[source]
by_work(work: str) XAMusicTrack | None[source]
by_year(year: int) XAMusicTrack | None[source]
category() list[str][source]
cloud_status() list[iCloudStatus][source]
comment() list[str][source]
compilation() list[bool][source]
composer() list[str][source]
database_id() list[int][source]
date_added() list[datetime][source]
disc_count() list[int][source]
disc_number() list[int][source]
disliked() list[bool][source]
downloader_apple_id() list[str][source]
downloader_name() list[str][source]
duration() list[float][source]
enabled() list[bool][source]
episode_id() list[str][source]
episode_number() list[int][source]
eq() list[str][source]
finish() list[float][source]
gapless() list[bool][source]
genre() list[str][source]
grouping() list[str][source]
kind() list[str][source]
long_description() list[str][source]
loved() list[bool][source]
lyrics() list[str][source]
media_kind() list[MediaKind][source]
modification_date() list[datetime][source]
movement() list[str][source]
movement_count() list[int][source]
movement_number() list[int][source]
object_description() list[str][source]
played_count() list[int][source]
played_date() list[datetime][source]
purchaser_apple_id() list[str][source]
purchaser_name() list[str][source]
rating() list[int][source]
rating_kind() list[RatingKind][source]
release_date() list[datetime][source]
sample_rate() list[int][source]
season_number() list[int][source]
show() list[str][source]
shufflable() list[bool][source]
size() list[int][source]
skipped_count() list[int][source]
skipped_date() list[datetime][source]
sort_album() list[str][source]
sort_album_artist() list[str][source]
sort_artist() list[str][source]
sort_composer() list[str][source]
sort_name() list[str][source]
sort_show() list[str][source]
start() list[float][source]
time() list[str][source]
track_count() list[int][source]
track_number() list[int][source]
unplayed() list[bool][source]
volume_adjustment() list[int][source]
work() list[str][source]
year() list[int][source]
class PyXA.apps.Music.XAMusicURLTrack(properties)[source]

Bases: XAMusicTrack

A URL track in media apps.

New in version 0.0.1.

Attributes:

address

The URL for the track.

property address: XAURL

The URL for the track.

class PyXA.apps.Music.XAMusicURLTrackList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicTrackList

A wrapper around lists of music URL tracks that employs fast enumeration techniques.

All properties of music URL tracks can be called as methods on the wrapped list, returning a list containing each track’s value for the property.

New in version 0.0.7.

Methods:

address()

by_address(address)

address() list[str][source]
by_address(address: str) XAMusicURLTrack | None[source]
class PyXA.apps.Music.XAMusicUserPlaylist(properties)[source]

Bases: XAMusicPlaylist

A user-created playlist in Music.app.

New in version 0.0.1.

Methods:

file_tracks([filter])

Returns a list of file tracks, as PyXA objects, matching the given filter.

shared_tracks([filter])

Returns a list of shared tracks, as PyXA objects, matching the given filter.

url_tracks([filter])

Returns a list of URL tracks, as PyXA objects, matching the given filter.

Attributes:

genius

Whether the playlist is a genius playlist.

shared

Whether the playlist is shared.

smart

Whether the playlist is a smart playlist.

file_tracks(filter: dict | None = None) XAMusicFileTrackList[source]

Returns a list of file tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned file tracks will have, or None

Returns:

The list of file tracks

Return type:

XAMusicFileTrackList

New in version 0.0.7.

property genius: bool

Whether the playlist is a genius playlist.

property shared: bool

Whether the playlist is shared.

shared_tracks(filter: dict | None = None) XAMusicSharedTrackList[source]

Returns a list of shared tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned shared tracks will have, or None

Returns:

The list of shared tracks

Return type:

XAMusicSharedTrackList

New in version 0.0.7.

property smart: bool

Whether the playlist is a smart playlist.

url_tracks(filter: dict | None = None) XAMusicURLTrackList[source]

Returns a list of URL tracks, as PyXA objects, matching the given filter.

Parameters:

filter (Union[dict, None]) – A dictionary specifying property-value pairs that all returned URL tracks will have, or None

Returns:

The list of URL tracks

Return type:

XAMusicURLTrackList

New in version 0.0.7.

class PyXA.apps.Music.XAMusicUserPlaylistList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicPlaylistList

A wrapper around lists of music user playlists that employs fast enumeration techniques.

All properties of music user playlists can be called as methods on the wrapped list, returning a list containing each playlist’s value for the property.

New in version 0.0.7.

Methods:

by_genius(genius)

by_shared(shared)

by_smart(smart)

genius()

shared()

smart()

by_genius(genius: bool) XAMusicUserPlaylist | None[source]
by_shared(shared: bool) XAMusicUserPlaylist | None[source]
by_smart(smart: bool) XAMusicUserPlaylist | None[source]
genius() list[bool][source]
shared() list[bool][source]
smart() list[bool][source]
class PyXA.apps.Music.XAMusicVideoWindow(properties)[source]

Bases: XAMusicWindow

A video window in media apps.

New in version 0.0.1.

class PyXA.apps.Music.XAMusicVideoWindowList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicWindowList

A wrapper around lists of music video windows that employs fast enumeration techniques.

All properties of music video windows can be called as methods on the wrapped list, returning a list containing each windows’s value for the property.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicVisual(properties)[source]

Bases: XAMusicPlaylist

A music visual in Music.app.

New in version 0.0.7.

class PyXA.apps.Music.XAMusicVisualList(properties: dict, filter: dict | None = None)[source]

Bases: XAMusicItemList

A wrapper around lists of music visuals that employs fast enumeration techniques.

All properties of music visuals can be called as methods on the wrapped list, returning a list containing each visual’s value for the property.

See also

XAMusicVisual

New in version 0.0.7.

class PyXA.apps.Music.XAMusicWindow(properties)[source]

Bases: XASBWindow, XAMusicItem

A window of Music.app.

New in version 0.0.1.

Attributes:

full_screen

Whether the window is currently full screen.

position

The upper left position of the window.

property full_screen: bool

Whether the window is currently full screen.

property position: tuple[int, int]

The upper left position of the window.

class PyXA.apps.Music.XAMusicWindowList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XAMusicItemList

A wrapper around lists of music windows that employs fast enumeration techniques.

All properties of music windows can be called as methods on the wrapped list, returning a list containing each windows’s value for the property.

See also

XAMusicWindow

New in version 0.0.7.

Methods:

bounds()

by_bounds(bounds)

by_closeable(closeable)

by_collapseable(collapseable)

by_collapsed(collapsed)

by_full_screen(full_screen)

by_position(position)

by_resizable(resizable)

by_visible(visible)

by_zoomable(zoomable)

by_zoomed(zoomed)

closeable()

collapseable()

collapsed()

full_screen()

position()

resizable()

visible()

zoomable()

zoomed()

bounds() list[tuple[tuple[int, int], tuple[int, int]]][source]
by_bounds(bounds: tuple[tuple[int, int], tuple[int, int]]) XAMusicWindow | None[source]
by_closeable(closeable: bool) XAMusicWindow | None[source]
by_collapseable(collapseable: bool) XAMusicWindow | None[source]
by_collapsed(collapsed: bool) XAMusicWindow | None[source]
by_full_screen(full_screen: bool) XAMusicWindow | None[source]
by_position(position: tuple[int, int]) XAMusicWindow | None[source]
by_resizable(resizable: bool) XAMusicWindow | None[source]
by_visible(visible: bool) XAMusicWindow | None[source]
by_zoomable(zoomable: bool) XAMusicWindow | None[source]
by_zoomed(zoomed: bool) XAMusicWindow | None[source]
closeable() list[bool][source]
collapseable() list[bool][source]
collapsed() list[bool][source]
full_screen() list[bool][source]
position() list[tuple[int, int]][source]
resizable() list[bool][source]
visible() list[bool][source]
zoomable() list[bool][source]
zoomed() list[bool][source]