A collection of Python scripts for downloading music from YouTube and tagging MP3 files with metadata from Discogs and lyrics from Genius.
- Python 3.10+
- FFmpeg (for audio extraction)
- API keys for Discogs and Genius
- Install dependencies:
pip install -r requirements.txt- Create a
secrets.inifile based onsecrets_example.ini:
[API]
key = your_discogs_api_key
genius_key = your_genius_api_key
[USER]
name = your_name
provider = your_provider
[APP]
appname = Buccaneer
version = 1.0- Configure FFmpeg path in individual scripts (some scripts have hardcoded paths)
Downloads YouTube playlists as MP3 files and tags them with YouTube metadata and optional Discogs metadata.
Parameters:
- Interactive prompts for:
- Playlist URL
- Whether to enable Discogs tagging (y/N)
- Whether this is an album (y/N)
- Album artist and title (for albums)
- Track selection (numbers or ranges like 1-9, 10,12-15)
Output: MP3 files in downloads/ folder with metadata from YouTube and optionally Discogs
Dependencies: yt_dlp, discogs_client, mutagen, requests, rapidfuzz, tqdm, yaspin
Fetches and embeds song lyrics from Genius into MP3 files with fuzzy matching and manual review support.
Parameters:
--path- Folder path containing MP3 files (or path tomanual_review.txt)
Features:
- Keyboard shortcuts:
pto pause,qto quit - Automatic fuzzy matching (threshold: 75%)
- Manual review for ambiguous matches
- Skips files that already have lyrics
- Retries with stripped "feat." on low scores
Output Files:
manual_review.txt- Files needing manual reviewskipped_review.txt- Files not found on Genius- Tag lyrics to MP3 files
Dependencies: lyricsgenius, mutagen, rapidfuzz, tqdm
Tags MP3 files with metadata from Discogs database including album art, labels, and catalog numbers.
Parameters:
--path- Folder path to process--overwrite- Overwrite existing tags? (y/n)--mode- Tagging mode: (s)ongs or (a)lbums
Features:
- Caches successful searches to
saved_searches.txt - Handles Single/EP detection
- Embeds album artwork from Discogs
Output: Tagged MP3 files with Discogs metadata
Dependencies: discogs_client, mutagen, rapidfuzz
Core tagging utilities for MP3 files (used by other scripts).
Functions:
tagged_with_discogs(filepath)- Check if file already tagged with Discogsget_metadata_tags(filepath)- Read title, artist, album, year from MP3tag_from_yt(filepath, url, album, album_artist, track_num)- Tag from YouTube metadatatag_mp3_with_discogs(filepath, release, overwrite)- Tag with Discogs metadata
Dependencies: mutagen, requests, PIL
Discogs search utilities with fuzzy matching and user selection.
Functions:
search_discogs(query, max_results, top_n)- Search and display top matchessearch_discogs_with_prompt(query)- Interactive search with feat. stripping
Dependencies: discogs_client, rapidfuzz
Downloads YouTube playlists as video files (MP4) with thumbnail embedding.
Parameters:
- Command line argument: playlist URL (or prompted interactively)
Features:
- Strips video tags from filenames (Official Video, Music Video, etc.)
- Downloads archive to avoid re-downloading
- Logs to
logs/directory
Output: MP4 files in W:\MusicClips\NowWatching\
Dependencies: yt_dlp
Embeds thumbnails as attached pictures in MP4 files.
Parameters: None (uses hardcoded paths)
Features:
- Converts WebP/PNG to JPG if needed
- Cleans up image files after embedding
Dependencies: subprocess (ffmpeg)
Utility function to strip common video-related tags from filenames.
Removes patterns like:
- (Official Video), (Official Music Video)
- [Official Audio], [Lyric Video]
- (Music Video), (Visualizer)
Migrates movie metadata from CSV to MediaMonkey 5 database.
Parameters:
--dry-run- Preview changes without applying--force- Actually execute updates
Features:
- Backs up database before changes
- Drops/restores triggers to avoid conflicts
- Scrapes production companies from IMDB
- Copies folder.jpg images
Configuration: Hardcoded paths to CSV and database
Dependencies: sqlite3, requests, bs4
Syncs metadata (Year, Genre, Publisher) from Audio songs to Music Videos.
Parameters:
--dry-run- Preview without applying
Features:
- Matches by title and artist
- Filters out videos from 2022+
- Auto-selects oldest year for multiple matches
- Logs processed IDs to avoid re-processing
Dependencies: sqlite3
Tags music videos in MediaMonkey 5 by appending " [Music Video]" to Album field.
Parameters:
--dry-run- Preview without applying
Features:
- Drops/restores triggers
- Skips already tagged entries
- Creates timestamped backups
Dependencies: sqlite3
Separates multiple artists in MediaMonkey 5 by replacing separators with semicolons.
Parameters:
--dry-run- Preview without applying
Replacements:
feat.->;,->;x->;&->;
Dependencies: sqlite3
Utility to inspect MediaMonkey 5 database schema.
Output: Lists all columns in the Songs table
Validates and fixes CUE sheet files for album folders.
Parameters: Interactive - prompts for root folder
Features:
- Detects encoding with chardet
- Extracts performer and title from folder structure
- Updates PERFORMER and TITLE fields
- Creates
.bakbackups
Path patterns:
- Regular:
Artist/(YYYY) Album/track.cue - VVAA:
.../VVAA/(YYYY) Album/track.cue
Finds MP3 files longer than 25 minutes without corresponding CUE files.
Parameters:
path- Root directory to scan (default: current directory)
Output: missing_cues_report.txt
Dependencies: mutagen
Restores CUE files from .bak backups created by check_cues.py.
Parameters: None (uses default log file)
Output: restore_log.txt
Moves all .cue.bak files from source to backup location.
Configuration: Hardcoded SOURCE_ROOT, DEST_ROOT paths
Analyzes audio files and tags them with BPM (tempo) and musical key.
Parameters: Interactive - prompts for folder path
Features:
- Uses Krumhansl-Kessler key profiles
- Converts to Camelot wheel notation (e.g., "8B", "11A")
- Tags MP3 with TKEY, TBPM, and TXXX frames
Supported formats: MP3, WAV, FLAC, OGG, M4A
Dependencies: librosa, numpy, mutagen
Extracts embedded album art from MP3 files and saves as individual images.
Parameters: Interactive prompts for source and destination folders
Output: Images named <trackname>.jpg or <trackname>.png
Dependencies: mutagen, PIL
Processes album folders to standardize cover art as folder.jpg.
Features:
- Deletes
Folder.jpgandAlbumArtSmall.jpg - Handles
_resize.jpgfiles - Resizes large images to 640px width
- Extracts from MP3 if no JPG found
Configuration: Hardcoded root path
Dependencies: PIL, mutagen
Shared utility functions used by multiple scripts.
Functions:
clean_feat(artist)- Normalize feat./ft. in artist namesstrip_feat(title)- Remove featured artists from titlesmerge_feat(artist)- Combine main and featured artistsnormalize_yt_title(info)- Parse YouTube title to (artist, song)clean_title(title)- Remove noise from titlessafe_filename(name)- Remove forbidden charactersfetch_and_crop_cover(thumbnails)- Download and crop cover artflip_query(query)- Swap "Artist - Title" to "Title - Artist"get_mp3_files(folder, recursive)- List MP3 files
Scans folders for MP3 files missing lyrics tags.
Parameters: Interactive prompts
Features:
--show-list- Display files without lyrics--export- Save list to text file
Output: missing_lyrics.txt
Dependencies: mutagen, tqdm
CLI tool to display all ID3 tags from an MP3 file in table format.
Parameters:
- File path as argument or interactive prompt
Output: Formatted table of frame IDs, names, and values
Dependencies: mutagen
Finds 0-byte MP3 files in a folder.
Parameters: Interactive prompt for folder path
Output: empty_mp3s.txt
Dependencies: tqdm
Scans for PNG files (incomplete/broken implementation).
YouTube metadata extraction utilities.
Functions:
parse_youtube_description(description)- Extract year, publisher, composer, lyricsget_yt_metadata(url)- Fetch full metadata from YouTube
Dependencies: yt_dlp
Debugging utility for inspecting Python objects.
Demo/example of tqdm progress bar customization.
Debug utility for checking MediaMonkey database paths.
Cleans actor fields in CSV files by converting newline-separated entries to comma-separated.
Input: mymovies.csv
Output: cleaned_mymovies.csv
Flask web interface for tagging operations.
Routes:
/- Main page/progress_stream- SSE stream for Genius tagging progress/discogs_tagger- Discogs tagging interface/genius_tagger- Genius tagging interface
Features:
- Real-time progress updates via Server-Sent Events
- Docker-ready with Dockerfile and docker-compose.yml
All dependencies are listed in requirements.txt:
discogs_client==2.3.0
lyricsgenius==3.7.2
mutagen==1.47.0
pillow==11.3.0
rapidfuzz==3.14.1
requests==2.32.5
tqdm==4.67.1
yt_dlp==2025.10.22
numpy==2.3.4
librosa==0.11.0
yaspin==3.3.0
flask==3.1.2
chardet==5.2.0
bs4==0.0.2
fake_headers==1.0.2
- Some scripts have hardcoded paths (FFmpeg location, database paths, etc.)
- Scripts that modify MediaMonkey database create
.bakbackups - The
docs/folder contains additional technical documentation and user guides