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 comment
  • 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 comment

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 comment
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 comment
  • 1 year later...
1 hour ago, gedeyenite said:

One can always switch to Android.

 

Welcome to the forum.


Switching to Android wouldn’t do anything because I was talking about macOS, not iOS. But even if I were talking about iOS, switching to Android would still not do anything because as far as I’m aware it doesn’t have ubiquitous automations capabilities and no AppleScript. So essentially in response to “I’m unhappy about this thing in this platform” your suggestion was “switch to another platform which also doesn’t have the thing you want”.


I don’t want to switch to Android. I don’t like it. I don’t like everything about iOS either, but as a whole it fits my needs considerably better. But I don’t have any interest in flamewars; everyone should use what they prefer.


More importantly, though, I was wrong. Apple did not kill AppleScript when they introduced Shortcuts. They haven’t extended it either, but Shortcuts has direct support for AppleScript which proves they at least acknowledge it. And they do not require a developer account to share automations and there’s no indication they will.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...