Apple Music Song Data

Hi, newby here. I have a KM script that grabs the current playing song title and artist name. I cannot find a variable for song date.

I know I can use the get info command in Apple Music to display the track info window, but I assume I need to use named clipboards to set each piece of information into its own clipboard location and then call each named clipboard to insert the data I want. That's where I'm not getting it.

Could someone explain to me or point me to an example of how to extract Apple Music info.

Thanks

The track object in the osascript (AppleScript / JavaScript) interface to Music.app has two properties that sound close your your 'song date':

  • release date
  • year

So, for example (year value for first selected item)

image

or

image

(() => {
    "use strict";

    const
        music = Application("Music"),
        track = music.selection()[0];

    return ["name", "composer", "year"].reduce(
        (accumulator, keyName) =>
        `${accumulator}${track[keyName]()}\n`,
        ""
    );
})();