A lightweight, open-source Python web application that generates highly customizable, "Spotify Wrapped"-style infographics based on your listening history. It seamlessly integrates with both Last.fm and Spotify API, utilizing Generative AI to accurately determine your music taste.
- Dual Platform Support: Pull your weekly, monthly, or yearly listening stats seamlessly via Last.fm or Spotify API.
- AI-Powered Vibe & Lyrics Extraction: Uses Google Gemini (with fallbacks to OpenRouter/Groq) to intelligently extract iconic lyrics from your top tracks and accurately determine your specific sub-genre/vibe.
- Pixel-Perfect Image Rendering: Dynamically draws gorgeous, Figma-styled posters using
Pillow, featuring auto-shrinking typography and full support for CJK (Chinese, Japanese, Korean) characters. - Highly Optimized for Low-End Servers: Designed to run flawlessly on 1GB RAM VPS. Uses
Gunicorn + Geventfor asynchronous non-blocking workers andDBUtilsfor smart MySQL Connection Pooling.
- Backend: Python, Flask, Spotipy, Gunicorn, Gevent
- Image Processing: Pillow, Pilmoji
- Database Management: MySQL (Production), SQLite (Local/Development)
- AI Engine: Google Generative AI
- Infrastructure: Docker & Docker Compose
git clone https://github.com/kenthoeng/music-wrap.git
cd music-wrapCopy the configuration template and fill in your actual API keys.
cp .env.example .env
nano .env(Make sure to obtain your API Keys from Last.fm, Spotify Developer Dashboard, and Google AI Studio).
Ensure Docker and Docker Compose are installed on your machine/VPS, then simply run:
docker compose up -d --buildCheck the application logs to ensure everything is running smoothly:
docker logs -f music_wrap_appThe app will be live at http://localhost:5000 (or your server's IP address).
If you want to run it without Docker for local modification:
pip install -r requirements.txt
python app.pyDue to Spotify's updated Developer Policy (February 2026), third-party apps running in "Development Mode" are strictly limited to 5 users. The Spotify login feature will yield a 403 Forbidden error for unregistered users. To grant access, the developer must manually whitelist the user's Spotify email address in the Spotify Developer Dashboard.
For public usage, it is highly recommended to rely on the Last.fm integration as it has no user limitations.
Sebuah aplikasi web berbasis Python yang ringan dan open-source untuk menghasilkan infografis statistik musik ala "Spotify Wrapped". Terintegrasi dengan Last.fm dan Spotify API, serta memanfaatkan AI untuk menganalisis selera musikmu secara akurat.
- Dukungan Dua Platform: Tarik data statistik (mingguan, bulanan, tahunan) melalui Last.fm atau akun Spotify-mu.
- Analisis Genre & Lirik via AI: Menggunakan Google Gemini (dengan cadangan OpenRouter/Groq) untuk mengekstrak potongan lirik paling ikonik dan menganalisis sub-genre musikmu.
- Mesin Gambar Presisi Tinggi: Menggambar poster secara dinamis menggunakan
Pillowyang dilengkapi dengan tipografi adaptif dan dukungan penuh huruf Asia (Jepang/Korea). - Sangat Ringan untuk Server Kecil: Dirancang khusus agar anti-crash di VPS dengan RAM 1GB menggunakan arsitektur
Gunicorn + Geventserta MySQL Connection Pooling.
1. Kloning Repositori
git clone https://github.com/kenthoeng/music-wrap.git
cd music-wrap2. Konfigurasi Sistem Salin file templat rahasia dan masukkan API Key milikmu.
cp .env.example .env
nano .env3. Jalankan dengan Docker (Rekomendasi Server) Jalankan perintah ini di terminal VPS/lokalmu:
docker compose up -d --buildUntuk memantau log aplikasi secara real-time:
docker logs -f music_wrap_appAplikasi bisa langsung diakses melalui http://localhost:5000.
Berdasarkan aturan baru Spotify Developer (Februari 2026), aplikasi dalam mode Development dibatasi maksimal hanya 5 pengguna. Pengguna yang tidak terdaftar akan mengalami error 403 Forbidden saat mencoba login. Agar bisa dipakai oleh temanmu, kamu harus mendaftarkan email akun Spotify mereka secara manual ke whitelist di Dashboard Spotify milikmu.
Untuk penggunaan bebas oleh publik, sangat disarankan menggunakan jalur input Last.fm.
👨💻 Built with ☕ and Open-Sourced by Hamnurz
Feel free to fork, modify, and contribute to this repository!