Last updated: 2019-11-29 09:45:13 +0000

Upstream URL: git clone


View repository

View issue tracker

Contents of README follows

Music Management Scripts

This repo contains a bunch of scripts for fetching, tagging and organising a music collection. It makes lots of assumptions about the directory structure, mount points, etc. so it's probably more useful for copy/paste than for download/execute.

Each script might be useful on its own, but a few useful "workflows" have emerged.

NOTE: You should never need to run a script directly from this repo. Instead, use <code>nix-build</code> to create a "bin" directory and run them from there; that will ensure their dependencies are wired-in.

Fixing a Music Collection

Most scripts deal with "fixing" one aspect or another of a music collection, e.g. finding potential duplicates, moving tracks into album-appropriate directories, spotting non-music cruft, etc.

The main entry point for coordinating all of this is <code>fix-music</code>. This should be run with <code>~/Public</code> as the current working directory (i.e. the <code>/opt/shared</code> directory of the raspberry pi). The only "actions" this script will take are to download metadata and cache CRCs and AcoustIDs. Everything else is simply printed to stdout; it is up to us whether we want to follow those recommendations.

Getting Music

The main script for this is <code>get_album</code>, which will download and tag the content of a YouTube playlist. This performs a lot of I/O, to download, then extract audio, then add artist tags, then add album tags; so it's recommended to do it locally, in <code>~/Downloads/Music</code>, rather than over SSHFS or such.

Alternatively, to get a single track from YouTube or other site, we can use <code>yt-audio</code>, which is a simple wrapper around <code>youtube-dl</code> with sensible defaults.

Once we've got a bunch of music, we should tag it using something like Picard; the artist and album tags added by <code>get_album</code> are often sufficient to make the MusicBrainz lookup work.

Tags should be saved in files (Options -> Save Tags), and files should be renamed (Options -> Rename Files) to the following format:

<pre><code>$if($gt(%totaldiscs%,1),%discnumber%-,)$num(%tracknumber%,2) %title%</code></pre>

For example <code>1-04 My Favourite Song.opus</code> where <code>1-</code> is the disc number (iff there is more than one), <code>04</code> is the track number, <code>My Favourite Song</code> is the track title and <code>opus</code> is the audio format.

We do not currently use Picard to move files (i.e. we <em>do not</em> use Options -> Move Files).

Once we have fixed up these files locally, we can copy them over the the raspberry pi using the <code>move_downloaded_music</code> script.