MediaQuery

class music.MediaQuery(query: MPMediaQuery)

A query that specifies a set of media items from the device’s media library by way of a filter and a grouping type.

classmethod albums() → MediaQuery

Creates a media query that matches music items and that groups and sorts collections by album name.

Return type:

MediaQuery

classmethod artists() → MediaQuery

Creates a media query that matches music items and that groups and sorts collections by artist name.

Return type:

MediaQuery

classmethod audiobook() → MediaQuery

Creates a media query that matches audio book items and that groups and sorts collections by audio book name.

Return type:

MediaQuery

classmethod compilations() → MediaQuery

Creates a media query that matches compilation items and that groups and sorts collections by album name.

Return type:

MediaQuery

classmethod composers() → MediaQuery

Creates a media query that matches all media items and that groups and sorts collections by composer name.

Return type:

MediaQuery

classmethod genres() → MediaQuery

Creates a media query that matches all media items and that groups and sorts collections by genre name.

Return type:

MediaQuery

property items: list[MediaItem]

An array of media items that match the media query’s predicate.

Return type:

list[MediaItem]

classmethod playlists() → MediaQuery

Creates a media query that matches the entire library and that groups and sorts collections by playlist name.

Return type:

MediaQuery

classmethod podcasts() → MediaQuery

Creates a media query that matches podcast items and that groups and sorts collections by podcast name.

Return type:

MediaQuery

classmethod songs() → MediaQuery

Creates a media query that matches music items and that groups and sorts collections by song name.

Return type:

MediaQuery