diary at Telent Netowrks

Advent of Blogpost#

Tue, 01 Dec 2020 21:20:05 +0000

Trying something new: a blog post for every day between now and Christmas. They will necessarily be a bit shorter and even less polished than the usual ones.

Day 1: internet music streaming for people who'd rather own their music than rent it.

I have ~ 200GB of files in /srv/media/music on my desktop PC, most of it from a massive CD ripping exercise about ten years ago, and I'd like to be able to listen to it from anywhere in the house (at minimum) or on the internet (ideally). I accomplish this using Airsonic - a "free, web-based media streamer, providing ubiquitous access to your music", coupled with Audinaut - an Android app to "stream music from Subsonic-compatible servers."

Airsonic is in Nixpkgs and there's a Nixos module for it. Audinaut is in the F-droid repo and apparently also in the Play Store

    services.airsonic = {
      enable = true;
      virtualHost = "muisc.telent.net";
      listenAddress = "";
      contextPath = "/";
      maxMemory = 500;
    services.nginx.virtualHosts."muisc.telent.net".enableACME = true;
    services.nginx.virtualHosts."muisc.telent.net".forceSSL = true;

but you should note that it relies on its own stateful database of some kind ( don't know what exactly, haven't dug into it) for configuration, so you have to set that stuff up by hand outside of Nix.

One caveat with Airsonic is, per the documentation:

Also note that Airsonic will organize your music according to how they are organized on your disk. Unlike many other music applications, Airsonic does not organize the music according to the tag information embedded in the files. (It does, however, also read the tags for presentation and search purposes.)
Consequently, it’s recommended that the music folders you add to Airsonic are organized in an “artist/album/song” manner. There are music managers, like MediaMonkey, that can help you achieve this.

My music collection didn't quite conform to this convention. The bulk of it was in flac/artistname-albumname, a bunch of other albums were in mp3/artist/album, and then the "long tail" included files in Songbird, annabelle, very_old_mp3_player and from_usb_stick. I straightened it all out using beets which describes itself as "the media library management system for obsessive-compulsive music geeks." but also works very nicely as a media library management system for entirely neurotypical (as far as I know) computer geeks who have a significant collection of music just because they've been buying CDs for a long time. I configured it approximately thus:

[dan@loaclhost:~]$ cat .config/beets/config.yaml
directory: /srv/media/music-new
library: /home/dan/beets-library.db
  copy: no
  move: yes
  write: no
  strong_rec_thresh: 0.10
plugins: chroma web fromfilename fetchart duplicates
strong_rec_thresh: 0.10
    countries: ['GB|UK', 'US']
  auto: yes

and then cd /srv/media/music-old && beet import .. Do this inside of tmux, because it takes ages and asks a lot of questions.

Tomorrow I'll talk about sniproxy which is how, with one static IPv4 address but a bazillion IPv6 addresses but a mobile phone network that doesn't support IPv6 (this is the UK. None of them do) I can make my music server visible outside of the house.