A small set of Ruby scripts for downloading audio, building playlists, and managing metadata.
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
httpartyandtaglib-ruby
For audio downloads, ffmpeg is also required:
brew install ffmpeg
- Add YouTube URLs to
data/songs.txt, one per line - Run
ruby download_audio.rbto download them as MP3s to~/Music/ipod/Music - Run
ruby build_playlist.rb PLAYLIST_NAME ~/Music/ipod/Musicto generate an M3U playlist - Run
ruby enrich_metadata.rb PATHto look up and write metadata for a file or directory - Run
ruby clear_metadata.rb PATHto remove metadata and embedded cover art from a file or directory
- 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
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
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
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.mp3or.flacfile, or a directory to scan recursively
Removes metadata fields and embedded artwork from supported audio files.
ruby clear_metadata.rb PATH
PATH— a single.mp3or.flacfile, or a directory to scan recursively