jetzlstorfer / spotify-yearly-discoveries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spotify Discoveries (per year)

I wanted to know which songs I've discovered in 2022 and added to my playlists that are actually from the year 2022. Therefore I made this small program.

Why?

A lot of "best of 202x" / "top 202x songs" / "best artists 202x" lists contain songs that might have received heavy airplay in 202x but are actually not even from 202x but probably 202x-1 or even earlier. This is totally fine. But for myself I wanted to find out which songs I have discovered in 2022 that are actually from 2022.

What it's doing

The program checks all playlists that contain the term YEAR_TO_CHHECK,eg. "2022" and in all playlists that match this expression it looks for song that are actually from the year 2022 (or your desired year) and check if they have been added to your library (❤️ in Spotify). If both is true (in this example: song is from 2022 + you like it) it adds the songs to the specified playlist.

Update: in the latest version it is also possible to add songs to the playlist that are not added to your library (🤍 in spotify), use ENV variable ONLY_LOVED_SONGS.

That's it.

Here are my playlists for 2022, 2021, 2020, 2019.

How to use it

  • Create a Spotify application to receive a client id and secret
  • Create a new (empty) playlist for the songs to be stored in
  • Have Go ready on your machine (I tested with Go 1.15.3+ and latest with 1.19.2)
  • Adapt values in the env file and copy or rename it to .env

Environment variables

SPOTIFY_ID= #this is the  spotify client ID you need. register your application here: https://developer.spotify.com/
SPOTIFY_SECRET= #this is the spotify client secret
PLAYLIST_ID= #playlist ID in a format like 4AJnjP36kH39gQhgZFL8Ff
TOKEN_FILE=mytoken.txt 
LOG_FILE=log.txt
ONLY_LOVED_SONGS= # true if only songs that are added already to your library should be considered, false otherwise
YEAR_TO_CHECK=2022

Run it

  1. Generate and store the token

    make token
    
  2. Run the program

    make run
    
  3. Check your playlist 🕺

    make open-browser
    

    If this command doesn't work, check the playlist manually either in the browser or in your Spotify client.

Contribute

Feel free to open a PR or issue.

I'm happy to hear your feedback via @jetzlstorfer.

About


Languages

Language:Go 98.2%Language:Makefile 1.8%