Jump to content

Apple Music Workflow to add Current Song to Playlist


Recommended Posts

I was ecstatic when I found a workflow to add the currently playing track any playlist of my choice. So fast and efficient!

 

But, alas, the workflows out there do not seem to work with Apple Music. I have looked at AppleScript API for iTunes (god I hate AS) and the small proof of concepts I have made have failed miserably.

 

Has anybody gotten close to doing this? I am so sick of adding songs to playlists like a mere mortal!  :D

 

Thanks!

 

-Christian

Edited by Vítor
Fixed typo in title
Link to post
  • 4 years later...

@csaborio & @dfay Out of curiosity, do you guys know if this issue has improved since your last post (re: Add Apple Music track to playlists and/or user library, etc.)?

 

I'd like to be able to:

  1. Add the current track playing from Apple Music to my user library (so that it's now in my library, or so that I can later add it to playlist, etc.), and
  2. Add  the current track playing from Apple Music directly to a playlist without first adding it to my user library

As for the first issue, I've had a little luck using the following line to get the track into my library: 

 

duplicate current track to source "Library"

 

However, it's incredibly slow and buggy. So, if you're lucky, and it actually works, then you still have to put a ton of delays in the script to give it time to add it to your library (so that you can later search for it and add it a playlist, etc.). For example, the following AppleScript uses this method and tries to add the track to a predefined playlist called Inbox 📥:

 

tell application "Music"
	set thePlaylist to user playlist "Inbox 📥"
	set trackName to name of current track
	set artistName to artist of current track
	try
		duplicate current track to source "Library"
		delay 8
		
		set foundTracks to (every track of library playlist 1 whose artist is artistName and name is trackName)
		repeat with theTrack in foundTracks
			duplicate theTrack to thePlaylist
		end repeat
		set theNotification to ("Added  " & artistName & ", " & trackName)
	on error
		set theNotification to ("Failed  " & artistName & ", " & trackName)
	end try
	
	return theNotification
end tell

 

However, the script doesn't work very well (even after tinkering around with the delays).

 

And, as for the second item, I haven't made any progress with it (i.e., short of using a hokey way of accessing the right-click/context menu to add it to a playlist). But this almost never works.

 

Any ideas? Thanks for your help!!

Link to post

Hey! Unfortunately, I've given up on this.

 

I just switch to iTunes and add the song directly to the playlist. I used to love to this via Alfred, but the hours I've spent trying to automate everything are simply not worth my time or anger.

 

Apple needs to kill Applescript.

Link to post
11 hours ago, csaborio said:

Apple needs to kill Applescript.


No, what they should to do is invest in it and make it better. But they won’t.

 

Don’t worry, they’ll kill it soon enough when they bring Shortcuts to the Mac. And we’ll be lucky if they don’t make us pay them 100$/year for a developer account to share our automations.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...