Skip to content

This AppleScript workflow detects if a song is being played on Apple Music or Spotify, then extracts the names of both the artist and the song, composes a string using a template and copies it to your clipboard.

License

Notifications You must be signed in to change notification settings

oneeyedman/nowplaying-for-alfred

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eighth note in black, inside a yellow circle with a white border

NowPlaying for Alfred

GitHub tag (latest SemVer pre-release)

This AppleScript workflow detects if a song is being played on Apple Music or Spotify, then extracts the names of both the artist and the song, composes a string using a template and copies it to your clipboard.

Template

This is the template used to compose the final string. The URL will only appear if the song is played on Spotify.

♬ <SONG_NAME> - <ARTIST_NAME>  → <URL> 

#Spotify|AppleMusic #NowPlaying

Samples

♬ Future World - Helloween → https://music.apple.com/es/album/future-world/1144728708?i=1144728856&uo=4

#AppleMusic #NowPlaying 
♬ Royals - Lorde → http://open.spotify.com/track/4zztp85oS36ijgAWwyhX8p 

#Spotify #NowPlaying

Works With installed Applications

Spotify icon with three black emitting waves on a green circle

Apple Music icon with a white eighth note on a rounded red square with rounded edges

👉 Apps must be installed; the workflow is not compatible with their web version.

😱 Dependencies

Apple Shortcuts app icon, consisting of two rounded diamonds stacked on top of each other with transparency, on a dark blue rectangular background with rounded edges

To obtain the Apple Music URL, I haven't found any other way than using an Apple shortcut that achieves the magic and copies the link to the clipboard. You can download it from this iCloud link.

Steps of the shortcut to obtain the URL of the currently playing song on Apple Music. Retrieve song data, search for the URL, store it in a variable called "trackURL", clean and copy it to the clipboard

🤦‍♂️ Apple Music doesn't always find the current track link because, you know, it's Apple.


Installation

  1. Download the linked shortcut and add it to your shortcuts library.
  2. Download the .alfredworkflow file or get it from the dist/ folder, double click it, and add it to your workflows.
  3. Link the appropriate script based on whether you are using Spotify or Apple Music. Steps of the workflow: detect the application and take one path or another to compose the chain to share. Highlight the App script node for review.
  4. Check that the new shortcut is properly linked in the workflow, and that's it. You are good to go! Steps of the workflow: detect the application and take one path or another to compose the chain to share. Highlight the Apple shortcut node for review.

Run it

  1. Play some of your stuff on Apple Music or Spotify.
  2. Launch Alfred, type now, hit enter and as soon as you see the Done! alert, the composed string should be in your clipboard ;)
  3. Enjoy!

About

This AppleScript workflow detects if a song is being played on Apple Music or Spotify, then extracts the names of both the artist and the song, composes a string using a template and copies it to your clipboard.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published