this post was submitted on 16 Jul 2023
133 points (98.5% liked)

Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ

54565 readers
466 users here now

⚓ Dedicated to the discussion of digital piracy, including ethical problems and legal advancements.

Rules • Full Version

1. Posts must be related to the discussion of digital piracy

2. Don't request invites, trade, sell, or self-promote

3. Don't request or link to specific pirated titles, including DMs

4. Don't submit low-quality posts, be entitled, or harass others



Loot, Pillage, & Plunder

📜 c/Piracy Wiki (Community Edition):


💰 Please help cover server costs.

Ko-Fi Liberapay
Ko-fi Liberapay

founded 1 year ago
MODERATORS
 

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 are viewing a single comment's thread
view the rest of the comments
[–] Zetaphor@zemmy.cc 8 points 1 year ago (1 children)

ChatGPT and GPT in general is like having a pair programming intern who simultaneously knows everything but is also capable of making really dumb and obvious mistakes. When combined with the new code interpreter it's crazy powerful, but at the end of the day to get the best results you need a skilled human operator guiding its outputs.

That said, give it a shot as it can definitely help you to improve your skill by explaining what a block of code does.

[–] user@lemmy.one 1 points 1 year ago