docs: README screenshots come from an invented demo library
release / web (push) Successful in 1m16s
release / go (push) Successful in 1m47s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m1s
release / android (push) Successful in 4m31s
release / Build signed APK (push) Successful in 4m52s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 13s
release / Verify release artifacts (tag releases only) (push) Skipped

Every artist, album, cover and song in the screenshots is generated by
tools/demo-library, so none of it is anyone's real music or art. The
folder builds the library (ffmpeg-synthesised audio, drawn covers),
gives a demo account two months of listening so every Home mix appears,
runs Minstrel and Postgres on a network with no internet, and retakes
the screenshots with Playwright. The README now shows Home, Now playing
and Home on a phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 10:24:15 -05:00
co-authored by Claude Opus 5.5
parent f4336cdc23
commit 2bc6c60938
15 changed files with 656 additions and 15 deletions
+302
View File
@@ -0,0 +1,302 @@
#!/usr/bin/env python3
"""Build Minstrel's demo library: invented artists and albums, with generated
cover art and generated audio, so screenshots and demos need no real music.
Every artist, album and title here is made up, every cover is drawn by this
script, and every track is synthesised by ffmpeg. Nothing is downloaded. The
same seed always builds the same library.
python3 tools/demo-library/make_demo_library.py OUT_DIR
Needs ffmpeg (with libmp3lame) and Pillow.
"""
from __future__ import annotations
import argparse
import math
import random
import shutil
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass, field
from pathlib import Path
from PIL import Image, ImageDraw, ImageFilter, ImageFont
SEED = 20261125
COVER_PX = 800
SAMPLE_RATE = 22050
FONT_DIRS = [Path("/usr/share/fonts/truetype/dejavu"), Path("/usr/share/fonts/TTF")]
@dataclass
class Album:
artist: str
title: str
year: int
genre: str
tracks: int
style: str # how its cover is drawn
palette: tuple[str, ...]
# (track number, guest) for a track by "artist feat. guest".
features: dict[int, str] = field(default_factory=dict)
CATALOGUE: list[Album] = [
Album("Low Tide Choir", "Saltwater Hymns", 2019, "Indie Rock", 10, "sun", ("#1d3557", "#e76f51", "#f4a261")),
Album("Low Tide Choir", "Harbour Lights Out", 2022, "Indie Rock", 9, "stripes", ("#0b132b", "#5bc0be", "#f2e9e4"),
features={4: "Ruby Calloway"}),
Album("Marrow & Moth", "Kindling", 2017, "Folk", 8, "rings", ("#3d2b1f", "#c08552", "#f3e9dc")),
Album("Marrow & Moth", "The Long Field", 2021, "Folk", 9, "hills", ("#283618", "#606c38", "#fefae0")),
Album("Copperline Static", "Neon Almanac", 2020, "Synthpop; Electronic", 10, "grid", ("#10002b", "#e0aaff", "#ff006e")),
Album("Copperline Static", "Afterglow Protocol", 2023, "Synthpop; Electronic", 8, "sun", ("#240046", "#ff5d8f", "#ffd166")),
Album("Juniper Vale Quartet", "Blue Hour Sketches", 2016, "Jazz", 7, "blocks", ("#023047", "#219ebc", "#ffb703")),
Album("Juniper Vale Quartet", "Late Set, Room Nine", 2020, "Jazz", 8, "type", ("#14213d", "#fca311", "#e5e5e5")),
Album("Hollow Atlas", "Cartography of Fog", 2018, "Ambient", 7, "blur", ("#2b2d42", "#8d99ae", "#edf2f4")),
Album("Hollow Atlas", "Slow Weather", 2024, "Ambient", 6, "waves", ("#003049", "#669bbc", "#fdf0d5")),
Album("Sundial Arcade", "Tape Hiss Afternoons", 2021, "Lo-Fi", 12, "blocks", ("#3a5a40", "#a3b18a", "#dad7cd")),
Album("Sundial Arcade", "Study Lamp", 2023, "Lo-Fi", 11, "rings", ("#432818", "#bb9457", "#ffe6a7")),
Album("The Paper Comets", "Bright Little Disasters", 2022, "Indie Rock", 10, "type", ("#ef476f", "#ffd166", "#073b4c")),
Album("Night Ferry Collective", "Undertow Radio", 2015, "Trip Hop; Electronic", 9, "waves", ("#161a1d", "#660708", "#e5383b")),
Album("Night Ferry Collective", "Glass District", 2019, "Trip Hop; Electronic", 8, "grid", ("#0d1b2a", "#415a77", "#e0e1dd")),
Album("Ruby Calloway", "Honey & Iron", 2018, "Soul", 10, "sun", ("#370617", "#dc2f02", "#ffba08")),
Album("Glacier Mouth", "We Were Here When the Lights Went", 2017, "Post-Rock; Ambient", 6, "hills", ("#03045e", "#0077b6", "#caf0f8")),
Album("Pixel Orchard", "Circuit Bloom", 2024, "Electronic", 9, "stripes", ("#001219", "#0a9396", "#e9d8a6")),
Album("Wren Halloway", "Small Rooms", 2023, "Folk", 8, "blur", ("#582f0e", "#a68a64", "#ede0d4")),
Album("Bramble & Bell", "Hedgerow Songs", 2020, "Folk", 9, "hills", ("#2d3a1f", "#8a9a5b", "#f1e3c6")),
Album("The Marlowe Trio", "Brushes at Midnight", 2019, "Jazz", 10, "rings", ("#1b1b3a", "#693668", "#f4c095")),
Album("Sable Cartwright", "Smoke Rings & Slow Tempos", 2021, "Jazz", 8, "blocks", ("#2b2118", "#a4243b", "#d8c99b")),
Album("Tidepool Engine", "Low Frequencies for Long Drives", 2022, "Ambient", 8, "waves", ("#0f2027", "#2c5364", "#a8dadc")),
]
# A compilation: one album, many performers, filed under Various Artists.
COMPILATION = Album("Various Artists", "Sunday Morning Static", 2024, "Lo-Fi", 8, "type",
("#264653", "#2a9d8f", "#e9c46a"))
COMPILATION_ARTISTS = ["Sundial Arcade", "Hollow Atlas", "Wren Halloway", "Pixel Orchard",
"Juniper Vale Quartet", "Marrow & Moth", "Copperline Static", "Night Ferry Collective"]
WORDS_A = ["Paper", "Silver", "Quiet", "Northbound", "Velvet", "Hollow", "Golden", "Static", "Borrowed",
"Midnight", "Lantern", "Coastal", "Glass", "Amber", "Second", "Soft", "Electric", "Wild",
"Slow", "Little", "Distant", "Winter", "Open", "Lucky", "Faded", "Common", "Copper", "Blue"]
WORDS_B = ["Moons", "Harbour", "Signal", "Rooms", "Weather", "Orchard", "Engines", "Letters", "Tides",
"Gardens", "Satellites", "Mornings", "Rivers", "Postcards", "Streetlights", "Fields", "Hearts",
"Ferries", "Echoes", "Windows", "Islands", "Kites", "Stations", "Embers", "Comets", "Lines"]
WORDS_C = ["Leaving", "Holding On", "Sleepwalk", "Undertow", "Homesick", "Daylight", "Wildfire", "Overpass",
"Driftwood", "Halfway", "Saltlines", "Afterhours", "Small Hours", "Overgrown", "Breathe Out",
"Low Light", "Signal Fire", "Weightless", "Runaway", "Fever Dream", "Goodnight", "Carousel"]
NOTE_HZ = [261.63, 277.18, 293.66, 311.13, 329.63, 349.23, 369.99, 392.00, 415.30, 440.00, 466.16, 493.88]
CHORDS = [(0, 4, 7), (0, 3, 7), (0, 4, 7, 11), (0, 3, 7, 10), (0, 5, 7), (0, 4, 9)]
def track_titles(rng: random.Random, n: int) -> list[str]:
seen: set[str] = set()
out: list[str] = []
while len(out) < n:
shape = rng.random()
if shape < 0.35:
t = f"{rng.choice(WORDS_A)} {rng.choice(WORDS_B)}"
elif shape < 0.6:
t = rng.choice(WORDS_C)
elif shape < 0.8:
t = f"The {rng.choice(WORDS_A)} {rng.choice(WORDS_B)}"
else:
t = f"{rng.choice(WORDS_C)} ({rng.choice(WORDS_A)} {rng.choice(WORDS_B)})"
if t not in seen:
seen.add(t)
out.append(t)
return out
def font(size: int, bold: bool = False) -> ImageFont.ImageFont:
name = "DejaVuSans-Bold.ttf" if bold else "DejaVuSans.ttf"
for d in FONT_DIRS:
if (d / name).exists():
return ImageFont.truetype(str(d / name), size)
return ImageFont.load_default()
def hex_rgb(h: str) -> tuple[int, int, int]:
return tuple(int(h[i:i + 2], 16) for i in (1, 3, 5)) # type: ignore[return-value]
def mix(a: tuple[int, int, int], b: tuple[int, int, int], t: float) -> tuple[int, int, int]:
return tuple(round(x + (y - x) * t) for x, y in zip(a, b)) # type: ignore[return-value]
def draw_cover(album: Album, rng: random.Random) -> Image.Image:
bg, mid, hi = (hex_rgb(c) for c in album.palette)
n = COVER_PX
img = Image.new("RGB", (n, n), bg)
d = ImageDraw.Draw(img)
for y in range(n): # vertical gradient as the base of every style
d.line([(0, y), (n, y)], fill=mix(bg, mid, (y / n) ** 1.6 * 0.55))
s = album.style
if s == "sun":
r = rng.randint(180, 260)
cx, cy = rng.randint(250, 550), rng.randint(250, 420)
for i in range(r, 0, -4):
d.ellipse([cx - i, cy - i, cx + i, cy + i], fill=mix(hi, mid, i / r * 0.5))
for k in range(6):
y = cy + 40 + k * 34
d.rectangle([0, y, n, y + 12 + k * 2], fill=bg)
elif s == "stripes":
w = rng.randint(28, 60)
for i, x in enumerate(range(-n, n * 2, w)):
d.polygon([(x, 0), (x + w // 2, 0), (x + w // 2 - n, n), (x - n, n)],
fill=(mid if i % 3 == 0 else hi if i % 3 == 1 else bg))
elif s == "rings":
cx, cy = n // 2 + rng.randint(-80, 80), n // 2 + rng.randint(-80, 80)
for i, r in enumerate(range(520, 20, -36)):
d.ellipse([cx - r, cy - r, cx + r, cy + r], outline=(hi if i % 2 else mid), width=14)
elif s == "hills":
for layer in range(5):
base = 330 + layer * 90
amp = rng.randint(30, 80)
ph = rng.random() * 6
period = rng.randint(90, 160)
pts = [(x, base + amp * math.sin(x / period + ph)) for x in range(0, n + 10, 10)]
d.polygon(pts + [(n, n), (0, n)], fill=mix(mid, hi, layer / 5) if layer < 3 else mix(bg, mid, layer / 6))
d.ellipse([560, 90, 680, 210], fill=hi)
elif s == "grid":
cell = rng.choice([80, 100])
for gx in range(0, n, cell):
for gy in range(0, n, cell):
if rng.random() < 0.45:
c = rng.choice([mid, hi, bg])
pad = rng.randint(6, 22)
d.rectangle([gx + pad, gy + pad, gx + cell - pad, gy + cell - pad], fill=c)
for gx in range(0, n, cell):
d.line([(gx, 0), (gx, n)], fill=mix(bg, hi, 0.25), width=2)
d.line([(0, gx), (n, gx)], fill=mix(bg, hi, 0.25), width=2)
elif s == "blocks":
for _ in range(9):
x0, y0 = rng.randint(-100, n - 100), rng.randint(-100, n - 100)
w, h = rng.randint(140, 420), rng.randint(140, 420)
d.rectangle([x0, y0, x0 + w, y0 + h], fill=rng.choice([mid, hi, mix(mid, hi, 0.5)]))
elif s == "waves":
for i in range(26):
y0 = 120 + i * 24
amp = 18 + i * 1.5
pts = [(x, y0 + amp * math.sin(x / 70 + i * 0.45)) for x in range(0, n + 8, 8)]
d.line(pts, fill=mix(mid, hi, i / 26), width=5)
elif s == "blur":
for _ in range(7):
r = rng.randint(120, 300)
cx, cy = rng.randint(0, n), rng.randint(0, n)
d.ellipse([cx - r, cy - r, cx + r, cy + r], fill=rng.choice([mid, hi, mix(bg, hi, 0.6)]))
img = img.filter(ImageFilter.GaussianBlur(70))
d = ImageDraw.Draw(img)
elif s == "type":
word = album.title.split()[0].upper().strip(",")
f = font(220 if len(word) <= 5 else 150, bold=True)
for i in range(4):
d.text((40, 60 + i * 175), word, font=f, fill=(hi if i % 2 == 0 else mid))
# Every cover carries its artist and title, as a real sleeve would, over a
# dark fade so the light text reads on any artwork.
scrim = Image.new("L", (n, n), 0)
sd = ImageDraw.Draw(scrim)
for y in range(n - 260, n):
sd.line([(0, y), (n, y)], fill=round(170 * ((y - (n - 260)) / 260) ** 1.3))
img = Image.composite(Image.new("RGB", (n, n), (8, 8, 12)), img, scrim)
d = ImageDraw.Draw(img)
pad = 44
size = 44
while size > 22 and d.textlength(album.title, font=font(size, bold=True)) > n - 2 * pad:
size -= 2
d.text((pad, n - pad - 88), album.title, font=font(size, bold=True), fill=(250, 248, 242))
d.text((pad, n - pad - 36), album.artist, font=font(28), fill=(225, 222, 215))
return img
def synth_expr(rng: random.Random) -> tuple[str, float]:
"""An ffmpeg aevalsrc expression: a four-chord loop over a bass note,
pulsed at its own tempo. Each track draws its own roots, chord shapes and
tempo, so no two tracks fingerprint alike."""
bpm = rng.randint(68, 132)
beat = 60 / bpm
bar = beat * 4
roots = [rng.randrange(12) for _ in range(4)]
shapes = [rng.choice(CHORDS) for _ in range(4)]
loop = bar * 4
parts = []
for i, (root, shape) in enumerate(zip(roots, shapes)):
tones = "+".join(f"sin(2*PI*{NOTE_HZ[(root + iv) % 12] * (2 if iv >= 12 else 1):.2f}*t)" for iv in shape)
bass = f"0.9*sin(2*PI*{NOTE_HZ[root] / 4:.2f}*t)"
gate = f"between(mod(t,{loop:.4f}),{i * bar:.4f},{(i + 1) * bar - 0.001:.4f})"
parts.append(f"{gate}*(({tones})/{len(shape)}*0.5+{bass}*0.35)")
pulse = f"(0.65+0.35*exp(-6*mod(t,{beat:.4f})))"
return f"0.55*{pulse}*({'+'.join(parts)})", loop
def render_track(job: dict) -> None:
out: Path = job["path"]
if out.exists():
return
meta = []
for k, v in job["tags"].items():
meta += ["-metadata", f"{k}={v}"]
dur = job["duration"]
cmd = [
"ffmpeg", "-hide_banner", "-loglevel", "error", "-y",
"-f", "lavfi", "-i", f"aevalsrc='{job['expr']}':s={SAMPLE_RATE}:d={dur}",
"-af", f"afade=t=in:d=2,afade=t=out:st={dur - 4}:d=4,volume=0.8",
"-ac", "1", "-c:a", "libmp3lame", "-b:a", "64k", "-id3v2_version", "3",
*meta, str(out),
]
subprocess.run(cmd, check=True)
def safe(name: str) -> str:
return "".join(c if c.isalnum() or c in " -_&'()," else "_" for c in name).strip()
def main() -> int:
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
ap.add_argument("out", type=Path, help="directory to build the library in")
ap.add_argument("--jobs", type=int, default=8, help="tracks rendered at once")
ap.add_argument("--covers-only", action="store_true", help="redraw the covers and skip the audio")
args = ap.parse_args()
if not shutil.which("ffmpeg"):
print("ffmpeg is needed", file=sys.stderr)
return 1
rng = random.Random(SEED)
jobs = []
for album in [*CATALOGUE, COMPILATION]:
folder = args.out / safe(album.artist) / f"{safe(album.title)} ({album.year})"
folder.mkdir(parents=True, exist_ok=True)
draw_cover(album, random.Random(f"{SEED}-{album.title}")).save(folder / "cover.jpg", quality=90)
titles = track_titles(rng, album.tracks)
for n, title in enumerate(titles, start=1):
if album is COMPILATION:
artist = COMPILATION_ARTISTS[(n - 1) % len(COMPILATION_ARTISTS)]
elif n in album.features:
artist = f"{album.artist} feat. {album.features[n]}"
else:
artist = album.artist
expr, loop = synth_expr(rng)
duration = max(loop * 3, rng.randint(140, 290))
tags = {
"title": title, "artist": artist, "album": album.title, "album_artist": album.artist,
"track": f"{n}/{album.tracks}", "disc": "1/1", "date": str(album.year), "genre": album.genre,
}
if album is COMPILATION:
tags["compilation"] = "1"
jobs.append({"path": folder / f"{n:02d} {safe(title)}.mp3", "expr": expr,
"duration": round(duration, 2), "tags": tags})
if args.covers_only:
return 0
with ThreadPoolExecutor(max_workers=args.jobs) as pool:
list(pool.map(render_track, jobs))
print(f"{len(jobs)} tracks in {len(CATALOGUE) + 1} albums under {args.out}")
return 0
if __name__ == "__main__":
sys.exit(main())