MediaItem¶
- class music.MediaItem(item: MPMediaItem)¶
A collection of properties that represents a single item contained in the media library.
- property album_artist: str¶
The primary performing artist for an album as a whole.
- Return type:
str
- property album_artist_persistent_id: str¶
The persistent identifier for the primary performing artist for an album as a whole.
- Return type:
str
- property album_persistent_id: str¶
The persistent identifier for an album.
- Return type:
str
- property album_title: str¶
The title of an album, such as “Live On Mars”, as opposed to the title of an individual song on the album, such as “Crater Dance (radio edit)”.
- Return type:
str
- property album_track_count: int¶
The number of tracks in the album that contains the media item.
- Return type:
int
- property artist: str¶
The performing artist(s) for a media item—which may vary from the primary artist for the album that a media item belongs to.
- Return type:
str
- property artist_persistent_id: int¶
The persistent identifier for an artist.
- Return type:
int
- property artwork: <module 'PIL.Image' from '/Users/emma/Developer/pyto-runtime/dist/Framework/DerivedData/Build/Products/Release-maccatalyst/PytoRuntime.bundle/Contents/Resources/apple-python-314_Resources.bundle/Contents/Resources/python-314-essentials-cp314.bundle/lib/python3.14/site-packages/PIL/Image.py'>¶
The artwork image for the media item.
- Return type:
PIL.Image
- property beats_per_minute: int¶
The number of musical beats per minute for the media item.
- Return type:
int
- property bookmark_time: float¶
The user’s place in the media item the most recent time it was played.
- Return type:
float
- property comments: str¶
Textual information about the media item.
- Return type:
str
- property composer: str¶
The musical composer for the media item.
- Return type:
str
- property composer_persistent_id: str¶
The persistent identifier for a composer.
- Return type:
str
- property date_added: str¶
The date the item was added to the library.
- Return type:
str
- property disc_count: int¶
The number of discs in the album that contains the media item.
- Return type:
int
- property disc_number: int¶
The disc number of the media item, for a media item that is part of a multi-disc album.
- Return type:
int
- property genre: str¶
The musical or film genre of the media item.
- Return type:
str
- property genre_persistent_id: str¶
The persistent identifier for a genre.
- Return type:
str
- property has_protected_asset: bool¶
A Boolean indicating whether the media item has a protected asset.
- Return type:
bool
- property is_cloud_item: bool¶
A Boolean value indicating whether the media item is an iCloud Music Library item.
- Return type:
bool
- property is_compilation: bool¶
A Boolean value indicating whether the media item is part of a compilation.
- Return type:
bool
- property is_explicit_item: bool¶
A Boolean value that indicates whether the item has explicit (adult) lyrics or language.
- Return type:
bool
- property last_played_date: str¶
The date a media item was last played.
- Return type:
str
- property lyrics: str¶
The lyrics for the media item.
- Return type:
str
- property persistent_id: str¶
The persistent identifier for the media item.
- Return type:
str
- property play_count: int¶
The number of times the user has played the media item.
- Return type:
int
- property playback_duration: float¶
The playback duration of the media item.
- Return type:
float
- property playback_store_id: str¶
The non-library identifier for a media item.
- Return type:
str
- property podcast_persistent_id: str¶
The persistent identifier for an audio podcast.
- Return type:
str
- property podcast_title: str¶
The title of a podcast, such as “This Martian Drudgery”, as opposed to the title of an individual episode of a podcast such as “Episode 12: Another Cold Day At The Pole”.
- Return type:
str
- property rating: int¶
The user-specified rating of the object in the range [0…5], where a value of 5 indicates the most favorable rating.
- Return type:
int
- property release_date: str¶
The date on which the media item was first publicly released.
- Return type:
str
- property skip_count: int¶
The number of times the user has skipped playing the item.
- Return type:
int
- property title: str¶
The title (or name) of the media item.
- Return type:
str
- property user_grouping: str¶
Grouping information for the media item.
- Return type:
str