Add discover UI with new song suggestions

Each mix rebuild now also finds songs that aren't in the library: the
user's Listenbrainz recommendations they've never played, plus an LB
Radio prompt per mix when a Listenbrainz token is configured. Each
candidate goes to the mix whose genre profile it fits best and is
skipped if it's already in the library or was played recently.

discover/ is a new React app to listen to the mixes: library songs
stream from Subsonic and suggested songs are found on YouTube with
yt-dlp, both proxied through playlistd with Range support for seeking.
Suggestions can be liked (kept in a "Liked new songs" list) or hidden.

- discover: candidate gathering, genre fit scoring, library filtering
- web: /api/discover routes, Subsonic/YouTube streaming proxy
- youtube: yt-dlp search (skipping hour-long results) and audio URLs
- mix tags now hold library genre names, for display in the UI
- config: listenbrainz.token, discover.ui, discover.ytdlp, discover.format

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018opPJMJjLWr4RqdG6vuK6p
This commit is contained in:
Claude committed 2026-11-13 16:39:46 +00:00
1 parent 18b3f0974e
commit a8b1123777
32 files changed
+4628 -36

No files matched your search

+824
View File
@@ -0,0 +1,824 @@
:root {
--bg: #f6f5f2;
--surface: #ffffff;
--surface-2: #efede8;
--border: #e2dfd8;
--text: #1d1b18;
--muted: #6d675e;
--accent: #5b3df5;
--accent-text: #ffffff;
--youtube: #d4351c;
--library: #2f7d4f;
--heart: #e0245e;
--shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 6%);
--art-l: 62%;
--art-s: 70%;
--radius: 12px;
font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
font-size: 15px;
line-height: 1.45;
color: var(--text);
background: var(--bg);
-webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #121214;
--surface: #1b1b1f;
--surface-2: #26262b;
--border: #2e2e34;
--text: #f1f0ee;
--muted: #a09d98;
--accent: #8b74ff;
--accent-text: #120d26;
--youtube: #ff6b52;
--library: #5fcf8d;
--heart: #ff5c8a;
--shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 30%);
--art-l: 45%;
--art-s: 55%;
}
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--bg);
}
button,
select,
input {
font: inherit;
color: inherit;
}
a {
color: inherit;
}
:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* ---------- layout ---------- */
.app {
display: grid;
grid-template-columns: 272px minmax(0, 1fr);
min-height: 100vh;
}
.sidebar {
position: sticky;
top: 0;
height: 100vh;
overflow-y: auto;
padding: 20px 12px;
border-right: 1px solid var(--border);
background: var(--surface);
}
.with-player .sidebar {
height: calc(100vh - 84px);
}
.content {
padding: 28px clamp(16px, 4vw, 48px) 48px;
min-width: 0;
}
.with-player .content {
padding-bottom: 120px;
}
.brand {
display: flex;
align-items: center;
gap: 10px;
padding: 0 10px 16px;
font-weight: 700;
font-size: 1.15rem;
letter-spacing: -0.01em;
}
.brand-mark {
display: grid;
place-items: center;
width: 28px;
height: 28px;
border-radius: 8px;
background: var(--accent);
color: var(--accent-text);
}
.rule-select {
width: calc(100% - 20px);
margin: 0 10px 8px;
padding: 6px 8px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--surface-2);
}
.rule-info {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 0 8px;
padding: 0 4px 0 10px;
color: var(--muted);
font-size: 0.85rem;
}
.mix-list {
list-style: none;
margin: 0;
padding: 0;
}
.mix-list a {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 10px;
border-radius: 8px;
text-decoration: none;
color: var(--text);
}
.mix-list a:hover {
background: var(--surface-2);
}
.mix-list a.selected {
background: hsl(var(--hue) var(--art-s) var(--art-l) / 18%);
}
.mix-dot {
flex: none;
width: 12px;
height: 12px;
border-radius: 4px;
background: linear-gradient(135deg, hsl(var(--hue) var(--art-s) var(--art-l)), hsl(calc(var(--hue) + 40) var(--art-s) calc(var(--art-l) - 12%)));
}
.mix-dot.heart {
display: grid;
place-items: center;
background: none;
color: var(--heart);
}
.mix-name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 0.93rem;
}
.count {
flex: none;
min-width: 22px;
padding: 1px 7px;
border-radius: 999px;
background: var(--accent);
color: var(--accent-text);
font-size: 0.75rem;
font-weight: 600;
text-align: center;
}
.liked-link {
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid var(--border);
}
/* ---------- mix header ---------- */
.mix-header {
display: flex;
gap: 28px;
align-items: flex-end;
margin-bottom: 32px;
}
.mix-art {
flex: none;
display: grid;
place-items: end start;
width: 200px;
height: 200px;
padding: 18px;
border-radius: 16px;
background:
radial-gradient(circle at 80% 15%, hsl(calc(var(--hue) + 60) 90% 75% / 70%), transparent 55%),
linear-gradient(135deg, hsl(var(--hue) var(--art-s) var(--art-l)), hsl(calc(var(--hue) + 40) var(--art-s) calc(var(--art-l) - 18%)));
color: #fff;
box-shadow: var(--shadow);
font-weight: 800;
font-size: 1.5rem;
line-height: 1.1;
letter-spacing: -0.02em;
text-shadow: 0 1px 8px rgb(0 0 0 / 25%);
overflow-wrap: anywhere;
}
.liked-view .mix-art {
place-items: center;
}
.mix-info {
min-width: 0;
}
.eyebrow {
margin: 0 0 4px;
color: var(--muted);
font-size: 0.78rem;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
}
h1 {
margin: 0 0 12px;
font-size: clamp(1.6rem, 3.4vw, 2.6rem);
line-height: 1.1;
letter-spacing: -0.025em;
}
.tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 0 0 12px;
padding: 0;
list-style: none;
}
.tags li {
padding: 2px 10px;
border-radius: 999px;
background: hsl(var(--hue) var(--art-s) var(--art-l) / 16%);
font-size: 0.82rem;
}
.mix-counts {
margin: 0 0 16px;
color: var(--muted);
font-size: 0.9rem;
}
.mix-buttons {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.mix-buttons button {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 9px 16px;
border: 1px solid var(--border);
border-radius: 999px;
background: var(--surface);
font-weight: 600;
cursor: pointer;
}
.mix-buttons button.primary {
border-color: transparent;
background: var(--accent);
color: var(--accent-text);
}
.mix-buttons button:disabled {
opacity: 0.5;
cursor: default;
}
/* ---------- track lists ---------- */
section + section {
margin-top: 32px;
}
h2 {
display: flex;
align-items: center;
gap: 8px;
margin: 0 0 8px;
font-size: 1.05rem;
}
.empty {
color: var(--muted);
}
.tracks {
margin: 0;
padding: 0;
list-style: none;
}
.track {
display: grid;
grid-template-columns: 36px 44px minmax(0, 1fr) auto auto auto;
align-items: center;
gap: 12px;
padding: 6px 8px;
border-radius: 10px;
}
.track:hover,
.track.active {
background: var(--surface);
}
.track.active {
box-shadow: inset 3px 0 0 var(--accent);
}
.track-play {
display: grid;
place-items: center;
width: 32px;
height: 32px;
padding: 0;
border: 0;
border-radius: 50%;
background: none;
cursor: pointer;
}
.track-icon {
display: none;
}
.track:hover .track-number,
.track.active .track-number {
display: none;
}
.track:hover .track-icon,
.track.active .track-icon,
.track-play:focus-visible .track-icon {
display: grid;
place-items: center;
color: var(--accent);
}
.track-play:focus-visible .track-number {
display: none;
}
.track-number {
color: var(--muted);
font-variant-numeric: tabular-nums;
font-size: 0.85rem;
}
.cover {
position: relative;
display: grid;
place-items: center;
overflow: hidden;
border-radius: 6px;
background: var(--surface-2);
color: var(--muted);
font-weight: 700;
}
.cover img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.track-text {
min-width: 0;
}
.track-title,
.track-sub {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.track-title {
font-weight: 600;
}
.track.active .track-title {
color: var(--accent);
}
.track-sub {
color: var(--muted);
font-size: 0.88rem;
}
.match {
color: var(--muted);
font-size: 0.82rem;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.track-duration {
color: var(--muted);
font-size: 0.85rem;
font-variant-numeric: tabular-nums;
}
.track-actions {
display: flex;
gap: 2px;
}
.icon-button {
display: inline-grid;
place-items: center;
width: 34px;
height: 34px;
padding: 0;
border: 0;
border-radius: 50%;
background: none;
color: var(--muted);
cursor: pointer;
}
.icon-button.small {
width: 28px;
height: 28px;
}
.icon-button:hover {
background: var(--surface-2);
color: var(--text);
}
.icon-button.liked {
color: var(--heart);
}
/* ---------- player ---------- */
.player {
position: fixed;
inset: auto 0 0 0;
z-index: 10;
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
align-items: center;
gap: 20px;
height: 84px;
padding: 0 20px;
border-top: 1px solid var(--border);
background: color-mix(in srgb, var(--surface) 92%, transparent);
backdrop-filter: blur(12px);
}
.player-track {
display: flex;
align-items: center;
gap: 12px;
min-width: 0;
}
.badge {
flex: none;
padding: 1px 8px;
border-radius: 999px;
border: 1px solid currentColor;
font-size: 0.72rem;
font-weight: 600;
}
.badge.youtube {
color: var(--youtube);
}
.badge.library {
color: var(--library);
}
.player-main {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
}
.player-buttons {
display: flex;
align-items: center;
gap: 10px;
}
.play-button {
display: grid;
place-items: center;
width: 40px;
height: 40px;
border: 0;
border-radius: 50%;
background: var(--text);
color: var(--bg);
cursor: pointer;
}
.player-progress {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
color: var(--muted);
font-size: 0.75rem;
font-variant-numeric: tabular-nums;
}
.player-progress span {
width: 38px;
text-align: center;
}
.player-progress input {
flex: 1;
height: 4px;
appearance: none;
border-radius: 2px;
background: linear-gradient(to right, var(--accent) var(--progress), var(--border) var(--progress));
cursor: pointer;
}
.player-progress input::-webkit-slider-thumb {
appearance: none;
width: 12px;
height: 12px;
border-radius: 50%;
background: var(--text);
}
.player-progress input::-moz-range-thumb {
width: 12px;
height: 12px;
border: 0;
border-radius: 50%;
background: var(--text);
}
.player-status {
position: absolute;
top: -26px;
padding: 2px 10px;
border-radius: 999px;
background: var(--surface-2);
font-size: 0.78rem;
white-space: nowrap;
}
.player-status.error {
color: var(--youtube);
}
.player-queue {
justify-self: end;
color: var(--muted);
font-size: 0.85rem;
font-variant-numeric: tabular-nums;
}
/* ---------- feedback ---------- */
.spinner {
display: inline-block;
width: 16px;
height: 16px;
border: 2px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.8s linear infinite;
vertical-align: middle;
}
.spinner.light {
border-color: color-mix(in srgb, var(--bg) 35%, transparent);
border-top-color: var(--bg);
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.bars {
display: flex;
align-items: flex-end;
gap: 2px;
height: 14px;
}
.bars i {
width: 3px;
background: var(--accent);
animation: bar 0.9s ease-in-out infinite;
}
.bars i:nth-child(2) {
animation-delay: -0.3s;
}
.bars i:nth-child(3) {
animation-delay: -0.6s;
}
@keyframes bar {
0%,
100% {
height: 30%;
}
50% {
height: 100%;
}
}
@media (prefers-reduced-motion: reduce) {
.bars i,
.spinner {
animation: none;
}
}
.notice {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 24px;
padding: 16px 20px;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--surface);
}
.notice.error {
border-color: var(--youtube);
color: var(--youtube);
}
.notice pre {
overflow-x: auto;
margin: 0;
padding: 12px;
border-radius: 8px;
background: var(--surface-2);
font-size: 0.85rem;
}
.toast {
position: fixed;
left: 50%;
bottom: 104px;
z-index: 20;
display: flex;
align-items: center;
gap: 14px;
max-width: calc(100vw - 32px);
padding: 10px 16px;
border-radius: 10px;
background: var(--text);
color: var(--bg);
box-shadow: var(--shadow);
transform: translateX(-50%);
}
.app:not(.with-player) .toast {
bottom: 24px;
}
.toast button {
border: 0;
background: none;
color: var(--accent);
font-weight: 700;
cursor: pointer;
}
/* ---------- small screens ---------- */
@media (max-width: 800px) {
.app {
grid-template-columns: minmax(0, 1fr);
}
.sidebar,
.with-player .sidebar {
position: static;
height: auto;
padding: 14px 16px 10px;
border-right: 0;
border-bottom: 1px solid var(--border);
}
.brand {
padding: 0 0 10px;
}
.rule-info {
padding: 0;
}
.mix-list {
display: flex;
gap: 6px;
overflow-x: auto;
margin: 0 -16px;
padding: 0 16px 4px;
scrollbar-width: none;
}
.mix-list a {
border: 1px solid var(--border);
border-radius: 999px;
padding: 6px 12px;
}
.mix-name {
overflow: visible;
}
.liked-link {
margin: 0;
padding: 0;
border: 0;
}
.content {
padding: 20px 16px 40px;
}
.mix-header {
flex-direction: column;
align-items: stretch;
gap: 18px;
}
.mix-art {
width: 100%;
height: 140px;
}
.track {
grid-template-columns: 32px 40px minmax(0, 1fr) auto;
gap: 10px;
padding: 6px 0;
}
.track-meta,
.track-duration,
.track-album {
display: none;
}
.player {
grid-template-columns: minmax(0, 1fr) auto;
height: auto;
padding: 10px 16px;
gap: 12px;
}
.player-main {
flex-direction: row-reverse;
}
.player-progress,
.player-queue,
.player .badge {
display: none;
}
.player-status {
right: 0;
top: -38px;
}
.with-player .content {
padding-bottom: 110px;
}
}