Skip to content

GODSROBOT/Music-Downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽต Music Downloader (Car-Optimized Edition)

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

๐Ÿš€ Key Features

๐Ÿ” Stability & Safety

  • Graceful shutdown on Ctrl+C
  • Forced kill protection
  • Automatic temp file cleanup
  • Retry mechanism for unstable downloads
  • Session logging (session.log)

๐Ÿง  Smart Duplicate Detection

  • Exact history matching
  • Fuzzy similarity detection
  • Token overlap safety (prevents false matches like โ€œLoveโ€ vs โ€œLove Storyโ€)
  • History pruning to keep performance fast

๐Ÿš— Car Head-Unit Optimized

  • Filename length limits (64 chars)
  • Illegal character removal
  • UTF-8 safe filenames
  • Compatible with strict infotainment systems

๐Ÿ“ฆ Organized Library

  • Category-based folders
  • Clean filenames
  • Auto metadata tagging via iTunes API
  • Embedded album art

๐Ÿ“ Project Structure

Music/
โ”œโ”€โ”€ main.py
โ”œโ”€โ”€ setup.bat
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

โš™๏ธ Requirements

Mandatory

  • Windows 10 / 11
  • Python 3.9+
  • Internet connection

Automatically Installed

  • yt-dlp
  • ffmpeg
  • spotipy
  • selenium
  • rich
  • mutagen
  • webdriver-manager

๐Ÿ› ๏ธ One-Click Setup (Recommended)

You already have a fully automated installer.

โ–ถ๏ธ Steps

  1. Double-click

    setup.bat
    
  2. The script will:

    • Check Python
    • Create a virtual environment
    • Install all dependencies
    • Auto-install FFmpeg (via Winget)
    • Launch the downloader

โš ๏ธ Important: If FFmpeg installs for the first time, restart the .bat file once.


๐Ÿ”‘ Spotify Setup (Optional but Recommended)

To enable Spotify playlist downloads:

  1. Go to ๐Ÿ‘‰ https://developer.spotify.com/dashboard

  2. Create an app

  3. Copy:

    • Client ID
    • Client Secret
  4. Paste them into main.py:

SPOTIPY_CLIENT_ID = "YOUR_CLIENT_ID"
SPOTIPY_CLIENT_SECRET = "YOUR_CLIENT_SECRET"

๐ŸŽฎ How to Use

  1. Launch via:

    setup.bat
    
  2. Select a category:

    [1] Kannada - New
    [2] Hindi
    [3] English
    [4] Others
    
  3. Paste one of the following:

    • Spotify playlist link
    • Apple Music playlist link
    • YouTube link
    • Song name (text search)
  4. Sit back. The system will:

    • Skip duplicates
    • Retry failed downloads
    • Clean filenames
    • Tag music properly

โ›” Graceful Shutdown

  • Press Ctrl + C once โ†’ finishes current task safely
  • Press Ctrl + C again โ†’ force exit

No corrupted files. No broken MP3s.


๐Ÿงพ Logs & History

session.log

  • Full execution log
  • Useful for debugging and audits

song_history.json

  • Persistent memory of downloaded songs
  • Prevents re-downloads across sessions
  • Auto-pruned to last 5000 songs

๐Ÿงฉ Customization Guide

โœ๏ธ Change / Add Categories (Very Easy)

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"),
}

How it works:

  • First value โ†’ Folder name created on disk
  • Second value โ†’ Genre tag written into MP3 metadata

Examples:

โœ… Rename a category:

"2": ("Hindi Classics", "Hindi Old")

โœ… Add a new language:

"5": ("Tamil", "Tamil Songs")

โš ๏ธ Important rules:

  • 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.

Change Folder Names

Edit:

FOLDERS = {
    "1": ("Kannada - New", "Kannada New"),
    "2": ("Hindi", "Hindi Bollywood"),
    ...
}

Increase Parallel Downloads

MAX_WORKERS = 4

โš ๏ธ Increase cautiously โ€” YouTube throttles aggressively.

Change Filename Length Limit

MAX_FILENAME_LEN = 64

โš ๏ธ Known Limitations

  • Apple Music scraping depends on Appleโ€™s page structure
  • Requires Chrome for Selenium
  • Not intended for DRM-protected content

๐Ÿ Best Use Case

โœ” Personal offline music collection โœ” USB playback in cars โœ” Clean, organized MP3 libraries โœ” Long-term daily usage without re-downloads

โŒ Streaming โŒ Commercial redistribution


Happy listening. ๐Ÿš—๐ŸŽถ

๐Ÿ“ธ Preview

Live terminal UI with per-song progress bars, system logs, and queue management.

Music Downloader UI Preview

About

Music Downloader From any Playlist { Youtube , Apple Music , Spotify }

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors