Skip to main content

Search YouTube for music, identify songs, download as tagged MP3s

Project description

music-genie

Search YouTube for music, identify songs from mic recordings, and download them as tagged MP3s.

Invoked as mg or music-genie.

Installation

Requires Python 3.11+ and uv.

uv tool install music-genie        # from PyPI
uv tool install .                  # local dev

Recording also requires a system ffmpeg (the bundled download binary cannot access audio devices):

sudo apt install ffmpeg   # Debian/Ubuntu
brew install ffmpeg       # macOS
sudo dnf install ffmpeg   # Fedora

Usage

Search and download by query:

mg search "tame impala let it happen"

Presents up to 10 YouTube results, prompts for a selection, downloads as MP3, and embeds metadata (artist, album, year, cover art) sourced from MusicBrainz.

Identify a song from the microphone:

mg listen

Records an 8-second snippet, identifies it via Shazam, then flows into search and download. Pass --save to queue the snippet for later identification instead.

List unidentified snippets:

mg pending

Process queued snippets:

mg process

Attempts to identify each pending snippet and prompts to search and download. Unidentifiable snippets can be deleted.

Output layout

Files are saved to ~/Music/<artist>/<title>.mp3 by default.

Configuration

Settings can be overridden via environment variables or a TOML file at ~/.config/music-genie/config.toml.

Key Default Description
output_dir ~/Music Download destination
audio_format mp3 Output format (mp3, m4a, opus, …)
audio_quality 192 Bitrate in kbps
record_duration 8 Snippet length in seconds

Environment variables use the prefix MUSIC_GENIE_, e.g. MUSIC_GENIE_OUTPUT_DIR=/tmp/music.

Example config file:

output_dir = "/home/user/Music"
audio_format = "mp3"
audio_quality = 320
record_duration = 10

Data storage

Snippets and their metadata are stored in ~/.local/share/music-genie/snippets/ as .wav + .json pairs.

AI disclaimer

This tool was built with Claude Code, following my AI policy.

Tools

  • Claude Code (Anthropic) — primary development assistant

Usage

  • Architecture & design: Human-driven
  • Implementation: AI-collaborative (human-directed, AI-written, human-reviewed)
  • Tests: N/A
  • Documentation: AI-generated with human review

Process

AI agents propose changes as a PR, which are reviewed and merged by me. I try to make interactions transparent in the relevant issues or proposed patches. AI-authored commits are tagged with Co-Authored-By in the git history.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

music_genie-0.1.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

music_genie-0.1.2-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file music_genie-0.1.2.tar.gz.

File metadata

  • Download URL: music_genie-0.1.2.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for music_genie-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b6a2561999bec7b717f22bca7ace8a9732db5d94601992e30c654956b348dca2
MD5 b8b6ed3226e0a7e8794e9685269290a8
BLAKE2b-256 1160fc7754e35a6a68925bfce55ac8c3ca96fc4bc854d94c2b43af35abca0a2c

See more details on using hashes here.

File details

Details for the file music_genie-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for music_genie-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c44e749bb8c6c9fd646597a3946a0d285602aaea58aa67883b2148c840351b29
MD5 2185a25eb67b2d141f25e4b26d6479da
BLAKE2b-256 6fb0f23d25f28276d1cb3ea8c536ff5dc03df495e744a2866fcb25779fc9042f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page