RegsonDR / spotify-save-playlists-cron

Save Spotify's auto-generated playlists automatically - Powered by Github Actions.
MIT License
26 stars 41 forks source link

Support multiple playlists on defined weekdays #3

Closed Reiszecke closed 1 year ago

Reiszecke commented 1 year ago

Hey man, first of all tysm for the repo! I’ve wasted so much time with "offline mode" workarounds to recover invalidated playlists that I took a minute to extend your repo’s functionality a bit.

There are a few other playlists that Spotify delivers to you on a weekly (or even daily) basis. One example is each user's Release Radar. I didn’t want to hardcode more env variables to your project so I extended it by another option: Passing an array of playlists to include in the sync.

Noteworthy changes:

process_multiple_playlists() parses a JSON from the MULTIPLE_PLAYLIST_CONFIG env variable. You can find some info on the JSON’s structure in multi_playlist_builder.py. For each playlist in there, you can set source and target along with a weekday to run at which makes sense for every playlist that doesn’t update on Monday.

~Haven’t tested the GitLab Actions cronjob configuration yet, let’s see if it triggers and works tomorrow (Release Radar).~ Works perfectly :)

Reiszecke commented 1 year ago

Updating this, the action has triggered and it did actually save the non-discover-weekly playlist 🎉🎉

So the MULTIPLE_PLAYLIST_CONFIG seems to work in this PR. I'm very confident the legacy functionality will also trigger fine on Monday (tested it previously by hardcoding the day to the current day to verify) so from my side it's ready to merge.

Will update the README.md accordingly once you've commented what way you'd like it to be included.

RegsonDR commented 1 year ago

Hey! Nice one! Thanks for your PR, this looks good. 👍

I'm away for a few weeks, but when I get back I'll remove the default functionality as well since the multi-week playlist config can cover this now. As for the readme, if you could update the repo's introduction & "Initial Set Up" section that would be great, but I can do that too when I get back (it's a bit awkward for me to do it from phone). I'll also rename the repository from "spotify-save-discover-weekly" to "spotify-save-playlists-cron" or something similar.🙂

RegsonDR commented 1 year ago

I've now removed the old code using DISCOVER_WEEKLY_IDs and updated the readme with new usage instructions.

Reiszecke commented 1 year ago

Bro I hope you're doing well - I wanted to comment on whether you really want to introduce a breaking change (since forks won't get notified that their old WEEKLY parameter doesn't work anymore) and then you caught me a bit off guard when "can you do this in a few weeks" turned into "4 days" haha

Thank you for your work man, will try your upstream commits soon