Sometimes friends share a playlist, album, or track on Spotify, and you don't want to play it on your iPhone like a chump. You want OwnTone to play it (like a boss)! Instead of adding the music to your library and updating your library, or trying to search for it via the FD web interface, or even more tediously running a custom terminal command to ping the JSON API, you can use this new Siri Shortcut I built. This also works if you just want to find music on your own in the Spotify app and play it via FD on the fly.
Here is the shortcut:
https://www.icloud.com/shortcuts/f1b7bee960ec43f8b394f581b80a194e //new play anything shortcut
https://www.icloud.com/shortcuts/dc34435723a44cf391f79212bbaa5fa2 //playlist-only shortcut
https://www.icloud.com/shortcuts/2b383223177c408ab2d80d1e0cbcc34a //original shortcut
Here is how you use it when someone shares a link:
- Tap and hold on the shared link to copy it (that's it, it's in your clipboard, continue with "Now that the share link..." below)
Here is how you use it when browsing Spotify:
- Open the Spotify app.
- Click on the ellipsis (...)
- Scroll down and click on "Share"
- Click on "Copy Link"
Now that the share link is in your clipboard you just run the shortcut! You can do this by tapping on the shortcut, or saying "Hey Siri FD Start Share". You can of course rename the shortcut, and whatever the title is will be the command you speak to run it.
The shortcut will pull the type of music and the unique Spotify ID out of the copied URL, add this info to a URL and command for the JSON API which clears your current queue and starts playing the playlist.
Have fun, tell your friends, and feel free to tweak it to your liking or make it smarter (then share what awesome thing you did here).
9-4-20 update:
The new shortcut now supports albums, tracks, and playlists (possibly any type of share link Spotify can provide... not just playlists). It uses regex to capture the type (album, track, or playlist) of music being shared, and Spotify ID, and injects that into the FD JSON command format.
9-3-20 update:
The new shortcut fixes a switch Spotify made to sharing URLs that now include user/username in the sharing links. The shortcut now parses the link and captures everything after "playlist/" and before "?" and passes the playlist ID into the JSON request. example of share link: https://open.spotify.com/user/hulu/playlist/3i5FrlGKOjJzA2UdMLN5LP?si=7iH8yAauSLuiNgOTxUc2hw
Update 6/4/21
If you're using OwnTone instead of Forked-Daapd,the URL in this shortcut needs to be updated to use owntone.local I've also found that getting share links from the Spotify Mac app has a different URL structure than the iOS app. This shortcut will only work when getting share links from iOS (for now)