A robust, music downloader built with Python, designed for offline USB playback, especially optimized for car head units.
This tool intelligently:
- Downloads high-quality MP3 audio
- Cleans messy titles and filenames
- Prevents duplicates (even semantic ones)
- Tags music correctly (Title / Artist / Album / Cover Art)
- Handles interruptions safely (Ctrl+C)
- Maintains a persistent song history (โBrainโ)
- Works seamlessly with Spotify playlists, Apple Music playlists, and direct search queries
- Graceful shutdown on Ctrl+C
- Forced kill protection
- Automatic temp file cleanup
- Retry mechanism for unstable downloads
- Session logging (
session.log)
- Exact history matching
- Fuzzy similarity detection
- Token overlap safety (prevents false matches like โLoveโ vs โLove Storyโ)
- History pruning to keep performance fast
- Filename length limits (64 chars)
- Illegal character removal
- UTF-8 safe filenames
- Compatible with strict infotainment systems
- Category-based folders
- Clean filenames
- Auto metadata tagging via iTunes API
- Embedded album art
Music/
โโโ main.py
โโโ setup.bat
โโโ requirements.txt
โโโ README.md
- Windows 10 / 11
- Python 3.9+
- Internet connection
- yt-dlp
- ffmpeg
- spotipy
- selenium
- rich
- mutagen
- webdriver-manager
You already have a fully automated installer.
-
Double-click
setup.bat -
The script will:
- Check Python
- Create a virtual environment
- Install all dependencies
- Auto-install FFmpeg (via Winget)
- Launch the downloader
.bat file once.
To enable Spotify playlist downloads:
-
Go to ๐ https://developer.spotify.com/dashboard
-
Create an app
-
Copy:
- Client ID
- Client Secret
-
Paste them into
main.py:
SPOTIPY_CLIENT_ID = "YOUR_CLIENT_ID"
SPOTIPY_CLIENT_SECRET = "YOUR_CLIENT_SECRET"-
Launch via:
setup.bat -
Select a category:
[1] Kannada - New [2] Hindi [3] English [4] Others -
Paste one of the following:
- Spotify playlist link
- Apple Music playlist link
- YouTube link
- Song name (text search)
-
Sit back. The system will:
- Skip duplicates
- Retry failed downloads
- Clean filenames
- Tag music properly
- Press Ctrl + C once โ finishes current task safely
- Press Ctrl + C again โ force exit
No corrupted files. No broken MP3s.
- Full execution log
- Useful for debugging and audits
- Persistent memory of downloaded songs
- Prevents re-downloads across sessions
- Auto-pruned to last 5000 songs
Categories are fully user-editable. You do not need to change logic โ only folder names.
Open main.py and edit the FOLDERS dictionary:
FOLDERS = {
"1": ("Kannada - New", "Kannada New"),
"2": ("Hindi", "Hindi Bollywood"),
"3": ("English", "English Pop"),
"4": ("Others", "South Indian Mix"),
}- First value โ Folder name created on disk
- Second value โ Genre tag written into MP3 metadata
โ Rename a category:
"2": ("Hindi Classics", "Hindi Old")โ Add a new language:
"5": ("Tamil", "Tamil Songs")- Keep the number keys unique (
"1","2", etc.) - Avoid special characters in folder names
- Restart the program after editing
No other code changes are required.
Edit:
FOLDERS = {
"1": ("Kannada - New", "Kannada New"),
"2": ("Hindi", "Hindi Bollywood"),
...
}MAX_WORKERS = 4MAX_FILENAME_LEN = 64- Apple Music scraping depends on Appleโs page structure
- Requires Chrome for Selenium
- Not intended for DRM-protected content
โ Personal offline music collection โ USB playback in cars โ Clean, organized MP3 libraries โ Long-term daily usage without re-downloads
โ Streaming โ Commercial redistribution
Live terminal UI with per-song progress bars, system logs, and queue management.
