Get Current Album

Authored on
Sun, 11/24/2024 - 09:22
Body

It's weird how janky Shortcuts is at getting what you are currently listening to. I've never gotten the actual Music shortcuts to work on desktop. There is an option for getting what is currently playing with a Shazam shortcut but that doesn't give you the album name.

Shortcuts does run Applescript though. I did a little searching and found the script for getting what you are listening to. Very cool how quickly it grabs the result.

tell application "Music"
    if player state is playing then
        set currentTrack to current track
        set albumName to album of currentTrack
        set artistName to artist of currentTrack
        set albumYear to year of currentTrack
        set albumGenre to genre of currentTrack
        return "Currently listening to: \"" & albumName & "\" by " & artistName & " (" & albumYear & ", " & albumGenre & ")"
    else
        return "Music is not currently playing."
    end if
end tell

Getting this working is inspiring me to use Applescript more with Shortcuts in the future.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <blockquote cite> <br> <cite> <code> <dd> <dl> <dt> <em> <h2> <h3> <h4> <h5> <h6> <li> <ol start type> <p> <strong> <ul type>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.