MusicBridge
final class MusicBridge
The Music Bridge class; send AppleScript actions to Music
-
AppleScriptObjC object for communicating with Music
Declaration
Swift
private var bridge: MusicBridgeProtocol
-
AppleScriptObjC setup
Declaration
Swift
init()
-
Get the AppleScript ID for a song
Note
Persistent ID between AppleScript and iTunesLibrary do not match so we have to search by name, album and track number to make sure we get the correct track.Declaration
Swift
func getMusicSongID(title: String, album: String, track: Int) -> Int
Parameters
title
The title of the song
album
The album of the song
track
The track of the song
Return Value
An AppleScript ID
-
Set the sync values of a music song
Declaration
Swift
func setMusicSongValues(songID: Int, values: MusicMatchModel.Values)
Parameters
songID
The AppleScript ID of the song
values
The values
-
Set the rating of a music song
Declaration
Swift
func setMusicSongRating(songID: Int, rating: Int)
Parameters
songID
The AppleScript ID of the song
rating
The rating
-
Set the playcount of a music song
Declaration
Swift
func setMusicSongPlaycount(songID: Int, playcount: Int)
Parameters
songID
The AppleScript ID of the song
playcount
The playcount
-
Set the play date of a music song
Declaration
Swift
func setMusicSongPlayDate(songID: Int, playDate: String)
Parameters
songID
The AppleScript ID of the song
playDate
The play date
-
Send a notification with AppleScript
Declaration
Swift
func sendNotification(title: String, message: String)
Parameters
title
The title of the notification
message
The message of the notification