This project is a Python script designed to enhance your music library by automatically adding genre metadata to FLAC files. Using the Spotify API, the script fetches genre information based on the track's title and artist metadata and updates the FLAC files accordingly.
Your FLAC files MUST contain valid title and artist tags. Use a tool like MusicBrainz Picard to help automate this first process.
- Automatic Genre Detection: Queries Spotify's database to fetch genre information.
- Metadata Update: Writes genre data into FLAC file metadata.
- Skip Existing Genres: Provides real-time logs during processing.
- Batch Processing: Processes all FLAC files in the working directory and all subdirectories.
- Spotify Developer Account
Sign up at Spotify's Developer Dashboard and create a new app to get your:
Client ID
Client Secret
- Python Libraries
Install the following Python packages:
pip install spotipy mutagen
- Download the script from this repository
- Add your API Credentials:
- Open the script in your choice of text editor.
- Replace
your_client_id
andyour_client_secret
with YOUR Spotify API credentials.
- Copy the Python file to your music directory
- Run the file using the following command:
python genre_spotify.py
- The script will:
- Search for FLAC files.
- Query Spotify for genre metadata using the
title
andartist
tags. - Update the FLAC file's metadata with the retrieved genre(s).
- Provide a summary of processed and skipped files.
FLAC Genre Tagger with Spotify
Created by SteadyStatus21, uses Spotify's API
🔎📁 Scanning for FLAC files in: /path/to/folder
==================================================
[🔎 - SEARCH] example.flac - Searching genre for: Song Title by Artist Name
[✅ - UPDATE] example.flac - Found genre(s): rock, alternative
[⏩ - SKIP] another_example.flac - Genre already exists: pop
[❓ - MISSING METADATA] missing_metadata.flac - Missing title or artist. Skipping.
==================================================
🏁✅ - Finished processing! 1 file(s) updated, 2 file(s) skipped.
All done!
- Ensure your FLAC files have
title
andartist
metadata filled. Files missing this information will be skipped entirely. - The script includes a 1-second delay between Spotify API calls to prevent rate-limiting.
This project is licensed under the GNU General Public License v3.0.
This software is provided "as is," without any warranties, express or implied, including but not limited to fitness for a particular purpose or non-infringement. The author (SteadyStatus21) is not liable for any damages, data loss, or issues arising from its use. Use at your own risk.
Feel free to fork the repository and submit your own pull requests! Contributions and improvements are always welcome!