Files
minstrel/README.md
T
bvandeusenandClaude Opus 5.5 f87aba5b86
release / go (push) Failing after 1m15s
release / web (push) Successful in 1m18s
release / govulncheck (push) Successful in 21s
release / integration (push) Successful in 3m57s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / android (push) Canceled after 4m33s
release / Build signed APK (push) Canceled after 4m9s
feat(subsonic): scan status, artist and album info, lyrics, ratings and users
The last Subsonic methods apps call that Minstrel didn't answer:

- getScanStatus counts the songs whose files are present and says
  whether a scan is running; startScan, for an admin, starts the scan the
  web app's Rescan starts, and answers "scanning" straight away since the
  scan records itself a moment later.
- getArtistInfo and getArtistInfo2 give the artist's MusicBrainz id and the
  artists in this library that sound like them, from an artist, album or
  song id; getAlbumInfo and getAlbumInfo2 give the album's MusicBrainz id.
  Minstrel fetches no biographies or outside images, so none are sent.
- getLyrics (by artist and title) and getLyricsBySongId (OpenSubsonic
  songLyrics, now declared) read lyrics when asked: a .lrc file beside the
  song gives timed lyrics, otherwise the song's own lyrics tag.
- setRating accepts a rating and keeps none: a like is Minstrel's only
  rating, and a low rating is never read as a dislike.
- getUsers lists every user, for an admin only.

ArtistRef no longer fixes its XML element name, so it can appear as
similarArtist; every field holding it names the element.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:43:13 -05:00

142 lines
8.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<p align="center"><img src="web/static/brand/mark.svg" width="120" alt="Minstrel logo"></p>
<h1 align="center">Minstrel</h1>
<p align="center">A self-hosted music server that picks what to play next.</p>
Minstrel serves your music library to the web, to its own Android app, and to Subsonic apps. Shuffle, radio, likes and play history are worked out on the server, so the web app, the Android app and Subsonic apps get the same mixes and the same history, and what you like and play in a Subsonic app counts too. It is for anyone who keeps their own music collection and wants it to sound like more than a random shuffle.
<a href="docs/screenshots/home.png"><img src="docs/screenshots/home.png" width="820" alt="Minstrel's Home: daily mixes, Songs like, and genre mixes ordered by what you play most"></a>
<p>
<a href="docs/screenshots/now-playing.png"><img src="docs/screenshots/now-playing.png" width="560" alt="Now playing, with the queue beside it"></a>
<a href="docs/screenshots/home-phone.png"><img src="docs/screenshots/home-phone.png" width="200" alt="Home on a phone"></a>
</p>
<sub>The music in these screenshots is invented: every artist, album, cover and song was generated for them (<a href="tools/demo-library">tools/demo-library</a>).</sub>
## Quick start
```yaml
# compose.yaml
services:
minstrel:
image: git.fabledsword.com/bvandeusen/minstrel:latest
ports: ['4533:4533']
volumes:
- ./music:/music # your library; must be writable by uid 1000
- minstrel-data:/app/data # art and caches
environment:
MINSTREL_DATABASE_URL: postgres://minstrel:minstrel@db:5432/minstrel?sslmode=disable
MINSTREL_LIBRARY_SCAN_PATHS: /music
depends_on: [db]
db:
image: postgres:17
environment:
POSTGRES_USER: minstrel
POSTGRES_PASSWORD: minstrel
POSTGRES_DB: minstrel
volumes: [pgdata:/var/lib/postgresql/data] # users, likes, history: back this up
volumes:
minstrel-data:
pgdata:
```
```bash
docker compose up -d
docker compose logs minstrel | grep setup_token
```
Open `http://<host>:4533/register` and create the first account with that setup token. The first account is the administrator.
### First run
1. **Let the first scan finish.** Minstrel scans the library on startup. Watch it, or scan again, on the **Admin** page (`/admin`). Later scans only pick up what changed.
2. **Install the Android app.** In **Settings** (`/settings`), the *Install the Android app* card downloads the app this server ships. It updates itself from your server after that.
**On an iPhone** there is no Minstrel app; use a Subsonic app such as play:Sub or Amperfy. Make a password for it in **Settings › Connections › Subsonic apps**, and give the app your server's address, your username and that password. Subsonic apps can browse, search, play, like and scrobble. Minstrel's daily mixes appear in them as playlists, and when an app asks the server for random songs or an instant mix it gets Minstrel's smart shuffle and radio. An app that shuffles on the phone instead shuffles at random.
3. **Invite the household.** In **Admin › Users** (`/admin/users`), make an invite token or turn on open registration. Each person gets their own likes, history and recommendations.
4. **Optional: connect ListenBrainz.** Each person adds their own ListenBrainz token in **Settings › Connections**.
## Configuration
The quick start sets everything that's required. These are the settings people most often change:
| Variable | What it does |
|---|---|
| `MINSTREL_DATABASE_URL` | Postgres connection string. Required. |
| `MINSTREL_LIBRARY_SCAN_PATHS` | Library folders inside the container, colon-separated (`/music:/audiobooks`). They are used on first start only; after that, change them in **Admin › Library**. |
| `MINSTREL_BRANDING_APP_NAME` | The name shown in the header, the browser tab and link previews. |
| `MINSTREL_LOG_LEVEL` | `debug`, `info`, `warn` or `error`. |
ListenBrainz, email, metadata sources and recommendation tuning are set in the web UI and take effect without a restart. The full file-based surface is in [`config.example.yaml`](./config.example.yaml); to use it, mount your copy at `/etc/smartmusic/config.yaml`.
## Setup pitfalls
- **The library mount has to be writable by uid 1000.** Minstrel deletes a file when an admin asks it to, and when the duplicate resolver removes a copy. It never moves, renames or retags your files. Mount the library `:ro` to forbid writes: those actions then refuse and say why.
- **`MINSTREL_LIBRARY_SCAN_PATHS` names the path inside the container** (`/music`), not the folder on your host.
- **On the internet, put it behind HTTPS.** Plain `http://` is fine on a network you trust. For a public server, bind the port to `127.0.0.1` and put a reverse proxy in front: see [docs/hosting.md](docs/hosting.md).
## Updating and backups
```bash
docker compose pull && docker compose up -d
```
Database migrations run at startup. Image tags:
- `:latest`: the stable release. Most people should run this.
- `:<commit-sha>`: one fixed build. Pin one to stop updates, or to roll back.
- `:dev`: the test channel, rebuilt on every change. It may break, and the fix is the next build.
Every image carries a signed Android app, all with the same key, so a phone can move between channels without reinstalling. Rolling back a SHA tag rolls back the app it carries too.
**Back up the Postgres volume** with `pg_dump`. It holds accounts, likes, play history, playlists and settings, and a migration can only be undone by restoring a dump. The `minstrel-data` volume holds artwork and caches that Minstrel rebuilds if lost.
## Features
**Listening**
- Smart shuffle that weighs what you like, what you skip and what you've heard lately, instead of picking at random.
- Two kinds of like: a song you love, and a song that's right for what you're listening to now.
- Radio that starts from any song, using ListenBrainz similarity as well as your own history.
- Daily mixes and system playlists built from your listening.
- Playback on Sonos and other UPnP speakers from the Android app.
- Loudness levelling between tracks, so you never reach for the volume.
**Your library**
- Browse by artist, album, genre and year, with search across everything.
- Duplicates, missing files and suspect copies are found and listed under **Collection** for an admin to fix.
- Missing album art and MusicBrainz ids are filled in automatically.
**Clients and accounts**
- A full web app, built into the server.
- A native Android app that ships inside the server image, keeps playing what it has cached when the server is out of reach, and updates itself from your server.
- OpenSubsonic-compatible, so Subsonic apps such as Symfonium, DSub, play:Sub and Amperfy can browse by artist, album, genre or folder, search, play, like and scrobble, carry a play queue from one device to another, show lyrics (from a `.lrc` file beside the song, or the song's own tags), see the daily mixes and your playlists, and get Minstrel's smart shuffle and radio when they ask for random songs or similar songs.
- Separate accounts for each person, with invites, and an inbox for what happened while you were away.
## Scope and responsible use
Minstrel indexes the files you point it at and streams them to your own clients. It does not find or download music, and it does no DRM circumvention.
What you put in your library is your responsibility. Copyright law applies to your collection as it does to any other software that plays a file; please respect it, and the terms of any service you connect.
Minstrel is not affiliated with or endorsed by ListenBrainz, MusicBrainz or Subsonic.
## Development
- **Backend:** `docker compose up` in this repo runs Postgres and Minstrel on `:4533`.
- **Web:** `cd web && npm install && npm run dev` starts Vite on `:5173`. It proxies `/api/*` and `/rest/*` to `:4533`.
- **Tests:** `make test-short` runs the unit tests. `make test-integration` also runs the database tests, against a separate `minstrel_test` database so your dev data is never truncated.
- **Image:** `docker build -t minstrel .` builds the web app and embeds it in the server binary.
- **Branches:** work lands on `dev`; `main` changes through pull requests from `dev`.
How accounts and sessions are protected: [docs/security.md](docs/security.md).
## License
GNU Affero General Public License v3.0. See [LICENSE](./LICENSE).
You can run, change and share Minstrel freely. If you run a changed copy that other people use over a network, you must offer those people the source of your changes.