Spotify Playlist Duplicate Manager is a Golang application that helps you remove all duplicate songs from a specified Spotify playlist. This project utilizes the Spotify Web API to access and manipulate playlists. It is designed to run as a standalone application or deployed on a server for automated playlist maintenance.
- Connects to the Spotify Web API using OAuth2 authentication.
- Retrieves the list of songs in a specified playlist.
- Identifies and removes duplicate songs, keeping only unique tracks in the playlist.
- Supports handling large playlists efficiently through parallelization.
- Go version 1.16 or later installed.
- Spotify Developer Account: Sign up here
-
Clone the repository:
git clone https://github.com/yourusername/spotify-playlist-duplicate-remover.git
-
Install dependencies:
go mod download
-
Create Spotify App
-
Once on the dev dashboard click Create App
-
Fill in the required fields (name, description, redirect uri)
- RedirectUri is the uri spotify will redirect the user to after successful authentication.
Ex: http://localhost:8080/callback
- RedirectUri is the uri spotify will redirect the user to after successful authentication.
-
-
Set up environment variables:
-
Create a
.env
file in the project root. Use.env.example
as a templatecp .env.example .env
-
Update
.env
with your credentials
Key Description SPOTIFY_ID
your spotify client id SPOTIFY_SECRET
your spotify client secret BASE_URI
baseUri for callback endpoint to be hosted at PORT
port used for callback endpoint Note:
BASE_URI
andPORT
must match theRedirectUri
set on the spotify app in Step 3SPOTIFY_ID=spotify_id SPOTIFY_SECRET=spotify_secret BASE_URI=localhost PORT=8080
-
-
Running the Application:
You can run the application with the following flags:
- To remove duplicates from a specific playlist, use the -playlistIds flag with a comma-separated list of playlist IDs:
go run main.go -playlistIds "3cEYpjA9oz9GiPac4AsH4n,..."
- To remove duplicates from all playlists, use the -all flag:
go run main.go -all
The application will authenticate with the Spotify Web API using the provided credentials and then proceed to remove duplicate songs from the specified playlists.
Note: If you only pass one playlist ID to the -playlistIds flag, the application will treat it as a single ID.