A lightweight Spotify player/visualizer built in Python - recommended for low power computers such as Raspberry Pi to show your Now Playing song and the last listened song!
Spotify Visualizer is a Python program that creates a dynamic visual display of the currently playing song on Spotify. It utilizes the Spotify API and various libraries to fetch album art, extract dominant colors, and display song information in a visually appealing manner.
Background color changes depending on the album art. Text color changes for best contrast and readability. Advertisment Detection for non-Premium users.- Background color adaptation based on the dominant color of the album art.
- All text changes to either Black or White dependent on the dominant color for the best contrast.
- Real-Time Song Display: Stay in the groove by keeping track of the song, artist, and album name as it plays on your Spotify account in real-time.
- Last Played Song: Keep track of your listening history with the ability to monitor the last played song, ensuring you never miss a beat.
- Dynamic Album Art: Enjoy a stunning display of the current track's album art as the background, making each song come to life.
- Color Synchronization: The application dynamically changes the background color based on the dominant color of the album art, creating a visually captivating experience.
- Advertisement Handling: Seamlessly transition between your favorite tracks and Spotify ads, ensuring you're always informed about what's playing.
- Python 3.x
- Python libraries:
requests
,spotipy
,PIL
,io
,pygame
,fast_colorthief
- Spotify developer account with client ID and client secret.
- A machine with a screen to display the visualization.
- Clone this repository to your local machine:
git clone https://github.com/your-username/spotify-visualizer.git
- Install the required Python libraries:
pip install requests spotipy Pillow pygame colorthief
To allow authorisation to your track data, you'll need to generate Spotify API keys. You can do this by logging in to the Spotify Dashboard creating an app.
Call the application 'SpotiSync'.
Set the Redirect URI as the URL in the script (default is http://localhost:1234). This must be set else Spotify won't authorise SpotiSync.
Important: The Redirect URI entered in this field must match the URL of the script exactly, or you'll receive authorisation errors. A common issue is that Spotify will automatically add a trailing slash to the URL upon saving. For example: http://localhost:1234
vs http://localhost:1234/
.
You can leave the other settings (Callback URL, Bundle IDs etc) blank.
Copy down the Client Secret and Client ID and save your app in the Spotify Dashboard.
- Update the following variables in the script with your Spotify API credentials:
SPOTIPY_CLIENT_ID = 'your-client-id'
SPOTIPY_CLIENT_SECRET = 'your-client-secret'
- Run the program using Python:
python main.py
-
The program will display the current song playing on your Spotify account in real-time.
-
You can press the Spacebar key to exit the program.
Developed by Frankie Pang.
This project is open-source and available under the MIT License. You are free to use, modify, and distribute it.