Skip to content

blazturk/spotify-metadata-to-mp3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Spotify Metadata to MP3

A simple Python script that fetches metadata (artist, album, track title, and cover art) from a Spotify track URL and embeds it into an existing MP3 file. The file is then renamed using the format:

Artist - Track Name.mp3

Features

  • Fetches track metadata from Spotify (artist, album, title).
  • Embeds album cover art into the MP3 file.
  • Automatically renames the file for proper organization.
  • Easy to run directly from the command line.

Requirements

  • Python 3.7+
  • Spotify API credentials (Client ID & Secret)

Installation

Clone the repository and install dependencies:

git clone https://github.com/blazturk/spotify-metadata-to-mp3.git
cd spotify-metadata-to-mp3

# (Optional) create a virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
venv\Scripts\activate     # Windows

# Install dependencies
pip install -r requirements.txt

Dependencies used in the script:

Configuration

Create a .env file in the project root with your Spotify API credentials:

SPOTIPY_CLIENT_ID=your_client_id_here
SPOTIPY_CLIENT_SECRET=your_client_secret_here
SPOTIPY_REDIRECT_URI=http://localhost:8888/callback

Get these credentials from the Spotify Developer Dashboard.

Usage

Run the script with:

python app.py

You’ll be prompted for:

  1. Spotify track URL
    Example:
    Enter Spotify track URL : https://open.spotify.com/track/123456789
    
  2. Path to your MP3 file
    Example:
    Enter path to audio file : ./music/mysong.mp3
    

The script will:

  • Fetch metadata from Spotify.
  • Embed artist, album, title, and cover art into the MP3.
  • Rename the file to:
    Artist - Track Name.mp3
    

Example

Enter Spotify track URL : https://open.spotify.com/track/3n3Ppam7vgaVa1iaRUc9Lp
Enter path to audio file : ./downloads/test.mp3

After running, the file will be updated and renamed to:

Daft Punk - Harder, Better, Faster, Stronger.mp3

License

This project is licensed under the MIT License – see the LICENSE file for details.

About

Script that adds metadata from a Spotify track to MP3 file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages