Local Music With MPD and Beets
Date:
2026-03-25
Importing From Youtube
- Paste a list of URLs into this command, it spawns a yt-dlp thread for each link:
read -p "Paste URLs: " urls; \
nix-shell -p yt-dlp ffmpeg \
-I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz \
--run 'echo "'"$urls"'" | tr " \t" "\n" | grep "^https" | \
xargs -P 0 -I {} yt-dlp \
--yes-playlist \
--ignore-errors \
--no-overwrites \
-f bestaudio \
-x \
--audio-format opus \
--embed-metadata \
--parse-metadata "playlist_index:%(track_number)s" \
--parse-metadata "playlist_title:%(album)s" \
--parse-metadata "uploader:%(artist)s" \
-o "%(artist)s - %(album)s/%(playlist_index)s - %(title)s.%(ext)s" \
{}'
- Import the albums into your library with beets:
beet import /home/USER/Music/source_youtube_albums
Importing From Bandcamp
-
Download the archive from Bandcamp.
-
Unzip the archive.
nix-shell -p unzip --run '
for zip in /home/USER/Music/zipped_bandcamp_albums/*.zip; do
name=$(basename "$zip" .zip)
dest="/home/USER/Music/source_bandcamp_albums/$name"
if [ ! -d "$dest" ]; then
unzip "$zip" -d "$dest"
else
echo "Skipping $name (already exists)"
fi
done
'
- Import the albums into your library with beets:
beet import /home/USER/Music/source_bandcamp_albums