[SOLVED] Solution: https://lemmy.ml/comment/4317564
I am doing all of this using ChatGPT, I know enough bash to understand the script partially, but not enough to write the script myself.
I recently posted bash script(click) to download songs on spotify
using Spotdl
Updated Post
This is all good, but I am not trying to download whole playlists and I want to make sure to
- Not download any songs multiple times by comparing the files you are trying to download with the songs you have downloaded already.
- Add the songs’
URL
to theArchieve_file
so it doesn’t download it again. i.e., compare and if present, exit loop, if not present in file, download and add link to the file.
This was easier when I was dealing with only song
links and not playlist
links. But now, playlists complicates the equation, but if I can achieve this, I can basically add this script to crontab
and make sure I always have a local copy of the songs in my playlist and these playlists would be checked regularly for new downloads and new songs would be downloaded. This is really cool!
Now, the complications I am facing,
I don’t know how to get the URLs of the spotify songs
out of spotify playlists
using spotdl
or any cli package. If I can do this then, I can make the script go through each link clean
the link of unncessary attributes and then download it or if it’s downloaded already, move on to the next song.
Now, I don’t know how to do it. It would be very helpful if you guys could share any scripts that you have which will achieve this effect or help me get the song URL’s from a playlist using a cli package.
PS: I might need some time to reply, I might sleep rn Thank you for your help! ___
Is the script you posted pseudocode? The ‘spotdl’ I downloaded with pip doesn’t have a --list option.
If we’ve both got the same program, then I wouldn’t bother with any script, and just use spotdl’s ‘sync’ option.
Navigate to your download directory.
Run it once:
spotdl sync https://open.spotify.com/playlist/5qevB6grI6y2SuVcPTelZA --save-file myplaylist.spotdl
Run it in future to download new stuff:
spotdl sync https://open.spotify.com/playlist/5qevB6grI6y2SuVcPTelZA --sync-without-deleting --save-file myplaylist.spotdl
You can see that
myplaylist.spotdl
is just a JSON file listing everything that’s downloaded. When it’s run again, it won’t re-download anything that’s already in there, and the--sync-without-deleting
option stops it from deleting local files that have been removed from the playlist.I am trying to run it. spotdl apparently doesn’t have a --list option generally. It’s a pip package right? you can’t download it any other way?
damn! it might have worked. Thank you mate!
edit, it worked, thank you very much!
ps: it works like magic! thank you! you are right, script ain’t necessary in this case.
I don’t know what that is. It’s bash. the shebang line is
#!/bin/$USER