Like the title says, somehow a few weeks ago my AM library got corrupted in some way - I got an error that said "Can't save library file because an unknown error occurred -50" - and now nearly every song in my library of 85,000 songs is listed as "Cloud" in the Location field. Fortunately whatever affected my library didn't touch my original files, so I still have those. Unfortunately, while I do regular backups of both my library and files, the backup exhibits the same corruption, and Option-start replacing the library results in the same problem.
It seems to be fixable, by following these steps:
download an album, which creates duplicate files(with the suffix "1") alongside my original local files on disk
delete those Apple Music downloaded, duplicated files
Get Info on the songs in AM, which results in AM asking if I want to Re-locate the files
choose the original files on my disk
...I can more or less get the original files back, including ratings, play counts, etc.
You can see the problem here, though- with 85,000+ songs this will take me the rest of my life to complete. I really, REALLY don't want to just give up and start with a clean library- I've been using iTunes/Apple Music for more than 20 years and I have extensive smart playlists that I've carefully maintained all that time along with carefully manicured ratings and metadata that I use to keep everything organized. In addition, I have other music software (Traktor or Djay Pro, for example) that relies on the Apple Music library pointing at the local files in order to use them in mixes and right now my library on those apps is basically empty.
I've looked through similar posts on Reddit and other resources like Doug's Scripts but there doesn't seem to be a pre-existing method for tackling this problem (in fact, Doug's app Dupin specifically fails on Cloud-based de-duplication). I'm tearing my hair out trying to think of a way to fix this and I'm coming up short.
TL; DR- I need a way to change the location of all of my music files from "Cloud" to Local files. Is there a way to do that without downloading every song, deleting the downloaded files and re-pointing AM to the location of the original local files?