Skip to content

Automatically rename messy music files using their metadata tags. Transforms random filenames like `track1(128).mp3` into clean `Artist - Title.mp3` format.

Notifications You must be signed in to change notification settings

Hydroly/Music-Organizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Music File Organizer 🎵

A Python tool that automatically renames your music files using their metadata tags. Transform messy filenames like 156418671(2).mp3 into clean, organized names like Artist Name - Song Title.mp3.

✨ Features

  • Automatic Metadata Reading: Extracts artist and title information from music file tags
  • Smart Filename Cleaning: Removes invalid characters and formats filenames properly
  • Safe Operation: Dry-run mode to preview changes before applying them
  • Multiple Format Support: Works with MP3, FLAC, WAV, M4A, OGG, AAC, and more
  • Cross-Platform: Works on Windows, macOS, and Linux
  • User-Friendly: Both command-line and interactive modes available

📸 Before & After

Before:

music_folder/
├── 156418671(2).mp3
├── track1(128).mp3
├── unknown_song.flac
└── recording2023.m4a

After:

music_folder/
├── Taylor Swift - Love Story.mp3
├── The Beatles - Hey Jude.flac
├── Queen - Bohemian Rhapsody.m4a
└── Unknown Artist - recording2023.mp3

🚀 Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/music-name-fixer.git
    cd music-name-fixer
  2. Install dependencies:

    pip install music-tag

💻 Usage

Basic Interactive Mode

python music_name_fixer.py

Then enter your music directory path when prompted.

Command Line Options

Process a specific directory (dry run - preview only):

python music_name_fixer.py "/path/to/your/music"

Actually rename files:

python music_name_fixer.py --apply "/path/to/your/music"

Verbose output with detailed information:

python music_name_fixer.py --verbose "/path/to/your/music"

Show help:

python music_name_fixer.py --help

Advanced Examples

Process multiple directories:

# Process your downloads folder
python music_name_fixer.py --apply "~/Downloads/Music"

# Process current directory
python music_name_fixer.py --apply "."

# Process with detailed logging
python music_name_fixer.py --verbose --apply "/path/to/music"

🛠️ How It Works

  1. Reads Metadata: Extracts ID3 tags and other metadata from music files
  2. Sanitizes Filenames: Removes invalid characters (/, ?, *, etc.)
  3. Formats Consistently: Uses Artist - Title.ext format
  4. Handles Errors: Skips files with missing metadata and provides clear error messages
  5. Prevents Duplicates: Checks for existing files before renaming

📋 Supported File Formats

  • MP3 (.mp3)
  • FLAC (.flac)
  • WAV (.wav)
  • M4A (.m4a)
  • OGG (.ogg)
  • AAC (.aac)
  • Opus (.opus)

🐛 Troubleshooting

Common Issues

"No metadata found" errors:

  • Some files may not have proper ID3 tags
  • The script will use the original filename as a fallback

"File already exists" errors:

  • Multiple files might have the same artist and title
  • The script will skip these to prevent data loss

Permission errors:

  • Make sure you have read/write permissions for the music directory
  • On Windows, try running as Administrator
  • On Linux/macOS, check file permissions with ls -la

Getting Help

If you encounter any bugs or have questions:

  1. Check the verbose output with --verbose flag
  2. Ensure your music files have proper metadata tags
  3. Try the dry-run mode first to preview changes

🙏 Acknowledgments

  • Built with music-tag for metadata reading
  • Thanks to all contributors and bug reporters

Note: Always backup your music files before running the tool with --apply flag. The developers are not responsible for any data loss.


⭐ If this project helped you, please give it a star! ⭐

About

Automatically rename messy music files using their metadata tags. Transforms random filenames like `track1(128).mp3` into clean `Artist - Title.mp3` format.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages