Skip to content

icetimux/mp3tools

Repository files navigation

mp3tools

A small set of Ruby scripts for downloading audio, building playlists, and managing metadata.

Setup

Run the installer to set up the required local dependencies for the metadata tools:

./install_dependencies.sh

The installer:

  • installs Homebrew if needed
  • installs taglib
  • installs the Ruby gems httparty and taglib-ruby

For audio downloads, ffmpeg is also required:

brew install ffmpeg

Usage

  1. Add YouTube URLs to data/songs.txt, one per line
  2. Run ruby download_audio.rb to download them as MP3s to ~/Music/ipod/Music
  3. Run ruby build_playlist.rb PLAYLIST_NAME ~/Music/ipod/Music to generate an M3U playlist
  4. Run ruby enrich_metadata.rb PATH to look up and write metadata for a file or directory
  5. Run ruby clear_metadata.rb PATH to remove metadata and embedded cover art from a file or directory

Dependencies

  • yt-dlp (included as ./bin/yt-dlp)
  • ffmpeg — required for download_audio.rb
  • TagLib — installed by ./install_dependencies.sh
  • Ruby gems: httparty, taglib-ruby — installed by ./install_dependencies.sh

download_audio.rb

Downloads MP3s from URLs listed in data/songs.txt (one URL per line). Music is saved to ~/Music/ipod/Music.

ruby download_audio.rb [--no-playlist]
  • --no-playlist — download only the single track, skip playlist

build_playlist.rb

Generates an M3U playlist from all files in a directory (including subdirectories). Playlists are saved to ~/Music/ipod/Playlists/.

ruby build_playlist.rb PLAYLIST_NAME DIRECTORY
  • PLAYLIST_NAME — name of the output playlist (saved as ~/Music/ipod/Playlists/PLAYLIST_NAME.m3u)
  • DIRECTORY — path to search recursively for files to include

enrich_metadata.rb

Looks up track metadata from MusicBrainz based on filenames in the format Artist - Title and writes tags. For MP3s, it also embeds album art when available.

ruby enrich_metadata.rb PATH
  • PATH — a single .mp3 or .flac file, or a directory to scan recursively

clear_metadata.rb

Removes metadata fields and embedded artwork from supported audio files.

ruby clear_metadata.rb PATH
  • PATH — a single .mp3 or .flac file, or a directory to scan recursively

About

Ruby toolkit for batch-downloading YouTube audio as MP3s and generating M3U playlists via yt-dlp.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors