4 releases
new 0.1.5 | Mar 10, 2025 |
---|---|
0.1.2 | Mar 9, 2025 |
0.1.1 | Mar 9, 2025 |
0.1.0 | Mar 8, 2025 |
#83 in Multimedia
100 downloads per month
17KB
92 lines
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 71 of spotify_playlist_maker/src/main.rs
.
Features
- OAuth2 authentication with Spotify (no need to manually enter tokens)
- Automated playlist creation
- Song search and addition
- Uses
tiny_http
to handle the authentication callback automatically
Prerequisites
Before running the program, make sure you have the following installed:
- Rust and Cargo (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- 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
nano .env
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 → Y → Enter
).
Running the Program
- Build and run the program
cargo run
- 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.
Maintained by
Dependencies
~9–17MB
~183K SLoC