Find and replace local versions of Apple Music files in a playlist

I have a bunch of playlists that I’ve crafted over the years and when I moved to Apple Music I was disappointed to see my local library copies of those files replaced with Apple Music’s versions. It seemed to be totally arbitrary and, importantly, the play count, rating, etc. was different on my local library copies then it was on the Apple Music versions of those songs.

UntitledImage

In the above, I know that I have a copy of Can’t get There from Here in my local library, so not sure why the Apple Music one was substituted in my playlist. Anyway, I want my local version in there so I can track stats, etc.

I poked around the venerable Doug’s Scripts for a while but couldn’t quite find what I needed so I wrote this script which:

  • Select/start playing a song in the playlist you want to work with
  • Creates a new playlist called “$playlistname Local Files.”
  • Checks each song in the active playlist to see if it’s local or Apple Music
  • If it’s not Apple Music, it just adds it to the Local Files version of the playlist
  • If it is Apple Music, it checks to see if there is a song in your library with the same Artist and Song name
  • It then copies the tracks that result from that search to the Local Files version of the playlist
  • If it can’t find a local copy, it adds the Apple Music version to the “Local Files” copy of the playlist

The search is really loose so it will find multiple local copies if you have them which is a bit of a pain in the butt. SO you need to go to the new playlist and remove the local versions (live! Remix!, etc.) from the playlist.

I’ve run this on a few big playlists with ~1000 songs and it runs just fine. It might be helpful for a few folks so I’m putting it up here but that said, I wouldn’t download and run this unless you know what the code is doing.

Posted

in

,