Apple Music
A Rust Library to fully control local MacOS Apple Music player.
This crate provides a convenient way of controlling a MacOS Apple Music player, fully through Rust code.
The logic behind this crate relies on Apple's scripting APIs through osascript CLI and JavaScript scripts.
Example
let playlist = &get_playlist_by_id.unwrap;
play_playlist; // Apple Music player starts playing provided Playlist.
set_shuffle; // Shuffle is now enabled on currently playing Playlist.
let track = playlist.fetch_playlist_tracks.unwrap;
play_track; // Apple Music player starts playing provided Track.
let current_track = get_current_track.unwrap;
println!; // "An awesome song!"
println!; // Prints the direct url for the Artwork of the Track.
current_track.set_loved; // Track is now loved!
next_track; // Goes to next track.
let current_track = get_current_track.unwrap;
current_track.reveal_in_player; // Track is revealed and selected on Apple Music player.
current_track.set_disliked; // Track is now disliked!
set_sound_volume; // Sets Player volume to 15.
playlist.download; // Playlist is being downloaded on Apple Music player.
quit; // Quit Apple Music application on Mac.
Going further
That is just a part of the available API.
For more info and an exhaustive list of what's available, please check out the documentation!
Limitations
Platforms
This crate only works on MacOs, and has only been tested with macOS 13.4.1 and Apple Music 1.3.5.
I would be more than happy provide support for other version of MacOs / Apple Music, do not hesitate to open an issue if you are facing failures!
Next Steps
Before v1.0:
- Finish to add remaining classes & methods:
ADD()EXPORT()REFRESH()- Ensure the whole API is covered by this crate