Post

Replies

Boosts

Views

Activity

Add songs to Library in Music?
I've been searching for this for a few days now and haven't been able to find an answer. I use BetterTouchTool to customize my touchbar, and I've added an action that will love a song in Apple Music like so: if is_app_running "Music" then tell application "Music" try if current track is loved then return "loved" else return "love" end if on error return "" end try end tell else return "" end if end tell This works, but I realized that having a Smart Playlist of Loved songs means nothing if the songs aren't also in your Library. So, I tried figuring out how to also add songs to my Library when they're loved. I tried this: try duplicate current track to playlist "Library" on error duplicate current track to source "Library" end try end tell And it worked sometimes. I had to have the two versions in there for playlist and source because I found one worked for the auto-generated playlists Apple Music makes (like the "New For You" weekly playlist) versus songs from albums or your radio playlist. This is very unreliable. Sometimes it works, sometimes it doesn't. Honestly, most times it doesn't. It's hard to find any real documentation on how to work with Apple Music with AppleScript. I've gone through the Window -> Library view in the Script Editor and can see the list of possible actions and objects, but there's no direction on how they interact. For example, I would think you could simple do add current track to library playlist but that doesn't work at all. Any time I've tried using add with a track, I get an error that the track "doesn't understand the 'add' message". Is there a simple, consistent way to add songs to my Library through AppleScript? Maybe bonus points if it's an add instead of a duplicate? If I manually click and add a song to my Library, it's simple added – but with this AppleScript, I have to duplicate it instead of simply adding. Any help would be appreciated!
8
0
3.3k
Nov ’21