Skip to content

Small Node.js program that automatically creates/updates Spotify playlists from the latest setlists of your favourite live bands!

Notifications You must be signed in to change notification settings

ehenon/LastSetlistify

Repository files navigation

LastSetlistify 🎶

LastSetlistify is a small Node.js program that automatically creates/updates Spotify playlists from the latest setlists of your favourite live bands!

Scheme

The idea behind this program is to keep your Spotify playlists varied, changing, always in line with the latest performances of your favourite live artists (which often contain their biggest hits as well as new material ✌️).

Prerequisites 📋

The only prerequisite to use this program is to have Node.js on your machine. If you don't have it yet, you can download and install it through the official website. LastSetlistify has been tested and works with Node.js 16.16.0 latest LTS version.

Installation 🔧

Open a terminal and clone the repository wherever you want:

git clone https://github.com/ehenon/LastSetlistify.git

Navigate to the created directory and install the dependencies:

cd LastSetlistify
npm install

Create an app for LastSetlistify in your Spotify for Developers dashboard and retrieve its "Client Id" and "Client Secret" by clicking on it. On the same page, click on "Edit settings" to add an accepted and valid redirect URI: http://localhost:8888/callback. This url will be used as a callback at the time of user authentication and is already predefined in the environment variables.

Create a .env file based on .env.sample, and fill it with your own values:

cp .env.sample .env

Some details about the environment variables:

# Variable name Required Description
1 USER_LOGIN * Your Spotify account user login
2 USER_PASSWORD * Your Spotify account user password
3 SETLISTFM_API_KEY * Setlist.fm API Key you can generate here (link for logged in users only)
4 SPOTIFY_CLIENT_ID * App Client Id you retrieved just before
5 SPOTIFY_CLIENT_SECRET * App Client Secret you retrieved just before
6 SPOTIFY_CALLBACK_URI * Callback URI for authentication, predefined to http://localhost:8888/callback
7 SPOTIFY_USER_ID * Spotify username you can find on your Spotify Account page

Create an artists.json file with your favourite live artists based on artists.sample.json:

cp artists.sample.json artists.json

This JSON simply consists of an array containing one object per artist:

[
    {
        "name": "Metallica", // Name of the artist
        "mbid": "65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab" // MusicBrainz id
    },
    {
        "name": "Municipal Waste", // Name of the artist
        "mbid": "b5a31e9b-1fa2-45f9-91f5-b3a25fb38038" // MusicBrainz id
    },
    ...
]

NB: mbid fields correspond to the unique identifiers of the artists in the MusicBrainz database. You can for example find them in the URL of the artist pages.

Usage 🚀

To launch the application locally, open a terminal from the root of the directory and run the following command:

npm run dev

You can follow the progress of the program thanks to the logs appearing in the console.

If you want to build the program and run the compiled code separately, please note that the following commands are also available:

npm run build
npm run start

These commands allow you to compile the program in a dist folder using the Babel transcompiler, and then run the compiled program.

Some rules to know about the program:

  • If no artists.json file is found, the program stops immediately.
  • If an environment variable is missing, the program stops immediately.
  • If a new setlist is found but contains less than 10 songs, the program does not create a new playlist.
  • If the last available setlist for an artist has already been transformed into a playlist, it is not re-created.
  • If a new setlist is available for an artist, the generated playlist will automatically overwrite your old one.
  • When creating a playlist, the program first searches for the songs of the artist in question. If a song is a cover of another artist, the program will first search for an official version of the cover before searching for the original version.

Alternatives 👀

As explained above, this project allows you to automatically generate Spotify playlists from the latest setlists of your favourite artists. That being said, this is a Node.js script only, and not a real web or mobile application. So it's intended for a more development-oriented audience (to adapt it, or to run it automatically every week, with a time-based job scheduler for example).

The interest of this project lies essentially in the automation of playlist creation. The user has nothing to do, all his favourite live artists are browsed and processed by the program without any action on his side.

If you want to create Spotify playlists from setlists manually, web and mobile applications already exist and are much more suitable for a non-developer audience:

Contributing ✒️

This project is a free and open personal project. Pull requests are welcome (targeting the develop branch). For major changes and problems encountered, feel free to open an issue to discuss what you would like to change/fix. Concerning the commits standards, please follow the conventional commits with these possible types: feat:, fix:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test:.

Built With 🔨

About

Small Node.js program that automatically creates/updates Spotify playlists from the latest setlists of your favourite live bands!

Topics

Resources

Stars

Watchers

Forks