Rust Spotify Playlist Maker
Rust Program Documentation
This Rust program automates playlist creation on Spotify using the rspotify library. It authenticates users, searches for songs, and creates a playlist with predefined tracks. Edit the playlist name and song selection choices inside the code at line 66 and 70 of spotify_playlist_maker/src/main.rs.
desktop/src/ ← frontend (index.html, main.js, styles.css)
desktop/src-tauri/ ← Tauri backend
src/lib.rs ← has load_songs, save_songs, make_playlist ✅
src/main.rs ← calls desktop_lib::run() ✅
Cargo.toml ← depends on spotify_playlist_maker = { path = "../.." } ✅
src/lib.rs ← root library (the Spotify logic lives here)
src/main.rs ← CLI
Features
- OAuth2 authentication with Spotify (no need to manually enter tokens)
- Automated playlist creation
- Song search and addition
- Uses
tiny_httpto handle the authentication callback automatically
Prerequisites
Before running the program, make sure you have the following installed:
- Rust and Cargo (if not already installed)
|
- Spotify Developer Account
- Go to Spotify Developer Dashboard
- Create a new app
- Add the following Redirect URIs:
http://127.0.0.1:8888/callback http://localhost:8888/callback - Copy the Client ID and Client Secret.
Installation and Setup
Install via Cargo
https://crates.io/crates/spotify_playlist_maker
Create a .env file for your API credentials
Paste the following into the file:
SPOTIFY_CLIENT_ID="your_client_id_here"
SPOTIFY_CLIENT_SECRET="your_client_secret_here"
SPOTIFY_REDIRECT_URI="http://127.0.0.1:8888/callback"
SPOTIFY_SCOPES="playlist-modify-public playlist-modify-private user-library-read"
Save the file (CTRL + X Enter).
Running the Program
- Build and run the program
- Follow the authorization link in the terminal
- Approve the application on Spotify
- Once approved, the program will automatically create the playlist and add songs
Testing & CI/CD
This project includes:
- Unit tests for core logic (
cargo test) - Integration tests for API calls
- GitHub Actions for automated testing on every push
Built With
- Rust
- rspotify (Spotify API client)
- tiny_http (to handle OAuth2 callback)
License
This project is licensed under the MIT License.