Skip Navigation

I've just created my perfect automated music setup, including getting new recommendations

I recently decided to start taking on the challenge of selfhosting and curating my music collection. I originally started looking at Lidarr as I am already a big fan of Radarr and Sonarr, but it wasn't really what I was looking for. I'm not often seeking out full albums, and am more often finding my music by listening to single tracks from Spotify's Discover Weekly playlist. I needed a solution that would let me replicate this experience while hosting my own MP3's and ideally be entirely automated.

I currently have the following setup running on a VPS:

  • Azuracast - This provides me a streaming radio station that cycles through my entire library 24/7
  • Navidrome - This fills the gap of the Spotify-like interface where I can play specific tracks, albums, or playlists

I bootstrapped my library with a Python script that parsed a list of Spotify URL's and downloaded all of the tracks with the spotdl library. This allowed me to grab my liked tracks, the playlists I had created, as well as a large number of albums I wanted.

I then used ChatGPT to write two python scripts:

  • The first script runs using cron every Monday and uses SpotDL to grab the contents of my Discover Weekly playlist from Spotify. It puts all of the files into a folder with that weeks date and also creates a playlist file. This way I can easily browse that weeks playlist in Navidrome and decide what to keep. It also sends me an email on completion/error
  • The second script is a bit more complex. This one does the same end result but for all of my LastFM reccomendations. This is done by spinning up a headless Chrome browser with Selenium in a docker container. It then logs into my LastFM account, parses each reccomendation, and then uses pytube to download the video links, since LastFM just directly links to Youtube videos. This list should change as I continue scrobbling via Navidrome and other sources, but I still need to determine how often the cron job should run.

My next step is figuring out how to connect to Azuracast/Navidrome using the many subsonic compatible clients so I can have mobile playback and things like offline playback. I'm currently looking at substreamer for Android.

I'd also like to look into a more seamless way of picking out the tracks I want to keep and discard from the playlists in Navidrome. I'm considering writing something to check its SQL database for liked tracks in each playlist and automatically move those into the main folder/playlist that Azuracast is playing from.

This whole setup took me only a couple days to create, and largely relied on ChatGPT to write the scripts and dockerfiles. I'm a capable programmer but GPT-4 is absolutely OP if you know what you're trying to accomplish and how to debug its mistakes. That Selenium script only took me an hour from idea to completion and I never modified the code by hand, only prompted it for corrections/additions.

If anyone is interested I've uploaded all the scripts to a gist, you just need to go through and update with your credentials/URLs

You're viewing a single thread.

29 comments
29 comments