all repos — site @ 2c462d201aea890337df3a79d01e41397671b375

source for my site, found at icyphox.sh

pages/blog/music-streaming.md (view raw)

 1---
 2template:
 3slug: music-streaming
 4title: My music streaming setup
 5subtitle: Think Spotify, but self-hosted and not as good
 6date: 2020-12-13
 7---
 8
 9Having a self-hosted, centralized music streaming setup has been on my
10todo list for the longest time. I'd initially tried using NFS, but
11mounting it on my phone was very inconvenient. Incidentally, a few days
12ago, the existence of Subsonic/*sonic became known to me.
13
14## gonic
15
16I found [gonic](https://github.com/sentriz/gonic) to be the simplest of
17them all, and proceeded to set it up on the RPi. There are other
18alternatives too, like [Navidrome](https://www.navidrome.org), which
19ships with a web player, or [Airsonic](https://airsonic.github.io/).
20gonic stood out the most to me because it's effectively headless,
21barring a simple web interface for configuration.
22
23Setting it up was trivial. I did run into an
24[issue](https://github.com/sentriz/gonic/issues/89) -- I noticed that
25only songs that were already in folders, sorted by album, were being
26picked up in the scan.
27
28```
29|-- Void Of Vision - Hyperdaze (2019)
30|   |-- 01. Overture.mp3
31|   |-- 02. Year of the Rat.mp3
32|   |-- 03. Babylon.mp3
33|   |-- 04. If Only.mp3
34|   |-- 05. Slave to the Name.mp3
35|   |-- 06. Adrenaline.mp3
36|   |-- 07. Hole In Me.mp3
37|   |-- 08. Kerosene Dream.mp3
38|   |-- 09. Decay.mp3
39|   |-- 10. Splinter.mp3
40|   |-- 11. Hyperdaze.mp3
41|-- Volumes - Disaster Vehicle.mp3
42|-- Volumes - Finite.mp3
43|-- Volumes - Heavy Silence.mp3
44|-- Volumes - Hope.mp3
45|-- Volumes - Interlude.mp3
46...
47
48```
49
50So, in a directory tree like above, only the tracks inside "Void Of
51Vision - Hyperdaze (2019)" would get picked up, and all the "Volumes"
52songs wouldn't -- since it wasn't in a subfolder of its own.
53
54As a workaround -- and a necessary cleanup of my music -- I figured I'd
55give [beets](https://beets.io) a shot.
56
57## beets
58
59beets is extensively documented, so I'll skip the basics. In essence,
60it's a music organization tool -- fetches tags, sorts your collection,
61etc. Most of my music has been tagged already, so I skipped that. I only
62it all to be grouped by album. A bit of digging in the docs, and I found
63what I wanted: `--group-albums`.
64
65And in my `config.yaml`, I specified my desired path format like so:
66
67```yaml
68...
69paths:
70  default: $albumartist - $album%aunique{}/$track $title
71```
72
73Finally, running:
74
75```
76$ beet import --noautotag --move --group-albums path/to/dirty/music
77
78$ tree ~/music
79...
80
81104 directories, 1108 files
82```
83
84Nice! gonic then happily scanned all my music.
85
86## actually streaming this music
87
88On my laptop, I decided to just use the NFS share approach -- primarily because
89I'd like to stick to `cmus` and desktop Subsonic clients like [Sublime
90Music](https://gitlab.com/sublime-music/sublime-music) are very clunky.
91
92On Android, there are quite a few options on F-Droid -- I decided to go with
93[Ultrasonic](https://github.com/ultrasonic/ultrasonic) since it's the only one
94that supports Last.fm scrobbling.
95
96All things considered, I think I'm pretty satisfied with this. 'twas a good weekend.