Skip to content

yan-sln/MP3-Co

Repository files navigation

Audio Library Tools

A collection of Python scripts to clean, organize, and manage your music library.
Supports MP3 and OPUS formats with functionalities for duplicate detection, renaming, tagging, and library classification.


Available Scripts

1. mp3inator.py

A music library organizer that classifies audio files by comparing them against an existing library.

  • Cleans and normalizes filenames (removes unwanted keywords and symbols)
  • Compares source files with a reference library (biblioPath)
  • Copies matches into an output directory
  • Handles duplicates and logs classification details
  • Provides a "second chance" mode with looser matching rules

2. mp3_anti_duplicator.py

Detects and logs duplicate MP3 files in a given directory.

  • Uses fuzzy filename matching (difflib.SequenceMatcher)
  • Generates an exeLog file listing suspected duplicates
  • Helps keep libraries clean by identifying near-identical files

3. audio_file_renamer.py

Utility script to rename MP3 files according to specific rules.

  • Example: remove download site aliases (y2meta.com -)
  • Example: append or prepend artist names
  • Example: swap Artist - Song into Song - Artist
  • Non-MP3 files are moved into a unknownFiles folder

4. mp3_tag_cleaner.py

Cleans MP3 filenames and writes proper ID3 tags using mutagen.

  • Expected filename format: Song - Artist.mp3
  • Updates ID3 tags:
    • title → Song
    • artist → Artist
  • Renames files to ensure consistency
  • If format is unknown → file moved to unknownDir
  • If tagging/renaming fails → file moved to unknownFiles

5. opus_tag_cleaner.py

Same functionality as mp3_tag_cleaner.py, but for OPUS files using music-tag.

  • Expected filename format: Song - Artist.opus
  • Writes metadata tags:
    • title → Song
    • artist → Artist
  • Handles unknown and problematic files by moving them to unknownDir or unknownFiles

Requirements

Install the required dependencies:

pip install mutagen music-tag
  • Works with Python 3.7+
  • Uses only standard libraries + mutagen + music-tag

Usage

Run any script from the terminal:

python mp3inator.py
python mp3_deduplicator.py
python audio_file_renamer.py
python mp3_tag_cleaner.py
python opus_tag_cleaner.py

Each script will ask for a directory path containing your music files.


Folder Structure

During execution, the scripts may create these folders:

  • unknownDir/ → files with unexpected filename formats
  • unknownFiles/ → files that caused errors or are not supported

Notes

  • Make a backup of your music library before using these tools.
  • These scripts modify filenames and metadata directly.
  • They are designed for personal use and tested on small to medium libraries.

About

A collection of Python scripts to clean, organize, and manage your music library. Supports MP3 and OPUS formats with functionalities for duplicate detection, renaming, tagging, and library classification.

Resources

License

Stars

Watchers

Forks

Contributors

Languages