Compare commits

..
Author SHA1 Message Date
root 11dffdf9e6 iOS source.json for ios-v0.10.1 2026-11-20 12:25:59 -08:00
rootandClaude Opus 5.5 a8742e7e3d Folded art-left: art's left edge matches the controls' padding
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:25:54 -08:00
root ce6bce4018 iOS source.json for ios-v0.10.1 2026-11-20 12:19:26 -08:00
rootandClaude Opus 5.5 4860db6f6c Duo wide Now Playing: art matches the controls' height
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:19:12 -08:00
root 4c1956d569 iOS source.json for ios-v0.10.1 2026-11-20 10:42:45 -08:00
rootandClaude Opus 5.5 ed0fd1d184 iOS: bigger art in wide panes, Duo Split View player sits lower; build 50
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:39:40 -08:00
root 55f8574eaa iOS source.json for ios-v0.10.1 2026-11-20 10:33:03 -08:00
rootandClaude Opus 5.5 07b5636bac iOS: full-screen Now Playing watches the hinge so unfolding goes landscape; build 49
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:30:00 -08:00
root 88d3aa48e7 iOS source.json for ios-v0.10.1 2026-11-20 10:23:12 -08:00
rootandClaude Opus 5.5 d6da47db9d iOS: only the on-screen Duo pane reports split/unfolded; build 48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:20:09 -08:00
root 4dfcfbf434 iOS source.json for ios-v0.10.1 2026-11-20 10:17:11 -08:00
rootandClaude Opus 5.5 56c92e8b93 iOS: free orientation in background, re-lock after resume settles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:14:59 -08:00
root 639b5368ff iOS source.json for ios-v0.10.1 2026-11-20 10:10:17 -08:00
rootandClaude Opus 5.5 cfaedd06cf iOS 0.10.1 (build 47)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:08:08 -08:00
rootandClaude Opus 5.5 8f3a10df2f iOS: more room between art and title on the folded screen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:00:51 -08:00
rootandClaude Opus 5.5 5868430f8a iOS: unfolded upright never splits, always turns to landscape; orientation request re-checked until it takes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:58:48 -08:00
rootandClaude Opus 5.5 566c5f7e8f iOS: folded Now Playing runs into the bottom strip, orientation lock re-asserts on resume
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:50:23 -08:00
rootandClaude Opus 5.5 e833af2704 iOS: vocals controls only when playing stems with a vocals stem
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:31:10 -08:00
rootandClaude Opus 5.5 c9fa90a840 iOS: hide vocals controls without stems, paint Duo hinge gap, playlist bar per drawing, drop Album Color Background, Colour to Color
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 09:20:18 -08:00
rootandClaude Opus 5.5 0516362461 iOS: Use Stem Server switch for Plex-only playback, build 42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 08:59:13 -08:00
rootandClaude Opus 5.5 7843ff562b iOS build 41
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 07:23:02 -08:00
rootandClaude Opus 5.5 9e0d7236c2 iOS: seek bar uses the album art accent when Match Album Art is on
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 07:22:42 -08:00
rootandClaude Opus 5.5 8e57b9d0cd Album art theme on web and iOS, roomier player bar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:39:05 -08:00
rootandClaude Opus 5.5 0c9cae5b11 Web: cleaner grouped settings page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:29:23 -08:00
root a79c134838 iOS source.json for ios-v0.10.0 2026-11-19 22:26:40 -08:00
rootandClaude Opus 5.5 a0bbb3d52b Merge origin/main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:26:33 -08:00
rootandClaude Opus 5.5 54ba60d554 Merge dev into main for iOS 0.10.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:24:45 -08:00
rootandClaude Opus 5.5 ba1804b87b iOS 0.10.0 (build 40)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:24:45 -08:00
rootandClaude Opus 5.5 96098a10a9 Web: cleaner sidebar album art tile
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:14:43 -08:00
rootandClaude Opus 5.5 84f351021f Web: drop sidebar playlist list, pin side art, trim help text, redo mixer action buttons
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:04:41 -08:00
rootandClaude Opus 5.5 f624a9866a Web: sidebar playlists fixed for 1080p, side album art, vertical stem faders with live meters
- Nav scrolls, playlists section always gets room, boot race fixed (waits on connect)
- Album art expands into the left sidebar (Feishin style), collapses on hover button
- Mixer: tall vertical channel strips with per-stem peak meters (AnalyserNode, rAF, transform-only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:57:24 -08:00
rootandClaude Opus 5.5 115eb28bdf Web: queue button to the right, expandable art, big drag-anywhere stem faders
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:10:39 -08:00
rootandClaude Opus 5.5 e23311bff6 Web: Feishin-style layout and graphite default theme
Sidebar with icons and a playlist list, blurred-art detail headers with a
round play toolbar, card hover play, track table with column headers and an
album column, slimmer 90px player bar. Old amber default moves to graphite once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:57:41 -08:00
rootandClaude Opus 5.5 a708d28788 Web: cleaner player, iOS-style mixer, NO STEMS tags, cache-busting
Mixer rows mirror iOS (stem colours, percent, red M, yellow S) and update in
place so taps answer at once. Karaoke toggle dropped from the mixer top (the
preset covers it). Queue button moves bottom left. Badges mark songs without
stems instead of with. Playlist art goes through the photo transcoder with the
raw composite as fallback. No backdrop blur, lazy card rendering. stemserve
stamps web assets with ?v=<build> (immutable) and sends ETags, so a plain
reload picks up new builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:43:44 -08:00
rootandClaude Opus 5.5 8c8157c489 Folded Now Playing: use the bottom space, bigger art (dev 39)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 17:14:49 -08:00
rootandClaude Opus 5.5 1d7576371a Play from Plex when the stem server is off or unreachable (dev 38)
Stems are used only when the stem server is online or they're fully
downloaded. A failed stem open falls back to Plex's own file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 17:10:19 -08:00
rootandClaude Opus 5.5 ac0e962105 New app icon: glowing stem-colored capsules on a night gradient (dev 37)
Generator in ios/scripts/make-icon.py renders release, dev (sash),
dark and tinted variants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 16:59:51 -08:00
rootandClaude Opus 5.5 e02428ab70 Re-pick Plex server address on network change, foreground, and stream failure (dev 36)
The address chosen at sign-in (LAN first) was kept forever, so away from
home streams hit a dead LAN address (TLS error) or the relay (503). Store
every address plex.tv lists, probe them all bypassing the offline cache,
and keep the best one that answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:56:02 -08:00
rootandClaude Opus 5.5 9f68aa588b Dev 35: Duo orientation lock, folded portrait only, unfolded landscape only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:41:59 -08:00
rootandClaude Opus 5.5 406895a3f0 Dev 34: left-aligned art only when folded
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:36:54 -08:00
rootandClaude Opus 5.5 02539d72b1 Dev 33: deck stems fill the pane to the hinge and bottom, folded art view uses snug controls
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:30:17 -08:00
cdnutterandClaude Opus 5.5 3d047fed04 Fix agentic-coding disclaimer formatting
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:29:43 -08:00
rootandClaude Opus 5.5 71134ff322 Fix agentic-coding disclaimer formatting
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:29:17 -08:00
rootandClaude Opus 5.5 d248abf143 Dev 32: full-width unfolded stem bars, roomier rows, fixed tab bar slots across fold
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:22:03 -08:00
cdnutterandClaude Opus 5.5 343b8c9af8 Update agentic-coding disclaimer to new format
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:21:28 -08:00
rootandClaude Opus 5.5 2dca5467db Update agentic-coding disclaimer to new format
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 10:13:54 -08:00
root 887c76dc04 iOS source.json for ios-v0.9.0 2026-11-18 17:21:51 -08:00
root 15ba897402 Merge dev into main for iOS 0.9.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	ios/project.yml
#	ios/scripts/build-ipa.sh
2026-11-18 17:20:47 -08:00
rootandClaude Opus 5.5 1072dde293 iOS dev 31: folded left-align art setting, folded Duo locked upright, tab bar order stable across fold/unfold
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 17:20:32 -08:00
rootandClaude Opus 5.5 c33079c96a iOS publish.sh: send the tag, not the title, as tag_name
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:03:51 -08:00
rootandClaude Opus 5.5 4ae6136847 iOS source.json: no releases (restart at 0.9.0)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:03:42 -08:00
rootandClaude Opus 5.5 13f4fc5afe source.json: drop deleted 1.0.x releases
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:55:30 -08:00
root 40c72000aa publish.sh: readable release titles (Stemify iOS <label>, Dev Build <n>)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 190b793043)
2026-11-18 14:55:26 -08:00
rootandClaude Opus 5.5 3a3a20107b publish.sh: dev uploads go to ?source=dev (developer 404s)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:12:36 -08:00
44 changed files with 1334 additions and 652 deletions

No files matched your search

+6 -1
View File
@@ -1,4 +1,9 @@
### ⚠️ THIS PROJECT WAS ENTIRELY VIBECODED AND IS SLOP. DO NOT PROCEED IF YOU DO NOT ALIGN WITH THESE VALUES. DO NOT COMPLAIN ABOUT IT IN PULL RELEASES, ISSUES, ETC. UNLESS THERE ARE SEVERE SECURITY RISKS. THEY WILL BE REMOVED. PROCEED AT YOUR OWN RISK! ⚠️ > [!CAUTION]
> This project heavily used agentic coding practices. It is not recommended to use this for production and should be heavily monitored prior to any implementation. If you do not align with agentic-coding values, do not use this application.
> The model(s) used: **Claude Opus 5.5, Claude Sonnet 5.5**
> AI contribution: **99%**, Human contribution: **1%**
# Stemify # Stemify
+1 -1
View File
@@ -4,7 +4,7 @@ A Plex music player for the OnePlus 15 that plays the stems stemd separates on y
unraid server: per-stem faders, mute/solo, karaoke-style presets, a master volume drawn unraid server: per-stem faders, mute/solo, karaoke-style presets, a master volume drawn
over a Plexamp-style waveform seek bar, a 10-band graphic EQ plus Equalizer APO-style over a Plexamp-style waveform seek bar, a 10-band graphic EQ plus Equalizer APO-style
parametric filters with per-device profiles, and an parametric filters with per-device profiles, and an
iOS look in Black, Dark or White (flat colours, no gradients). iOS look in Black, Dark or White (flat colors, no gradients).
## Install ## Install
@@ -48,7 +48,7 @@ import java.io.IOException
import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
/** Display order and colours for stems, matching the desktop app. */ /** Display order and colors for stems, matching the desktop app. */
object Stems { object Stems {
val ORDER = listOf("vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix") val ORDER = listOf("vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix")
private val COLORS = mapOf( private val COLORS = mapOf(
@@ -276,7 +276,7 @@ fun Cell(
} }
} }
/** Settings.app-style coloured rounded-square icon. */ /** Settings.app-style colored rounded-square icon. */
@Composable @Composable
fun SettingsIcon(vector: ImageVector, bg: Color) { fun SettingsIcon(vector: ImageVector, bg: Color) {
Box(Modifier.size(30.dp).clip(RoundedCornerShape(7.dp)).background(bg), contentAlignment = Alignment.Center) { Box(Modifier.size(30.dp).clip(RoundedCornerShape(7.dp)).background(bg), contentAlignment = Alignment.Center) {
@@ -113,7 +113,7 @@ private fun newFilter(type: FilterType) = EqFilter(EqController.newFilterId(), t
/** /**
* The EQ's response, log frequency across, dB up. Left and right are drawn separately when * The EQ's response, log frequency across, dB up. Left and right are drawn separately when
* some filter applies to only one of them (right in orange). [nodes] are drawn as numbered * some filter applies to only one of them (right in orange). [nodes] are drawn as numbered
* handles; [highlight] gets its own curve in the accent colour. * handles; [highlight] gets its own curve in the accent color.
*/ */
@Composable @Composable
fun EqCurve( fun EqCurve(
@@ -102,8 +102,8 @@ import kotlin.math.min
enum class NpPanel { Art, Mixer, Queue } enum class NpPanel { Art, Mixer, Queue }
/** /**
* A solid colour from the album art, pushed dark (or light for the White theme) so text * A solid color from the album art, pushed dark (or light for the White theme) so text
* stays readable. One flat colour: no gradients. * stays readable. One flat color: no gradients.
*/ */
@Composable @Composable
private fun albumColor(thumb: String?, enabled: Boolean, dark: Boolean): Color? { private fun albumColor(thumb: String?, enabled: Boolean, dark: Boolean): Color? {
@@ -400,8 +400,8 @@ fun AppearanceScreen() {
} }
} }
}) })
section("np", header = "Now Playing", footer = "Paints the Now Playing screen in one solid colour taken from the album art.", rows = listOf { section("np", header = "Now Playing", footer = "Paints the Now Playing screen in one solid color taken from the album art.", rows = listOf {
Cell("Album Colour Background", trailing = { IosSwitch(albumColor, { s.albumColorNowPlaying.value = it }) }) Cell("Album Color Background", trailing = { IosSwitch(albumColor, { s.albumColorNowPlaying.value = it }) })
}) })
} }
} }
@@ -24,7 +24,7 @@ import com.stemify.mobile.core.Accent
import com.stemify.mobile.core.ThemeMode import com.stemify.mobile.core.ThemeMode
import kotlin.math.exp import kotlin.math.exp
/** iOS semantic colours, flattened to solid values for each scheme. */ /** iOS semantic colors, flattened to solid values for each scheme. */
@Immutable @Immutable
data class Palette( data class Palette(
val dark: Boolean, val dark: Boolean,
@@ -130,7 +130,7 @@ fun IosTheme(mode: ThemeMode, accent: Accent, content: @Composable () -> Unit) {
CompositionLocalProvider(LocalPalette provides p, content = content) CompositionLocalProvider(LocalPalette provides p, content = content)
} }
/** BasicText with iOS defaults: label colour, single line, tail ellipsis. */ /** BasicText with iOS defaults: label color, single line, tail ellipsis. */
@Composable @Composable
fun Txt( fun Txt(
text: String, text: String,
+2 -2
View File
@@ -1,6 +1,6 @@
"""Office-style ribbon icons: flat, two-tone, drawn from SVG at whatever size QML asks for. """Office-style ribbon icons: flat, two-tone, drawn from SVG at whatever size QML asks for.
image://icon/<name>[/<hex colour>] — the colour overrides the dark-gray ink (for white-on-green chrome). image://icon/<name>[/<hex color>] — the color overrides the dark-gray ink (for white-on-green chrome).
""" """
from PySide6.QtCore import QByteArray, QRectF, Qt from PySide6.QtCore import QByteArray, QRectF, Qt
@@ -15,7 +15,7 @@ RED = "#D13438"
ORANGE = "#E8912D" ORANGE = "#E8912D"
LIGHT = "#FFFFFF" LIGHT = "#FFFFFF"
# Each icon is SVG body markup on a 32×32 grid; {ink} is the main colour. # Each icon is SVG body markup on a 32×32 grid; {ink} is the main color.
ICONS = { ICONS = {
"play": f'<path fill="{GREEN}" d="M9 5v22l18-11z"/>', "play": f'<path fill="{GREEN}" d="M9 5v22l18-11z"/>',
"pause": '<path fill="{ink}" d="M8 5h6v22H8zM18 5h6v22h-6z"/>', "pause": '<path fill="{ink}" d="M8 5h6v22H8zM18 5h6v22h-6z"/>',
+1 -1
View File
@@ -7,7 +7,7 @@ import urllib.error
import urllib.parse import urllib.parse
import urllib.request import urllib.request
# Display order and colours, matching the desktop separator and the phone. # Display order and colors, matching the desktop separator and the phone.
ORDER = ["vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix"] ORDER = ["vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix"]
COLORS = { COLORS = {
"vocals": "#FF7AB6", "drums": "#FFB547", "bass": "#7C8CFF", "other": "#4CD07D", "vocals": "#FF7AB6", "drums": "#FFB547", "bass": "#7C8CFF", "other": "#4CD07D",
+1 -1
View File
@@ -93,7 +93,7 @@ class IconProvider(QQuickImageProvider):
BG = _hex("1D1E21") BG = _hex("1D1E21")
GLASS_TINT = _hex("242529") GLASS_TINT = _hex("242529")
# (color, cx, cy, sigma as fraction of the larger side, strength) # (color, cx, cy, sigma as fraction of the larger side, strength)
# Kept faint so the window reads as neutral dark gray with a hint of Aero colour. # Kept faint so the window reads as neutral dark gray with a hint of Aero color.
BLOBS = [ BLOBS = [
(_hex("3BA8FF"), 0.10, 0.05, 0.30, 0.14), (_hex("3BA8FF"), 0.10, 0.05, 0.30, 0.14),
(_hex("7C8CFF"), 0.62, 0.18, 0.22, 0.06), (_hex("7C8CFF"), 0.62, 0.18, 0.22, 0.06),
+8
View File
@@ -45,6 +45,14 @@ final class AppGraph {
mediaSession = URLSession(configuration: m) mediaSession = URLSession(configuration: m)
plex = PlexClient(http: apiHttp, settings: settings) plex = PlexClient(http: apiHttp, settings: settings)
let plex = plex
// Left home or joined Wi-Fi: the saved Plex address may be dead now. Give the new link a moment first.
net.onChange {
Task.detached {
try? await Task.sleep(nanoseconds: 1_500_000_000)
await plex.reroute("network changed")
}
}
reach = HomeReach(settings: settings, net: net) reach = HomeReach(settings: settings, net: net)
let reach = reach let reach = reach
carHttp.forceCache = { !reach.lastKnown } carHttp.forceCache = { !reach.lastKnown }
+30
View File
@@ -20,12 +20,41 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
return UISceneConfiguration(name: "Phone", sessionRole: session.role) return UISceneConfiguration(name: "Phone", sessionRole: session.role)
} }
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
Orientation.mask
}
/// Siri: "Play <album> on Stemify". /// Siri: "Play <album> on Stemify".
func application(_ application: UIApplication, handlerFor intent: INIntent) -> Any? { func application(_ application: UIApplication, handlerFor intent: INIntent) -> Any? {
intent is INPlayMediaIntent ? PlayMediaHandler() : nil intent is INPlayMediaIntent ? PlayMediaHandler() : nil
} }
} }
/// Folded on the iPhone Duo the app stays upright; everywhere else it turns as usual.
enum Orientation {
nonisolated(unsafe) static var mask: UIInterfaceOrientationMask = .allButUpsideDown
/// Folded Duo: portrait only. Unfolded Duo: landscape only. Anything else turns freely.
/// Also re-checks the window when the mask is unchanged: a request made while the app was
/// in the background can be refused, which left the folded screen stuck sideways on return.
@MainActor static func lock(_ m: UIInterfaceOrientationMask, retry: Int = 6) {
let changed = m != mask
mask = m
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes where scene.session.role == .windowApplication {
if changed { scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations() }
let now = UIInterfaceOrientationMask(rawValue: 1 << scene.effectiveGeometry.interfaceOrientation.rawValue)
guard m != .allButUpsideDown, !m.contains(now) else { continue }
scene.requestGeometryUpdate(.iOS(interfaceOrientations: m)) { _ in }
// The request can be dropped silently (mid-unfold, just back from the background), so check it took.
guard retry > 0 else { continue }
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(500))
if mask == m { lock(m, retry: retry - 1) }
}
}
}
}
@main @main
struct StemifyApp: App { struct StemifyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var delegate @UIApplicationDelegateAdaptor(AppDelegate.self) private var delegate
@@ -39,6 +68,7 @@ struct StemifyApp: App {
AppActivity.setPhone(p != .background) AppActivity.setPhone(p != .background)
guard p == .active else { return } guard p == .active else { return }
AppGraph.shared.eq.refreshRoute() AppGraph.shared.eq.refreshRoute()
Task.detached { await AppGraph.shared.plex.reroute("foreground") }
// Keep downloaded playlists in step with the server, like Plexamp. // Keep downloaded playlists in step with the server, like Plexamp.
Task { await AppGraph.shared.downloads.refresh() } Task { await AppGraph.shared.downloads.refresh() }
} }
+1 -1
View File
@@ -50,7 +50,7 @@ final class HomeReach: @unchecked Sendable {
let (at, last) = stamp.with { (checkedAt, _last) } let (at, last) = stamp.with { (checkedAt, _last) }
if at != 0 && now - at < Self.ttl { return last } if at != 0 && now - at < Self.ttl { return last }
let urls = settings.servers.map { $0.base + ($0.kind == .plex ? "/identity" : "/System/Info/Public") } let urls = settings.servers.map { $0.base + ($0.kind == .plex ? "/identity" : "/System/Info/Public") }
+ [settings.stemUrl.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + "/api/info"] + (settings.stemServerOff ? [] : [settings.stemUrl.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + "/api/info"])
let ok = await withTaskGroup(of: Bool.self) { g in let ok = await withTaskGroup(of: Bool.self) { g in
for u in urls { g.addTask { await self.answers(u) } } for u in urls { g.addTask { await self.answers(u) } }
for await r in g where r { g.cancelAll(); return true } for await r in g where r { g.cancelAll(); return true }
+8 -3
View File
@@ -107,9 +107,9 @@ final class Settings: @unchecked Sendable {
private static let keys = [ private static let keys = [
"servers", "plexUrl", "plexToken", "plexUser", "plexMachineId", "musicSection", "musicSectionTitle", "servers", "plexUrl", "plexToken", "plexUser", "plexMachineId", "musicSection", "musicSectionTitle",
"stemUrl", "stemToken", "plexAccountToken", "stemRoots", "theme", "accent", "albumColorNowPlaying", "highRefreshRate", "stemUrl", "stemToken", "stemServerOff", "plexAccountToken", "stemRoots", "theme", "accent", "albumTheme", "highRefreshRate",
"stemQuality", "cacheLimitGb", "downloadsWifiOnly", "downloadSort", "keepStemMix", "masterVolume", "tabLayout", "stemQuality", "cacheLimitGb", "downloadsWifiOnly", "downloadSort", "keepStemMix", "masterVolume", "tabLayout",
"karaokeVocals", "karaokeSoftDb", "playbackSpeed", "stemsOnly", "noStems", "precacheCount", "hiddenNowPlaying", "presets", "presetOrder", "hiddenPresets", "lockedPreset", "webStations", "lockScreenMix", "swipeUpQueue", "acapella", "crossfadeSec", "sweetFades", "karaokeVocals", "karaokeSoftDb", "playbackSpeed", "stemsOnly", "noStems", "precacheCount", "hiddenNowPlaying", "presets", "presetOrder", "hiddenPresets", "lockedPreset", "webStations", "lockScreenMix", "swipeUpQueue", "acapella", "crossfadeSec", "sweetFades", "foldedArtLeft",
] ]
private func read<T>(_ kp: KeyPath<Settings, T>, _ key: String, _ def: T) -> T { private func read<T>(_ kp: KeyPath<Settings, T>, _ key: String, _ def: T) -> T {
@@ -205,6 +205,8 @@ final class Settings: @unchecked Sendable {
/// The id a new server gets: empty (bare keys) when no server holds it yet. /// The id a new server gets: empty (bare keys) when no server holds it yet.
func nextServerId() -> String { servers.contains { $0.id.isEmpty } ? MediaServer.newId() : "" } func nextServerId() -> String { servers.contains { $0.id.isEmpty } ? MediaServer.newId() : "" }
/// Plex only: no stem index, no stemserve traffic.
var stemServerOff: Bool { get { read(\.stemServerOff, "stemServerOff", false) } set { write(\.stemServerOff, "stemServerOff", newValue, false) } }
var stemUrl: String { get { read(\.stemUrl, "stemUrl", "http://192.168.86.2:8765") } set { write(\.stemUrl, "stemUrl", newValue, "http://192.168.86.2:8765") } } var stemUrl: String { get { read(\.stemUrl, "stemUrl", "http://192.168.86.2:8765") } set { write(\.stemUrl, "stemUrl", newValue, "http://192.168.86.2:8765") } }
var stemToken: String { get { read(\.stemToken, "stemToken", "") } set { write(\.stemToken, "stemToken", newValue, "") } } var stemToken: String { get { read(\.stemToken, "stemToken", "") } set { write(\.stemToken, "stemToken", newValue, "") } }
var plexAccountToken: String { get { read(\.plexAccountToken, "plexAccountToken", "") } set { write(\.plexAccountToken, "plexAccountToken", newValue, "") } } var plexAccountToken: String { get { read(\.plexAccountToken, "plexAccountToken", "") } set { write(\.plexAccountToken, "plexAccountToken", newValue, "") } }
@@ -219,7 +221,10 @@ final class Settings: @unchecked Sendable {
/// Swipe up on Now Playing opens Playing Next. /// Swipe up on Now Playing opens Playing Next.
var swipeUpQueue: Bool { get { read(\.swipeUpQueue, "swipeUpQueue", true) } set { write(\.swipeUpQueue, "swipeUpQueue", newValue, true) } } var swipeUpQueue: Bool { get { read(\.swipeUpQueue, "swipeUpQueue", true) } set { write(\.swipeUpQueue, "swipeUpQueue", newValue, true) } }
var lockScreenMix: Bool { get { read(\.lockScreenMix, "lockScreenMix", false) } set { write(\.lockScreenMix, "lockScreenMix", newValue, false) } } var lockScreenMix: Bool { get { read(\.lockScreenMix, "lockScreenMix", false) } set { write(\.lockScreenMix, "lockScreenMix", newValue, false) } }
var albumColorNowPlaying: Bool { get { read(\.albumColorNowPlaying, "albumColorNowPlaying", false) } set { write(\.albumColorNowPlaying, "albumColorNowPlaying", newValue, false) } } /// The whole app takes its accent and surface tint from the playing track's art.
var albumTheme: Bool { get { read(\.albumTheme, "albumTheme", false) } set { write(\.albumTheme, "albumTheme", newValue, false) } }
/// Folded iPhone Duo: Now Playing's art sits at the left instead of centred.
var foldedArtLeft: Bool { get { read(\.foldedArtLeft, "foldedArtLeft", false) } set { write(\.foldedArtLeft, "foldedArtLeft", newValue, false) } }
var highRefreshRate: Bool { get { read(\.highRefreshRate, "highRefreshRate", true) } set { write(\.highRefreshRate, "highRefreshRate", newValue, true) } } var highRefreshRate: Bool { get { read(\.highRefreshRate, "highRefreshRate", true) } set { write(\.highRefreshRate, "highRefreshRate", newValue, true) } }
var stemQuality: StemQuality { get { readEnum(\.stemQuality, "stemQuality", .High) } set { writeEnum(\.stemQuality, "stemQuality", newValue, .High) } } var stemQuality: StemQuality { get { readEnum(\.stemQuality, "stemQuality", .High) } set { writeEnum(\.stemQuality, "stemQuality", newValue, .High) } }
+47 -9
View File
@@ -1,7 +1,7 @@
import AVFoundation import AVFoundation
import Foundation import Foundation
/// Display order and colours for stems, matching the desktop app. /// Display order and colors for stems, matching the desktop app.
enum Stems { enum Stems {
static let order = ["vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix"] static let order = ["vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix"]
private static let colors: [String: UInt32] = [ private static let colors: [String: UInt32] = [
@@ -639,7 +639,7 @@ final class PlaybackManager: StemEngineListener, @unchecked Sendable {
/// True when [track] would play without the home network: its stems (or, lacking stems, its file) are fully cached. /// True when [track] would play without the home network: its stems (or, lacking stems, its file) are fully cached.
func playableOffline(_ track: Track) -> Bool { func playableOffline(_ track: Track) -> Bool {
if let entry = stems.find(track) { if let entry = stems.find(track) {
return StemQuality.allCases.contains { q in entry.stems.allSatisfy { cache.isComplete(Self.stemKey(entry, $0.file, $0.size, q)) } } return stemsCached(entry)
} }
return track.partKey != nil && cache.isComplete(Self.plexKey(track)) return track.partKey != nil && cache.isComplete(Self.plexKey(track))
} }
@@ -721,19 +721,57 @@ final class PlaybackManager: StemEngineListener, @unchecked Sendable {
} }
private func openDetached(_ track: Track, _ startMs: Int64) async throws -> (TrackSession, StemEntry?) { private func openDetached(_ track: Track, _ startMs: Int64) async throws -> (TrackSession, StemEntry?) {
// Plain Plex files need a playback session first, or a Remote Access upload limit fails them. // Stems when the stem server can serve them (or they're downloaded); Plex's own file otherwise.
var stream: URL? // Stemify works as a plain Plex player: a stem server that's off or out of reach only costs the stems.
if stems.find(track) == nil, !cache.isComplete(Self.plexKey(track)) { stream = await plex.streamUrl(track) } if let entry = await stemsToPlay(track) {
return try await withCheckedThrowingContinuation { [stream] cont in do {
return try await openOn(track, startMs, entry, nil)
} catch {
if Task.isCancelled { throw error }
Log.shared.error("play", "stems for \(track.title) failed (\(error.localizedDescription)), playing from Plex")
Task.detached { [stems] in await stems.refresh() }
}
}
let plain = !cache.isComplete(Self.plexKey(track))
let stream = plain ? await plex.streamUrl(track) : nil
do {
return try await openOn(track, startMs, nil, stream)
} catch {
// A dead saved address (left home, network changed): pick a working one and try once more.
guard plain, !Task.isCancelled, await plex.reroute("stream failed") else { throw error }
return try await openOn(track, startMs, nil, await plex.streamUrl(track))
}
}
/// The stem entry to play, or nil to play Plex's file: skips stems the stem server can't
/// serve right now unless they're fully downloaded.
private func stemsToPlay(_ track: Track) async -> StemEntry? {
guard let entry = stems.find(track) else { return nil }
if stemsCached(entry) { return entry }
// Right after launch the first check may still be running: give it a few seconds
// rather than sit through a long timeout on a server that isn't there.
var waited = 0
while case .unknown = stems.status, waited < 30, !Task.isCancelled {
try? await Task.sleep(nanoseconds: 100_000_000); waited += 1
}
if case .online = stems.status { return entry }
return nil
}
private func stemsCached(_ entry: StemEntry) -> Bool {
StemQuality.allCases.contains { q in entry.stems.allSatisfy { cache.isComplete(Self.stemKey(entry, $0.file, $0.size, q)) } }
}
private func openOn(_ track: Track, _ startMs: Int64, _ entry: StemEntry?, _ stream: URL?) async throws -> (TrackSession, StemEntry?) {
try await withCheckedThrowingContinuation { cont in
DispatchQueue.global(qos: .userInitiated).async { [self] in DispatchQueue.global(qos: .userInitiated).async { [self] in
cont.resume(with: Result { try open(track, startMs, stream: stream) }) cont.resume(with: Result { try open(track, startMs, entry: entry, stream: stream) })
} }
} }
} }
/// Opens every stem (or the original file) and waits for the decoders to know their format. /// Opens every stem (or the original file) and waits for the decoders to know their format.
private func open(_ track: Track, _ startMs: Int64, stream: URL? = nil) throws -> (TrackSession, StemEntry?) { private func open(_ track: Track, _ startMs: Int64, entry: StemEntry?, stream: URL? = nil) throws -> (TrackSession, StemEntry?) {
let entry = stems.find(track)
var sources: [(name: String, key: String, url: URL?, hint: String)] = [] var sources: [(name: String, key: String, url: URL?, hint: String)] = []
if let entry { if let entry {
let q = qualityFor(entry) let q = qualityFor(entry)
+3
View File
@@ -17,6 +17,9 @@ struct MediaServer: Codable, Hashable, Identifiable {
var machineId = "" var machineId = ""
var sections: [String] = [] var sections: [String] = []
var sectionTitles = "" var sectionTitles = ""
/// Every address plex.tv lists for this server, best first (local, remote, relay).
/// Optional so servers saved before it still decode.
var connections: [String]? = nil
var signedIn: Bool { !token.isEmpty } var signedIn: Bool { !token.isEmpty }
var ready: Bool { signedIn && !sections.isEmpty } var ready: Bool { signedIn && !sections.isEmpty }
+41
View File
@@ -21,6 +21,7 @@ final class PlexClient: @unchecked Sendable {
private let lock = NSLock() private let lock = NSLock()
private var builtFrom = "\u{0}" private var builtFrom = "\u{0}"
private var built: [MediaSource] = [] private var built: [MediaSource] = []
private var rerouting = false
init(http: Http, settings: Settings) { init(http: Http, settings: Settings) {
self.http = http self.http = http
@@ -285,6 +286,45 @@ final class PlexClient: @unchecked Sendable {
return box.url return box.url
} }
// ---- address re-picking ------------------------------------------------------------
/// Re-picks each Plex server's address. Sign-in picks one (a LAN address at home) and it
/// used to stick forever, so away from home every stream hit a dead LAN address (TLS error)
/// or a relay (503). Probes every known address and keeps the best one that answers;
/// when none answer, asks plex.tv for the current list. Returns true if any address changed.
@discardableResult
func reroute(_ why: String) async -> Bool {
lock.lock()
if rerouting { lock.unlock(); return false }
rerouting = true
lock.unlock()
defer { lock.lock(); rerouting = false; lock.unlock() }
let tv = plexTv()
var changed = false
for srv in settings.servers where srv.kind == .plex && srv.signedIn {
var uris = srv.connections ?? []
if !uris.contains(srv.base) { uris.append(srv.base) }
var best = await tv.firstAlive(uris, machineId: srv.machineId, token: srv.token)
var fresh: [String]?
if best == nil || srv.connections == nil, !srv.machineId.isEmpty,
let r = (try? await tv.resources(token: srv.token))?.first(where: { $0.clientIdentifier == srv.machineId }) {
fresh = PlexServer.ranked(r)
if best == nil, let f = fresh { best = await tv.firstAlive(f, machineId: srv.machineId, token: srv.token) }
}
var s = srv
if let fresh { s.connections = fresh }
if let best { s.url = best }
guard s != srv else { continue }
if s.url != srv.url {
changed = true
Log.shared.info("plex", "\(srv.label) (\(why)): \(srv.base) -> \(s.base)")
}
settings.save(s)
}
return changed
}
// ---- sign-in helpers -------------------------------------------------------------- // ---- sign-in helpers --------------------------------------------------------------
/// A Plex client for plex.tv calls and for a server that isn't saved yet. /// A Plex client for plex.tv calls and for a server that isn't saved yet.
@@ -323,6 +363,7 @@ final class PlexClient: @unchecked Sendable {
?? settings.servers.first { $0.kind == .plex && $0.machineId.isEmpty && $0.base == h.url.trimmingCharacters(in: CharacterSet(charactersIn: "/")) } ?? settings.servers.first { $0.kind == .plex && $0.machineId.isEmpty && $0.base == h.url.trimmingCharacters(in: CharacterSet(charactersIn: "/")) }
var srv = known ?? MediaServer(id: settings.nextServerId(), kind: .plex) var srv = known ?? MediaServer(id: settings.nextServerId(), kind: .plex)
srv.url = h.url srv.url = h.url
srv.connections = PlexServer.ranked(h.res)
srv.token = h.res.accessToken.isEmpty ? token : h.res.accessToken srv.token = h.res.accessToken.isEmpty ? token : h.res.accessToken
srv.machineId = h.res.clientIdentifier srv.machineId = h.res.clientIdentifier
srv.user = user srv.user = user
+33 -13
View File
@@ -375,21 +375,41 @@ final class PlexServer: MediaSource, @unchecked Sendable {
/// The first address that answers /identity as the expected server, local ones first, relay last. /// The first address that answers /identity as the expected server, local ones first, relay last.
func reach(_ r: PlexResource, userToken: String) async -> String? { func reach(_ r: PlexResource, userToken: String) async -> String? {
let tok = r.accessToken.isEmpty ? userToken : r.accessToken let tok = r.accessToken.isEmpty ? userToken : r.accessToken
let ordered = r.connections.filter { !$0.uri.isEmpty }.sorted { rank($0) < rank($1) } return await firstAlive(Self.ranked(r), machineId: r.clientIdentifier, token: tok)
for c in ordered {
let base = c.uri.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
guard let u = URL(string: base + "/identity") else { continue }
var req = request(u, withToken: false)
req.setValue(tok, forHTTPHeaderField: "X-Plex-Token")
req.timeoutInterval = 3.5
guard let body = try? await http.data(req),
let id = try? decode(body).machineIdentifier, id == r.clientIdentifier || r.clientIdentifier.isEmpty else { continue }
return base
}
return nil
} }
private func rank(_ c: PlexResource.Connection) -> Int { c.relay ? 2 : (c.local ? 0 : 1) } /// A resource's addresses, local first, then remote, relay last.
static func ranked(_ r: PlexResource) -> [String] {
r.connections.filter { !$0.uri.isEmpty }
.sorted { ($0.relay ? 2 : ($0.local ? 0 : 1)) < ($1.relay ? 2 : ($1.local ? 0 : 1)) }
.map { $0.uri.trimmingCharacters(in: CharacterSet(charactersIn: "/")) }
}
/// Probes every address's /identity at once, straight to the network (the offline cache
/// would make a dead LAN address look alive), and returns the earliest one in [uris] that
/// answers as [machineId].
func firstAlive(_ uris: [String], machineId: String, token: String, timeout: TimeInterval = 4) async -> String? {
let bases = uris.map { $0.trimmingCharacters(in: CharacterSet(charactersIn: "/")) }
let alive: [Int] = await withTaskGroup(of: Int?.self) { group in
for (i, b) in bases.enumerated() {
group.addTask { [self] in
guard let u = URL(string: b + "/identity") else { return nil }
var req = request(u, withToken: false)
req.setValue(token, forHTTPHeaderField: "X-Plex-Token")
req.timeoutInterval = timeout
guard let (body, resp) = try? await http.session.data(for: req),
(resp as? HTTPURLResponse)?.statusCode == 200,
let id = try? decode(body).machineIdentifier,
machineId.isEmpty || id == machineId else { return nil }
return i
}
}
var out: [Int] = []
for await i in group { if let i { out.append(i) } }
return out
}
return alive.min().map { bases[$0] }
}
func checkPin(_ id: Int64) async throws -> PlexPin { func checkPin(_ id: Int64) async throws -> PlexPin {
let req = request(URL(string: "https://plex.tv/api/v2/pins/\(id)")!, withToken: false) let req = request(URL(string: "https://plex.tv/api/v2/pins/\(id)")!, withToken: false)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 246 KiB

+15 -2
View File
@@ -5,6 +5,7 @@ enum StemServerStatus: Equatable {
case unknown case unknown
case online(tracks: Int, transcode: Bool) case online(tracks: Int, transcode: Bool)
case offline(reason: String, cachedTracks: Int) case offline(reason: String, cachedTracks: Int)
case off
var isOnline: Bool { if case .online = self { true } else { false } } var isOnline: Bool { if case .online = self { true } else { false } }
} }
@@ -65,7 +66,8 @@ final class StemServer: @unchecked Sendable {
self.settings = settings self.settings = settings
indexFile = dir.appendingPathComponent("stem_index.json") indexFile = dir.appendingPathComponent("stem_index.json")
etagFile = dir.appendingPathComponent("stem_index.etag") etagFile = dir.appendingPathComponent("stem_index.etag")
if let data = try? Data(contentsOf: indexFile), if settings.stemServerOff { status = .off }
else if let data = try? Data(contentsOf: indexFile),
let parsed = try? JSONDecoder().decode(StemIndexFile.self, from: data) { let parsed = try? JSONDecoder().decode(StemIndexFile.self, from: data) {
index = StemIndex(parsed.tracks, roots: roots()) index = StemIndex(parsed.tracks, roots: roots())
} }
@@ -111,7 +113,7 @@ final class StemServer: @unchecked Sendable {
/// Reads /api/queue. A change in the finished count pulls the new index straight away. /// Reads /api/queue. A change in the finished count pulls the new index straight away.
func pollQueue() async { func pollQueue() async {
guard !base.isEmpty, guard !settings.stemServerOff, !base.isEmpty,
let u = try? url("/api/queue"), let u = try? url("/api/queue"),
let data = try? await http.data(req(u)), let data = try? await http.data(req(u)),
let q = try? JSONDecoder().decode(QueueInfo.self, from: data) else { return } let q = try? JSONDecoder().decode(QueueInfo.self, from: data) else { return }
@@ -146,6 +148,16 @@ final class StemServer: @unchecked Sendable {
func refresh(force: Bool = false) async { func refresh(force: Bool = false) async {
await refreshLock.run { await refreshLock.run {
if settings.stemServerOff {
await MainActor.run {
let had = self.index.size > 0
self.index = StemIndex([])
self.current = nil; self.pending = []; self.failed = []
self.status = .off
if had { self.indexListeners.forEach { $0() } }
}
return
}
do { do {
let info = try JSONDecoder().decode(ServerInfo.self, from: try await http.data(req(try url("/api/info")))) let info = try JSONDecoder().decode(ServerInfo.self, from: try await http.data(req(try url("/api/info"))))
transcode = info.ffmpeg transcode = info.ffmpeg
@@ -185,6 +197,7 @@ final class StemServer: @unchecked Sendable {
} }
func find(_ track: Track) -> StemEntry? { func find(_ track: Track) -> StemEntry? {
if settings.stemServerOff { return nil }
let idx = index let idx = index
if let k = track.stemKey { return idx.entries.first { $0.key == k } } if let k = track.stemKey { return idx.entries.first { $0.key == k } }
let hit = idx.find(track.partFile, durationMs: track.durationMs) let hit = idx.find(track.partFile, durationMs: track.durationMs)
+1 -1
View File
@@ -60,7 +60,7 @@ struct Artwork: View {
} }
} }
/// A settings icon: the glyph in its colour on a faint wash of the same colour. /// A settings icon: the glyph in its color on a faint wash of the same color.
struct SettingsIcon: View { struct SettingsIcon: View {
let symbol: String let symbol: String
let bg: UInt32 let bg: UInt32
+48
View File
@@ -67,6 +67,8 @@ final class Ui {
} }
/// True while an unfolded iPhone Duo shows Now Playing docked beside the library. /// True while an unfolded iPhone Duo shows Now Playing docked beside the library.
private(set) var split = false private(set) var split = false
/// Unfolded Duo in any orientation (a hinge is showing), even before it has turned to landscape.
private(set) var unfolded = false
/// Split only: the Now Playing tab (the deck) is selected instead of `tab`. /// Split only: the Now Playing tab (the deck) is selected instead of `tab`.
var deck = true var deck = true
/// Split only: which of the deck's pages is showing. /// Split only: which of the deck's pages is showing.
@@ -120,9 +122,55 @@ final class Ui {
/// Split only: brings the stems and queue (or the lyrics) back beside Now Playing. /// Split only: brings the stems and queue (or the lyrics) back beside Now Playing.
func showDeck(_ page: DeckPage? = nil) { deck = true; if let page { deckPage = page } } func showDeck(_ page: DeckPage? = nil) { deck = true; if let page { deckPage = page } }
/// This phone has shown the Duo's folded status column at least once (saved).
private var duo = UserDefaults.standard.bool(forKey: "duoSeen")
/// Folded iPhone Duo: the outer display, kept upright.
var folded: Bool { duo && !split && !unfolded }
var isDuo: Bool { duo }
/// Called with the window's side insets. Upright, only the folded Duo has a trailing one.
func sawInsets(trailing: CGFloat, upright: Bool) {
if !duo && upright && !split && trailing > 20 {
duo = true
UserDefaults.standard.set(true, forKey: "duoSeen")
}
lockOrientation()
}
/// Split (unfolded) goes landscape at once. Portrait waits a moment and checks again, so a
/// frame without a hinge reading mid-rotation can't throw an unfolded phone back upright.
/// Back in the foreground: the phone may have been folded or unfolded meanwhile.
/// The split/unfolded flags are from before the app left, so locking on them at once can force
/// landscape on a phone folded meanwhile. Free the rotation while away and decide again once
/// the window has settled to the screen it came back on.
func resumed() {
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(300))
self.lockOrientation()
}
}
func backgrounded() { Orientation.lock(.allButUpsideDown) }
private func lockOrientation() {
if split || unfolded { Orientation.lock(.landscape); return }
guard folded else { Orientation.lock(.allButUpsideDown); return }
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(400))
if self.folded { Orientation.lock(.portrait) }
}
}
func setUnfolded(_ on: Bool) {
guard on != unfolded else { return }
unfolded = on
lockOrientation()
}
func setSplit(_ on: Bool) { func setSplit(_ on: Bool) {
guard on != split else { return } guard on != split else { return }
split = on split = on
lockOrientation()
if on { if on {
nowPlayingOpen = false nowPlayingOpen = false
} }
+89 -26
View File
@@ -6,37 +6,34 @@ import UIKit
/// (or the stems, queue and lyrics deck) on the other, and the tabs stay in the system's own bar. /// (or the stems, queue and lyrics deck) on the other, and the tabs stay in the system's own bar.
struct RootView: View { struct RootView: View {
@State private var ui = Ui(overlays: Overlays()) @State private var ui = Ui(overlays: Overlays())
@State private var art: ArtHue?
private var g: AppGraph { .shared } private var g: AppGraph { .shared }
var body: some View { var body: some View {
let s = g.settings let s = g.settings
let p = Palette.of(s.theme, s.accent) let base = Palette.of(s.theme, s.accent)
TabView(selection: Binding(get: { ui.showsDeck ? BarItem.deck : .tab(ui.tab) }, let p = s.albumTheme ? art.map { base.art($0, mode: s.theme) } ?? base : base
set: { if case .tab(let t) = $0 { ui.selectTab(t) } else { ui.showDeck() } })) { bar
// Unfolded with something playing, Now Playing leads the bar: the deck (stems, lyrics,
// queue, EQ) on this side of the hinge, the player docked on the other.
if ui.hasDeckTab {
DuoPane { NowPlayingDeck() }
.tabItem { Label("Now Playing", systemImage: "waveform") }
.tag(BarItem.deck)
}
ForEach(ui.tabs, id: \.self) { t in
DuoPane {
NavigationStack(path: ui.path(t)) {
root(t).miniPlayerRoom()
.navigationDestination(for: Route.self) { destination($0).miniPlayerRoom() }
}
.modifier(FloatingMiniPlayer())
}
.tabItem { Label(t.rawValue, systemImage: t.icon) }
.tag(BarItem.tab(t))
}
}
.modifier(GlassMiniPlayerHost()) .modifier(GlassMiniPlayerHost())
// Folded on the Duo the app stays upright (the window's trailing inset gives the Duo away).
.onGeometryChange(for: CGFloat.self) { $0.safeAreaInsets.trailing } action: { ui.sawInsets(trailing: $0, upright: vSize == .regular) }
.background(p.bg.ignoresSafeArea()) .background(p.bg.ignoresSafeArea())
.onChange(of: ui.tabs) { _, _ in ui.ensureValidTab() } .onChange(of: ui.tabs) { _, _ in ui.ensureValidTab() }
.onChange(of: phase) { _, ph in
if ph == .active { ui.resumed() } else if ph == .background { ui.backgrounded() }
}
.fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) { .fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) {
NowPlayingScreen() NowPlayingScreen()
// The panes underneath stop reporting while this covers them, so watch for the
// hinge here too: unfolding hands over to the split (docked) layout.
.background(GeometryReader { geo in
let c = DuoPane<EmptyView>.cut(geo)
Color.clear.onChange(of: c == nil ? 0 : c!.vertical ? 2 : 1, initial: true) { _, k in
guard k > 0 else { return }
ui.setUnfolded(true)
ui.setSplit(k == 2)
}
})
.overlayHost(ui.overlays, level: 1) .overlayHost(ui.overlays, level: 1)
.environment(ui) .environment(ui)
.environment(\.palette, p) .environment(\.palette, p)
@@ -51,10 +48,61 @@ struct RootView: View {
.environment(\.palette, p) .environment(\.palette, p)
.preferredColorScheme(s.theme == .White ? .light : .dark) .preferredColorScheme(s.theme == .White ? .light : .dark)
.tint(p.accent) .tint(p.accent)
.task(id: "\(g.playback.current?.track.thumb ?? "")|\(s.albumTheme)") {
guard s.albumTheme, let thumb = g.playback.current?.track.thumb else { art = nil; return }
let a = await artHue(thumb)
withAnimation(.easeInOut(duration: 0.4)) { art = a }
}
} }
@Environment(\.verticalSizeClass) private var vSize
@Environment(\.scenePhase) private var phase
private enum BarItem: Hashable { case deck, tab(Tab) } private enum BarItem: Hashable { case deck, tab(Tab) }
private var selection: Binding<BarItem> {
Binding(get: { ui.showsDeck ? BarItem.deck : .tab(ui.tab) },
set: { if case .tab(let t) = $0 { ui.selectTab(t) } else { ui.showDeck() } })
}
/// The bar always holds the same slots. Unfolded with something playing, Now Playing takes
/// the place of the last tab before Settings (iOS folds a sixth item into "More"), so folding
/// and unfolding swaps one item in place and nothing else moves.
private var slots: [BarItem] {
let all = Tab.layout(g.settings.tabLayout)
var items = all.map { BarItem.tab($0) }
guard ui.hasDeckTab else { return items }
if all.count >= Tab.maxVisible, let i = all.lastIndex(where: { $0 != .Settings }) { items[i] = .deck }
else { items.insert(.deck, at: all.lastIndex(of: .Settings) ?? items.count) }
return items
}
private var bar: some View {
TabView(selection: selection) {
ForEach(Array(slots.enumerated()), id: \.offset) { _, item in
switch item {
case .deck:
DuoPane { NowPlayingDeck() }
.tabItem { Label("Now Playing", systemImage: "waveform") }
.tag(item)
case .tab(let t):
page(t).tabItem { Label(t.rawValue, systemImage: t.icon) }.tag(item)
}
}
}
.transaction { $0.animation = nil }
}
private func page(_ t: Tab) -> some View {
DuoPane {
NavigationStack(path: ui.path(t)) {
root(t).miniPlayerRoom()
.navigationDestination(for: Route.self) { destination($0).miniPlayerRoom() }
}
.modifier(FloatingMiniPlayer())
}
}
@ViewBuilder private func root(_ t: Tab) -> some View { @ViewBuilder private func root(_ t: Tab) -> some View {
switch t { switch t {
case .Library: LibraryHome() case .Library: LibraryHome()
@@ -161,11 +209,15 @@ private struct DuoPane<Content: View>: View {
@ViewBuilder var content: Content @ViewBuilder var content: Content
@Environment(Ui.self) private var ui @Environment(Ui.self) private var ui
@AppStorage("duoSwap") private var swap = false @AppStorage("duoSwap") private var swap = false
@Environment(\.palette) private var p
@State private var shown = false
private var g: AppGraph { .shared } private var g: AppGraph { .shared }
var body: some View { var body: some View {
GeometryReader { geo in GeometryReader { geo in
let cut = Self.cut(geo) let hinge = Self.cut(geo)
// Unfolded upright (hinge across) never splits: the app turns to landscape instead.
let cut = hinge?.vertical == true ? hinge : nil
let flip = duoSwapEnabled && swap && cut?.vertical == true let flip = duoSwapEnabled && swap && cut?.vertical == true
let layout = cut?.vertical == false ? AnyLayout(VStackLayout(spacing: cut?.gap ?? 0)) : AnyLayout(HStackLayout(spacing: cut?.gap ?? 0)) let layout = cut?.vertical == false ? AnyLayout(VStackLayout(spacing: cut?.gap ?? 0)) : AnyLayout(HStackLayout(spacing: cut?.gap ?? 0))
layout { layout {
@@ -187,15 +239,22 @@ private struct DuoPane<Content: View>: View {
// Right-to-left lays the same two children out mirrored, so swapping doesn't rebuild either. // Right-to-left lays the same two children out mirrored, so swapping doesn't rebuild either.
.environment(\.layoutDirection, flip ? .rightToLeft : .leftToRight) .environment(\.layoutDirection, flip ? .rightToLeft : .leftToRight)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
// The hinge gap shows whatever is behind; paint it so the two sides read as one.
.background(p.bg.ignoresSafeArea())
.animation(.spring(duration: 0.4, bounce: 0.1), value: flip) .animation(.spring(duration: 0.4, bounce: 0.1), value: flip)
.onChange(of: cut != nil, initial: true) { _, on in ui.setSplit(on) } // Every tab has its own pane and TabView keeps hidden ones alive, so only the one on
// screen reports; a hidden one's stale size used to turn split off under the visible one.
.onChange(of: hinge != nil) { _, on in if shown { ui.setUnfolded(on) } }
.onChange(of: cut != nil) { _, on in if shown { ui.setSplit(on) } }
.onAppear { shown = true; ui.setUnfolded(hinge != nil); ui.setSplit(cut != nil) }
.onDisappear { shown = false }
} }
} }
/// Where the hinge cuts the view: sizes of the two sides and the gap between them. /// Where the hinge cuts the view: sizes of the two sides and the gap between them.
private struct Cut { var vertical: Bool; var first: CGFloat; var gap: CGFloat; var second: CGFloat } fileprivate struct Cut { var vertical: Bool; var first: CGFloat; var gap: CGFloat; var second: CGFloat }
private static func cut(_ geo: GeometryProxy) -> Cut? { fileprivate static func cut(_ geo: GeometryProxy) -> Cut? {
let size = geo.size let size = geo.size
var c: Cut? var c: Cut?
// The hinge reports inactive while the phone lies flat, so ask for inactive regions too. // The hinge reports inactive while the phone lies flat, so ask for inactive regions too.
@@ -211,6 +270,10 @@ private struct DuoPane<Content: View>: View {
let screenW = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.screen.bounds.width let screenW = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.screen.bounds.width
let half = ((screenW ?? size.width) / 2 - geo.frame(in: .global).minX).rounded() let half = ((screenW ?? size.width) / 2 - geo.frame(in: .global).minX).rounded()
c = Cut(vertical: true, first: half - 12, gap: 24, second: size.width - half - 12) c = Cut(vertical: true, first: half - 12, gap: 24, second: size.width - half - 12)
} else if UIDevice.current.userInterfaceIdiom == .phone, size.width >= 500, size.height >= 700 {
// Unfolded but still upright: only marks the phone as unfolded so it turns to landscape.
let half = (size.height / 2).rounded()
c = Cut(vertical: false, first: half - 12, gap: 24, second: size.height - half - 12)
} }
guard let c else { return nil } guard let c else { return nil }
// A region that doesn't leave usable room on both sides isn't a hinge worth splitting at. // A region that doesn't leave usable room on both sides isn't a hinge worth splitting at.
+1 -1
View File
@@ -82,7 +82,7 @@ private func effectivePreamp(_ p: EqProfile) -> Float {
/// The EQ's response, log frequency across, dB up. Left and right are drawn separately when /// The EQ's response, log frequency across, dB up. Left and right are drawn separately when
/// some filter applies to only one of them (right in orange). [nodes] are drawn as numbered /// some filter applies to only one of them (right in orange). [nodes] are drawn as numbered
/// handles; [highlight] gets its own curve in the accent colour. /// handles; [highlight] gets its own curve in the accent color.
struct EqCurve: View { struct EqCurve: View {
let chain: [EqFilter] let chain: [EqFilter]
let preampDb: Float let preampDb: Float
+67 -102
View File
@@ -15,25 +15,8 @@ func deviceIcon(_ d: OutputDevice) -> (String, UInt32) {
} }
} }
// ---- album colour ---------------------------------------------------------------------------
/// A solid colour from the album art, pushed dark (or light for the White theme) so text
/// stays readable. One flat colour: no gradients.
@MainActor
private func albumColor(_ thumb: String?, dark: Bool) async -> Color? {
guard let url = AppGraph.shared.plex.artUrl(thumb, px: 120) else { return nil }
let img: UIImage? = if let c = ArtLoader.shared.cached(url) { c } else { await ArtLoader.shared.image(url) }
guard let cg = img?.cgImage else { return nil }
return await Task.detached { () -> Color? in
guard let (h, s0, v0) = vibrant(cg) else { return nil }
let s = dark ? min(s0, 0.65) : min(s0, 0.22)
let v = dark ? min(max(v0, 0.18), 0.30) : 0.96
return Color(hue: h, saturation: s, brightness: v)
}.value
}
/// Roughly Palette's vibrant swatch: the average hue of the most saturated, mid-bright pixels. /// Roughly Palette's vibrant swatch: the average hue of the most saturated, mid-bright pixels.
private func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? { func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
let n = 24 let n = 24
var px = [UInt8](repeating: 0, count: n * n * 4) var px = [UInt8](repeating: 0, count: n * n * 4)
guard let ctx = CGContext(data: &px, width: n, height: n, bitsPerComponent: 8, bytesPerRow: n * 4, guard let ctx = CGContext(data: &px, width: n, height: n, bitsPerComponent: 8, bytesPerRow: n * 4,
@@ -44,7 +27,7 @@ private func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
let c = UIColor(red: CGFloat(px[i * 4]) / 255, green: CGFloat(px[i * 4 + 1]) / 255, blue: CGFloat(px[i * 4 + 2]) / 255, alpha: 1) let c = UIColor(red: CGFloat(px[i * 4]) / 255, green: CGFloat(px[i * 4 + 1]) / 255, blue: CGFloat(px[i * 4 + 2]) / 255, alpha: 1)
var h: CGFloat = 0, s: CGFloat = 0, v: CGFloat = 0, a: CGFloat = 0 var h: CGFloat = 0, s: CGFloat = 0, v: CGFloat = 0, a: CGFloat = 0
c.getHue(&h, saturation: &s, brightness: &v, alpha: &a) c.getHue(&h, saturation: &s, brightness: &v, alpha: &a)
// Favour colourful pixels that aren't near black or white. // Favour colorful pixels that aren't near black or white.
let score = s * (1 - abs(v - 0.55) * 1.4) let score = s * (1 - abs(v - 0.55) * 1.4)
all.append((h, s, v, score)) all.append((h, s, v, score))
} }
@@ -58,32 +41,6 @@ private func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
return (h, s / k, v / k) return (h, s / k, v / k)
} }
private extension Palette {
func tinted(_ bg: Color) -> Palette {
let dark = UIColor(bg).luminance < 0.5
var c = self
c.dark = dark
c.bg = bg
c.groupedBg = bg
c.fill = dark ? .white.opacity(0.12) : .black.opacity(0.06)
c.fillStrong = dark ? .white.opacity(0.22) : .black.opacity(0.12)
c.label = dark ? .white : .black
c.label2 = dark ? .white.opacity(0.62) : .black.opacity(0.55)
c.label3 = dark ? .white.opacity(0.25) : .black.opacity(0.2)
c.separator = dark ? .white.opacity(0.14) : .black.opacity(0.1)
c.placeholder = c.fill
return c
}
}
private extension UIColor {
var luminance: CGFloat {
var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0
getRed(&r, green: &g, blue: &b, alpha: &a)
return 0.2126 * r + 0.7152 * g + 0.0722 * b
}
}
// ---- now playing ---------------------------------------------------------------------------- // ---- now playing ----------------------------------------------------------------------------
/// Full screen, Now Playing owns the window's color scheme. Docked beside the library it only /// Full screen, Now Playing owns the window's color scheme. Docked beside the library it only
@@ -105,26 +62,29 @@ struct NowPlayingScreen: View {
@Environment(\.palette) private var base @Environment(\.palette) private var base
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@State private var panel = NpPanel.Art @State private var panel = NpPanel.Art
@State private var tint: Color?
/// How far the screen is being dragged down to close it. /// How far the screen is being dragged down to close it.
@State private var drop: CGFloat = 0 @State private var drop: CGFloat = 0
/// Docked beside the hinge the pane is narrow, so the controls pack tighter. Full screen /// Docked beside the hinge the pane is narrow, so the controls pack tighter. Full screen
/// (folded or any other iPhone) uses the roomy layout across the whole window. /// (folded or any other iPhone) uses the roomy layout across the whole window.
private var tight: Bool { docked } private var tight: Bool { docked }
/// Full screen on the Duo (folded, or a Split View half), the controls run down into the home indicator strip.
private var runsLow: Bool { !docked && (folded || ui.isDuo) }
/// Size of the art panel in the stacked layout, so the controls can match the art's width. /// Size of the art panel in the stacked layout, so the controls can match the art's width.
@State private var artBox: CGSize = .zero @State private var artBox: CGSize = .zero
/// Height of the wide layout's controls column, so the Duo art can match it.
@State private var ctlH: CGFloat = 0
/// The screen's height, for the strip at the top that a drag down closes from. /// The screen's height, for the strip at the top that a drag down closes from.
@State private var screenH: CGFloat = 0 @State private var screenH: CGFloat = 0
@Environment(\.verticalSizeClass) private var vSize @Environment(\.verticalSizeClass) private var vSize
/// Folded iPhone Duo: the outer display keeps a status column down the right edge. /// Folded iPhone Duo: the outer display keeps a status column down the right edge.
@State private var folded = false @State private var folded = false
private var artInset: CGFloat { tight ? 18 : 28 } private var artInset: CGFloat { tight ? 18 : folded ? 12 : 28 }
private var hPad: CGFloat { tight ? 20 : 28 } private var hPad: CGFloat { tight ? 20 : 28 }
private var g: AppGraph { .shared } private var g: AppGraph { .shared }
var body: some View { var body: some View {
let pm = g.playback let pm = g.playback
let c = tint.map { base.tinted($0) } ?? base let c = base
let track = pm.current?.track let track = pm.current?.track
// Wide when there's no room to stack art over controls: landscape, or iPhone Duo's // Wide when there's no room to stack art over controls: landscape, or iPhone Duo's
// outer display. Tall layouts (including the unfolded Duo) cap the controls' width. // outer display. Tall layouts (including the unfolded Duo) cap the controls' width.
@@ -135,13 +95,18 @@ struct NowPlayingScreen: View {
if wide { if wide {
// The column never drops below what the transport row needs, so the buttons // The column never drops below what the transport row needs, so the buttons
// can't spill onto the art or under the Duo rail. // can't spill onto the art or under the Duo rail.
let col = tight ? min(max(geo.size.width * 0.46, 300), 420) : min(geo.size.width * 0.48, 440) let col = tight ? min(max(geo.size.width * 0.46, 300), 420) : min(max(geo.size.width * 0.42, 300), 440)
HStack(spacing: 0) { HStack(spacing: 0) {
// On the Duo the art matches the controls' height, so it lines up with the title
// and the button row instead of floating in the middle of a tall pane.
let match = ui.isDuo && !docked && panel == .Art && ctlH > 0
panelView(track, header: false) panelView(track, header: false)
.frame(maxWidth: .infinity, maxHeight: .infinity) .frame(maxWidth: .infinity, maxHeight: match ? min(ctlH, geo.size.height) : .infinity)
.frame(maxHeight: .infinity)
.transition(.opacity.combined(with: .scale(scale: 0.96))) .transition(.opacity.combined(with: .scale(scale: 0.96)))
controls(track, wide: true, width: col) controls(track, wide: true, width: col)
.frame(width: col) .frame(width: col)
.onGeometryChange(for: CGFloat.self) { $0.size.height } action: { ctlH = $0 }
.frame(maxHeight: .infinity) .frame(maxHeight: .infinity)
} }
} else { } else {
@@ -167,11 +132,15 @@ struct NowPlayingScreen: View {
// Folded, the iPhone Duo keeps a status column down the right edge. Run the player under it // Folded, the iPhone Duo keeps a status column down the right edge. Run the player under it
// (it only overlaps the sliding preset chips) instead of leaving a quarter of the screen empty. // (it only overlaps the sliding preset chips) instead of leaving a quarter of the screen empty.
// Upright iPhones have no side insets, so this only changes the Duo. // Upright iPhones have no side insets, so this only changes the Duo.
.ignoresSafeArea(.container, edges: !docked && vSize == .regular ? .trailing : []) // Folded, the bottom inset is empty space too: run the controls down into it, and the art grows into the room.
// The room under the controls has to be inside this view: padding outside it would keep
// the view off the bottom edge, and then it can't run into the home indicator strip.
.padding(.bottom, runsLow ? 6 : 0)
.ignoresSafeArea(.container, edges: !docked && vSize == .regular ? (runsLow ? [.trailing, .bottom] : .trailing) : [])
// Measured outside the line above, so it still sees the status column. // Measured outside the line above, so it still sees the status column.
.onGeometryChange(for: Bool.self) { $0.safeAreaInsets.trailing > 20 } action: { folded = $0 && vSize == .regular } .onGeometryChange(for: Bool.self) { $0.safeAreaInsets.trailing > 20 } action: { folded = $0 && vSize == .regular }
.padding(.top, docked ? 4 : tight ? 14 : 20) .padding(.top, docked ? 4 : tight ? 14 : 20)
.padding(.bottom, tight ? 4 : 8) .padding(.bottom, runsLow ? 0 : tight ? 4 : 8)
.frame(maxWidth: .infinity, maxHeight: .infinity) .frame(maxWidth: .infinity, maxHeight: .infinity)
.background(c.bg.ignoresSafeArea()) .background(c.bg.ignoresSafeArea())
.overlay(alignment: .top) { .overlay(alignment: .top) {
@@ -189,19 +158,15 @@ struct NowPlayingScreen: View {
.environment(\.palette, c) .environment(\.palette, c)
.modifier(NpScheme(dark: c.dark, docked: docked)) .modifier(NpScheme(dark: c.dark, docked: docked))
.tint(c.label) .tint(c.label)
.animation(.easeInOut(duration: 0.3), value: tint)
.presentationBackground(.clear) .presentationBackground(.clear)
.onAppear { if !docked && g.playback.karaoke { panel = .Lyrics } } .onAppear { if !docked && g.playback.karaoke { panel = .Lyrics } }
.task(id: "\(track?.thumb ?? "")|\(g.settings.albumColorNowPlaying)|\(base.dark)") {
guard g.settings.albumColorNowPlaying, let thumb = track?.thumb else { tint = nil; return }
tint = await albumColor(thumb, dark: base.dark)
}
} }
@ViewBuilder @ViewBuilder
private func panelView(_ track: Track, header: Bool) -> some View { private func panelView(_ track: Track, header: Bool) -> some View {
switch panel { switch panel {
case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header || !tight ? artInset : 12).contentShape(Rectangle()) case .Art: ArtPanel(thumb: track.thumb, playing: g.playback.playWhenReady, inset: header ? artInset : 12,
leading: folded && !docked && !ui.split && g.settings.foldedArtLeft, edge: hPad).contentShape(Rectangle())
case .Mixer: VStack(spacing: 0) { if header { mini(track) }; MixerPanel(spread: folded) } case .Mixer: VStack(spacing: 0) { if header { mini(track) }; MixerPanel(spread: folded) }
case .Queue: VStack(spacing: 0) { if header { mini(track) }; QueuePanel(close: { show(.Queue) }) } case .Queue: VStack(spacing: 0) { if header { mini(track) }; QueuePanel(close: { show(.Queue) }) }
case .Lyrics: VStack(spacing: 0) { if header { mini(track) }; LyricsPanel(track: track) } case .Lyrics: VStack(spacing: 0) { if header { mini(track) }; LyricsPanel(track: track) }
@@ -214,10 +179,10 @@ struct NowPlayingScreen: View {
} }
private func controls(_ track: Track, wide: Bool, width: CGFloat) -> some View { private func controls(_ track: Track, wide: Bool, width: CGFloat) -> some View {
// Folded with a panel open, the controls give the panel some of their spacing. // Folded, the controls keep the tight stems-panel spacing on every panel, so the art gets the room.
let snug = folded && panel != .Art let snug = folded
let pm = g.playback let pm = g.playback
let c = tint.map { base.tinted($0) } ?? base let c = base
let pad: CGFloat = wide && tight ? 14 : hPad let pad: CGFloat = wide && tight ? 14 : hPad
// Full-size transport needs 312 pt; below that the buttons shrink to fit. // Full-size transport needs 312 pt; below that the buttons shrink to fit.
let narrow = width - 2 * pad < 312 let narrow = width - 2 * pad < 312
@@ -234,10 +199,10 @@ struct NowPlayingScreen: View {
Spacer(minLength: 8) Spacer(minLength: 8)
EllipsisButton(items: ui.menu.track(track)) EllipsisButton(items: ui.menu.track(track))
} }
.padding(.top, tight ? 8 : 14) .padding(.top, snug && !docked ? 20 : tight ? 8 : ui.isDuo && !wide ? 30 : 14)
.transition(.opacity.combined(with: .move(edge: .top))) .transition(.opacity.combined(with: .move(edge: .top)))
} }
ProgressVolumeBar(played: c.label, unplayed: c.label3, centerLabel: badge(track)) ProgressVolumeBar(played: g.settings.albumTheme ? c.accent : c.label, unplayed: c.label3, centerLabel: badge(track))
.padding(.top, tight ? (wide ? 14 : 18) : snug ? 14 : wide ? 24 : panel == .Art ? 34 : 30) .padding(.top, tight ? (wide ? 14 : 18) : snug ? 14 : wide ? 24 : panel == .Art ? 34 : 30)
HStack(spacing: 0) { HStack(spacing: 0) {
SideToggle(symbol: "shuffle", on: pm.shuffle, action: pm.toggleShuffle, width: narrow ? 36 : 40) SideToggle(symbol: "shuffle", on: pm.shuffle, action: pm.toggleShuffle, width: narrow ? 36 : 40)
@@ -493,16 +458,21 @@ private struct ArtPanel: View {
let thumb: String? let thumb: String?
let playing: Bool let playing: Bool
var inset: CGFloat = 28 var inset: CGFloat = 28
/// Settings > Appearance, folded Duo only: art against the left edge.
var leading = false
/// The controls' side padding, which the art's left edge matches when `leading`.
var edge: CGFloat = 28
var body: some View { var body: some View {
GeometryReader { geo in GeometryReader { geo in
let side = max(min(geo.size.width, geo.size.height), 1) let side = max(min(geo.size.width, geo.size.height), 1)
Artwork(thumb: thumb, size: side, corner: 12) Artwork(thumb: thumb, size: side, corner: 12)
.shadow(color: .black.opacity(playing ? 0.35 : 0.15), radius: playing ? 24 : 10, y: 10) .shadow(color: .black.opacity(playing ? 0.35 : 0.15), radius: playing ? 24 : 10, y: 10)
.scaleEffect(playing ? 1 : 0.82) .scaleEffect(playing ? 1 : 0.82, anchor: leading ? .leading : .center)
.animation(.spring(response: 0.45, dampingFraction: 0.62), value: playing) .animation(.spring(response: 0.45, dampingFraction: 0.62), value: playing)
.frame(width: geo.size.width, height: geo.size.height) .frame(width: geo.size.width, height: geo.size.height, alignment: leading ? .leading : .center)
} }
.padding(.horizontal, inset).padding(.vertical, 8) // Against the left edge, the art starts where the controls below it do.
.padding(.leading, leading ? edge : inset).padding(.trailing, inset).padding(.vertical, 8)
} }
} }
@@ -739,7 +709,8 @@ private struct MixerPanel: View {
// Spread spare height across the stem rows instead of leaving it all at the bottom. // Spread spare height across the stem rows instead of leaving it all at the bottom.
let count = CGFloat(max(names.count, 1)) let count = CGFloat(max(names.count, 1))
// Rows shrink to fit every stem before anything has to scroll (the folded outer display is short). // Rows shrink to fit every stem before anything has to scroll (the folded outer display is short).
let rowH = roomy ? min(80, max(Self.roomyMin, (geo.size.height - Self.roomyChrome) / count)) // Roomy (the unfolded deck), the rows share every point under the chips down to the bottom.
let rowH = roomy ? max(Self.roomyMin, (geo.size.height - chipsH - 8) / count)
: min(62, max(spread ? Self.foldedMin : Self.compactMin, (geo.size.height - chipsH - 8) / count)) : min(62, max(spread ? Self.foldedMin : Self.compactMin, (geo.size.height - chipsH - 8) / count))
// Gap above the rows that centres them on the whole panel, not just the space under the chips. // Gap above the rows that centres them on the whole panel, not just the space under the chips.
let lead = max(0, (geo.size.height - rowH * count) / 2 - chipsH) let lead = max(0, (geo.size.height - rowH * count) / 2 - chipsH)
@@ -757,7 +728,7 @@ private struct MixerPanel: View {
HStack(spacing: 8) { saveChips(pm); presetChips(pm, names) }.padding(.horizontal, 24) HStack(spacing: 8) { saveChips(pm); presetChips(pm, names) }.padding(.horizontal, 24)
} }
.scrollIndicators(.hidden) .scrollIndicators(.hidden)
.padding(.horizontal, -24) .padding(.leading, -24).padding(.trailing, roomy ? -6 : -24)
.padding(.vertical, 8) .padding(.vertical, 8)
.onGeometryChange(for: CGFloat.self) { $0.size.height } action: { chipsH = $0 } .onGeometryChange(for: CGFloat.self) { $0.size.height } action: { chipsH = $0 }
} }
@@ -771,13 +742,11 @@ private struct MixerPanel: View {
StemFader(name: name, setting: pm.mix[name] ?? StemSetting(), level: i < levels.count ? levels[i] : 0, enabled: stems, height: rowH, roomy: roomy) StemFader(name: name, setting: pm.mix[name] ?? StemSetting(), level: i < levels.count ? levels[i] : 0, enabled: stems, height: rowH, roomy: roomy)
} }
} }
// Wide panes keep the faders a sensible length, centred across the panel.
.frame(maxWidth: roomy ? 560 : .infinity)
.frame(maxWidth: .infinity)
} }
Spacer(minLength: 8) Spacer(minLength: 8)
} }
.padding(.horizontal, 24) // Roomy, the faders run right up to the hinge.
.padding(.leading, 24).padding(.trailing, roomy ? 6 : 24)
.frame(minHeight: geo.size.height) .frame(minHeight: geo.size.height)
} }
.scrollIndicators(.hidden) .scrollIndicators(.hidden)
@@ -842,7 +811,7 @@ extension MixerPanel {
static let roomyRow: CGFloat = 66 static let roomyRow: CGFloat = 66
/// Shortest stacked row: name line, fader and the gap under it. /// Shortest stacked row: name line, fader and the gap under it.
static let roomyMin: CGFloat = 60 static let roomyMin: CGFloat = 68
/// Shortest side-by-side row, the fader's own height. /// Shortest side-by-side row, the fader's own height.
static let compactMin: CGFloat = 30 static let compactMin: CGFloat = 30
static let foldedMin: CGFloat = 40 static let foldedMin: CGFloat = 40
@@ -853,7 +822,7 @@ extension MixerPanel {
static func roomyHeight(_ stems: Int) -> CGFloat { roomyChrome + CGFloat(stems) * roomyRow } static func roomyHeight(_ stems: Int) -> CGFloat { roomyChrome + CGFloat(stems) * roomyRow }
} }
/// [Chip] in the sheet's own colours: selected is the label colour, so it reads on any tint. /// [Chip] in the sheet's own colors: selected is the label color, so it reads on any tint.
private struct PresetChip: View { private struct PresetChip: View {
let text: String let text: String
var icon: String? = nil var icon: String? = nil
@@ -918,7 +887,7 @@ struct FaderRow<Fader: View, Trailing: View>: View {
var body: some View { var body: some View {
if stacked { if stacked {
// Bottom-aligned with a gap under, so each name sits clear of the meter above it. // Bottom-aligned with a gap under, so each name sits clear of the meter above it.
VStack(alignment: .leading, spacing: 2) { VStack(alignment: .leading, spacing: 6) {
HStack(spacing: 6) { HStack(spacing: 6) {
if let dot { Circle().fill(dot).frame(width: 8, height: 8) } if let dot { Circle().fill(dot).frame(width: 8, height: 8) }
Text(label).font(.subheadline.weight(.semibold)).foregroundStyle(dim ? p.label2 : p.label).lineLimit(1) Text(label).font(.subheadline.weight(.semibold)).foregroundStyle(dim ? p.label2 : p.label).lineLimit(1)
@@ -928,8 +897,8 @@ struct FaderRow<Fader: View, Trailing: View>: View {
.frame(height: 18) .frame(height: 18)
HStack(spacing: 8) { fader; trailing } HStack(spacing: 8) { fader; trailing }
} }
.padding(.bottom, 4) // Centred in its slot, so tall rows keep even gaps above and below.
.frame(height: height, alignment: .bottom) .frame(height: height)
} else { } else {
row row
} }
@@ -969,7 +938,7 @@ struct ToggleBox: View {
} }
} }
/// An iOS-style slider with a coloured fill and, optionally, a detent that catches the thumb /// An iOS-style slider with a colored fill and, optionally, a detent that catches the thumb
/// near one value (unity gain) with a tick. /// near one value (unity gain) with a tick.
struct FaderSlider: View { struct FaderSlider: View {
let value: Float let value: Float
@@ -977,7 +946,7 @@ struct FaderSlider: View {
var detent: Float? var detent: Float?
var enabled = true var enabled = true
var thumb: CGFloat = 24 var thumb: CGFloat = 24
/// 0...1 live level, shown in the full fill colour over the dimmed filled part of the track. /// 0...1 live level, shown in the full fill color over the dimmed filled part of the track.
var meter: CGFloat? var meter: CGFloat?
let onChange: (Float) -> Void let onChange: (Float) -> Void
@@ -997,8 +966,8 @@ struct FaderSlider: View {
let x = CGFloat(min(max(value, 0), 1)) * track let x = CGFloat(min(max(value, 0), 1)) * track
ZStack(alignment: .leading) { ZStack(alignment: .leading) {
Capsule().fill(p.fillStrong).frame(height: bar).padding(.horizontal, thumb / 2) Capsule().fill(p.fillStrong).frame(height: bar).padding(.horizontal, thumb / 2)
// With a meter the set level is a dim band of the stem's colour and the live level // With a meter the set level is a dim band of the stem's color and the live level
// runs over it in the full colour, so the two never blend. // runs over it in the full color, so the two never blend.
Capsule().fill(meter == nil ? fill : fill.opacity(0.32)).frame(width: x + thumb / 2, height: bar).padding(.leading, thumb / 2 - 0.01) Capsule().fill(meter == nil ? fill : fill.opacity(0.32)).frame(width: x + thumb / 2, height: bar).padding(.leading, thumb / 2 - 0.01)
if let meter, meter > 0.01 { if let meter, meter > 0.01 {
Capsule().fill(fill).frame(width: meter * (x + thumb / 2), height: bar) Capsule().fill(fill).frame(width: meter * (x + thumb / 2), height: bar)
@@ -1041,11 +1010,10 @@ struct NowPlayingDeck: View {
@Environment(Ui.self) private var ui @Environment(Ui.self) private var ui
@Environment(\.palette) private var base @Environment(\.palette) private var base
@AppStorage("duoSwap") private var swap = false @AppStorage("duoSwap") private var swap = false
@State private var tint: Color?
private var g: AppGraph { .shared } private var g: AppGraph { .shared }
var body: some View { var body: some View {
let c = tint.map { base.tinted($0) } ?? base let c = base
let track = g.playback.current?.track let track = g.playback.current?.track
GeometryReader { _ in GeometryReader { _ in
if let track { if let track {
@@ -1073,12 +1041,7 @@ struct NowPlayingDeck: View {
.environment(\.palette, c) .environment(\.palette, c)
.modifier(NpScheme(dark: c.dark, docked: true)) .modifier(NpScheme(dark: c.dark, docked: true))
.tint(c.label) .tint(c.label)
.animation(.easeInOut(duration: 0.3), value: tint)
.animation(.snappy(duration: 0.25), value: ui.deckPage) .animation(.snappy(duration: 0.25), value: ui.deckPage)
.task(id: "\(track?.thumb ?? "")|\(g.settings.albumColorNowPlaying)|\(base.dark)") {
guard g.settings.albumColorNowPlaying, let thumb = track?.thumb else { tint = nil; return }
tint = await albumColor(thumb, dark: base.dark)
}
} }
/// The page names, and the button that moves Now Playing to the other side of the hinge. /// The page names, and the button that moves Now Playing to the other side of the hinge.
@@ -1230,7 +1193,7 @@ struct MiniPlayer: View {
.padding(.leading, 8).padding(.trailing, 6) .padding(.leading, 8).padding(.trailing, 6)
.frame(height: 60) .frame(height: 60)
.background { .background {
// A solid card in the app's own colours instead of system glass. // A solid card in the app's own colors instead of system glass.
let shape = RoundedRectangle(cornerRadius: 14, style: .continuous) let shape = RoundedRectangle(cornerRadius: 14, style: .continuous)
ZStack { ZStack {
shape.fill(p.cell) shape.fill(p.cell)
@@ -1319,22 +1282,24 @@ private struct LyricsPanel: View {
var body: some View { var body: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
// Soft leaves the singer in quietly as a guide. // Soft leaves the singer in quietly as a guide.
HStack(spacing: 12) { if g.playback.source == .Stems && g.playback.stemNames.contains("vocals") {
Text("Vocals").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
Picker("Vocals", selection: Binding(get: { g.playback.karaokeVocals }, set: { g.playback.setKaraokeVocals($0) })) {
ForEach(KaraokeVocals.allCases, id: \.self) { Text(String(describing: $0)).tag($0) }
}
.pickerStyle(.segmented)
}
.padding(.horizontal, 28).padding(.top, 8)
if g.playback.karaokeVocals == .Soft {
let db = g.settings.karaokeSoftDb
HStack(spacing: 12) { HStack(spacing: 12) {
Text("Softness").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2) Text("Vocals").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
Slider(value: Binding(get: { Double(db) }, set: { g.playback.setKaraokeSoftDb(Int($0.rounded())) }), in: -30...(-3), step: 1) Picker("Vocals", selection: Binding(get: { g.playback.karaokeVocals }, set: { g.playback.setKaraokeVocals($0) })) {
Text("\(db) dB").font(.caption).monospacedDigit().foregroundStyle(p.label2).frame(width: 46, alignment: .trailing) ForEach(KaraokeVocals.allCases, id: \.self) { Text(String(describing: $0)).tag($0) }
}
.pickerStyle(.segmented)
} }
.padding(.horizontal, 28).padding(.top, 8) .padding(.horizontal, 28).padding(.top, 8)
if g.playback.karaokeVocals == .Soft {
let db = g.settings.karaokeSoftDb
HStack(spacing: 12) {
Text("Softness").font(.subheadline.weight(.semibold)).foregroundStyle(p.label2)
Slider(value: Binding(get: { Double(db) }, set: { g.playback.setKaraokeSoftDb(Int($0.rounded())) }), in: -30...(-3), step: 1)
Text("\(db) dB").font(.caption).monospacedDigit().foregroundStyle(p.label2).frame(width: 46, alignment: .trailing)
}
.padding(.horizontal, 28).padding(.top, 8)
}
} }
content content
} }
+14 -2
View File
@@ -159,11 +159,12 @@ struct StemPlaylistScreen: View {
} }
.toolbar { .toolbar {
ToolbarItemGroup(placement: .topBarTrailing) { ToolbarItemGroup(placement: .topBarTrailing) {
if !editing { MoreMenu(items: moreItems(pl)) }
if editing { Button("Done") { g.stemPlaylists.setItems(pl.id, items); editing = false }.bold() } if editing { Button("Done") { g.stemPlaylists.setItems(pl.id, items); editing = false }.bold() }
else if !pl.items.isEmpty { Button("Edit") { items = pl.items; editing = true } } else if !pl.items.isEmpty { Button("Edit") { items = pl.items; editing = true } }
if !editing { MoreMenu(items: moreItems(pl)) }
} }
} }
.modifier(SplitHidesTitle())
} }
private func header(_ pl: StemPlaylist) -> some View { private func header(_ pl: StemPlaylist) -> some View {
@@ -267,14 +268,15 @@ struct PlaylistScreen: View {
} }
.toolbar { .toolbar {
ToolbarItemGroup(placement: .topBarTrailing) { ToolbarItemGroup(placement: .topBarTrailing) {
if !editing { MoreMenu(items: moreItems(list)) }
if !playlist.smart && !list.isEmpty { if !playlist.smart && !list.isEmpty {
if saving { ProgressView() } if saving { ProgressView() }
else if editing { Button("Done") { commit(list) }.bold() } else if editing { Button("Done") { commit(list) }.bold() }
else { Button("Edit") { items = list; removed = []; editing = true } } else { Button("Edit") { items = list; removed = []; editing = true } }
} }
if !editing { MoreMenu(items: moreItems(list)) }
} }
} }
.modifier(SplitHidesTitle())
.task(id: reload) { .task(id: reload) {
await LoadState.load($tracks) { try await g.plex.playlistTracks(playlist.ratingKey) } await LoadState.load($tracks) { try await g.plex.playlistTracks(playlist.ratingKey) }
} }
@@ -413,3 +415,13 @@ struct SearchScreen: View {
} }
} }
} }
/// Split at the Duo's hinge the pane's own header already names the playlist, so the bar drops the title.
private struct SplitHidesTitle: ViewModifier {
@Environment(Ui.self) private var ui
func body(content: Content) -> some View {
content.toolbar {
if ui.split { ToolbarItem(placement: .principal) { Color.clear.frame(width: 1, height: 1) } }
}
}
}
+53 -36
View File
@@ -140,7 +140,7 @@ private func clean(_ url: String) -> String {
return u return u
} }
/// Four little faders in the stem colours: the Settings mark. /// Four little faders in the stem colors: the Settings mark.
private struct StemMark: View { private struct StemMark: View {
var scale: CGFloat = 1 var scale: CGFloat = 1
var body: some View { var body: some View {
@@ -279,6 +279,7 @@ struct SettingsScreen: View {
case .online(let n, _): "\(n.formatted()) songs with stems" case .online(let n, _): "\(n.formatted()) songs with stems"
case .offline(_, let cached): cached > 0 ? "Can't reach it, \(cached.formatted()) songs saved" : "Can't reach it" case .offline(_, let cached): cached > 0 ? "Can't reach it, \(cached.formatted()) songs saved" : "Can't reach it"
case .unknown: "Checking…" case .unknown: "Checking…"
case .off: "Off, Plex only"
} }
} }
} }
@@ -345,7 +346,7 @@ private let maintainers = [
coffee: "https://venmo.com/code?user_id=2910252785729536546&created=1792897467", tipTitle: "Venmo", tipIcon: "dollarsign.circle.fill"), coffee: "https://venmo.com/code?user_id=2910252785729536546&created=1792897467", tipTitle: "Venmo", tipIcon: "dollarsign.circle.fill"),
] ]
/// A maintainer's picture in a ring of their stem colour, their name and what they look after. /// A maintainer's picture in a ring of their stem color, their name and what they look after.
private struct MaintainerCard: View { private struct MaintainerCard: View {
let m: Maintainer let m: Maintainer
@Environment(\.palette) private var p @Environment(\.palette) private var p
@@ -826,40 +827,51 @@ struct StemServerScreen: View {
let status = g.stems.status let status = g.stems.status
List { List {
Section { Section {
FieldCell(label: "Address", text: $url, placeholder: "http://192.168.86.2:8765") Toggle(isOn: Binding(get: { !g.settings.stemServerOff }, set: { on in
FieldCell(label: "Token", text: $token, placeholder: "Optional", secret: true) g.settings.stemServerOff = !on
ActionCell(title: busy ? "Connecting…" : "Save & Connect") { connect() } Task { await g.stems.refresh(force: true) }
} header: { Header(text: "stemserve") } footer: { })) { Text("Use Stem Server").foregroundStyle(p.label) }
Footer(text: "stemserve shares the Stems folder that stemd fills (port 8765). The app checks it for new stems every minute.\n\n" + matchNote) .tint(Color(hex: 0x34C759))
}
Section {
ValueCell(title: "Connection", value: {
switch status {
case .online: "Online"
case .offline: "Offline"
case .unknown: "Checking"
}
}()).themedRow()
ValueCell(title: "Songs with Stems", value: {
switch status {
case .online(let n, _): "\(n)"
case .offline(_, let n): "\(n) (cached)"
case .unknown: "—"
}
}()).themedRow()
ValueCell(title: "stemd", value: g.stems.liveLine ?? (g.stems.failed.isEmpty ? "Idle" : "\(g.stems.failed.count) failed")).themedRow()
ValueCell(title: "Opus Transcoding", value: {
if case .online(_, let t) = status { return t ? "Available" : "No ffmpeg" }
return "—"
}()).themedRow()
if case .offline(let reason, _) = status {
VStack(alignment: .leading, spacing: 2) {
Text("Error").foregroundStyle(p.label)
Text(reason).font(.footnote).foregroundStyle(p.label2)
}
.themedRow() .themedRow()
}
if !g.settings.stemServerOff {
Section {
FieldCell(label: "Address", text: $url, placeholder: "http://192.168.86.2:8765")
FieldCell(label: "Token", text: $token, placeholder: "Optional", secret: true)
ActionCell(title: busy ? "Connecting…" : "Save & Connect") { connect() }
} header: { Header(text: "stemserve") } footer: {
Footer(text: "stemserve shares the Stems folder that stemd fills (port 8765). The app checks it for new stems every minute.\n\n" + matchNote)
} }
} header: { Header(text: "Status") } Section {
ValueCell(title: "Connection", value: {
switch status {
case .online: "Online"
case .offline: "Offline"
case .unknown: "Checking"
case .off: "Off"
}
}()).themedRow()
ValueCell(title: "Songs with Stems", value: {
switch status {
case .online(let n, _): "\(n)"
case .offline(_, let n): "\(n) (cached)"
case .unknown, .off: "—"
}
}()).themedRow()
ValueCell(title: "stemd", value: g.stems.liveLine ?? (g.stems.failed.isEmpty ? "Idle" : "\(g.stems.failed.count) failed")).themedRow()
ValueCell(title: "Opus Transcoding", value: {
if case .online(_, let t) = status { return t ? "Available" : "No ffmpeg" }
return "—"
}()).themedRow()
if case .offline(let reason, _) = status {
VStack(alignment: .leading, spacing: 2) {
Text("Error").foregroundStyle(p.label)
Text(reason).font(.footnote).foregroundStyle(p.label2)
}
.themedRow()
}
} header: { Header(text: "Status") }
}
} }
.listStyle(.insetGrouped) .listStyle(.insetGrouped)
.themedList() .themedList()
@@ -1026,10 +1038,15 @@ struct AppearanceScreen: View {
.themedRow() .themedRow()
} header: { Header(text: "Accent") } } header: { Header(text: "Accent") }
Section { Section {
Toggle(isOn: $s.albumColorNowPlaying) { Text("Album Colour Background").foregroundStyle(c.label) } Toggle(isOn: $s.albumTheme) { Text("Match Album Art").foregroundStyle(c.label) }
.tint(Color(hex: 0x34C759)) .tint(Color(hex: 0x34C759))
.themedRow() .themedRow()
} header: { Header(text: "Now Playing") } footer: { Footer(text: "Paints the Now Playing screen in one solid colour taken from the album art.") } }
Section {
Toggle(isOn: $s.foldedArtLeft) { Text("Left-Align Art When Folded").foregroundStyle(c.label) }
.tint(Color(hex: 0x34C759))
.themedRow()
} header: { Header(text: "Now Playing") } footer: { Footer(text: "Left-Align moves the art to the left edge on the folded iPhone Duo.") }
Section { Section {
Toggle(isOn: $s.acapella) { Text("Spell It “Acapella”").foregroundStyle(c.label) } Toggle(isOn: $s.acapella) { Text("Spell It “Acapella”").foregroundStyle(c.label) }
.tint(Color(hex: 0x34C759)) .tint(Color(hex: 0x34C759))
+44 -2
View File
@@ -1,4 +1,5 @@
import SwiftUI import SwiftUI
import UIKit
extension Color { extension Color {
init(hex: UInt32, alpha: Double = 1) { init(hex: UInt32, alpha: Double = 1) {
@@ -7,7 +8,7 @@ extension Color {
} }
} }
/// The three themes' colours. Black is true black for OLED; no gradients anywhere. /// The three themes' colors. Black is true black for OLED; no gradients anywhere.
struct Palette { struct Palette {
var dark: Bool var dark: Bool
var bg: Color var bg: Color
@@ -59,7 +60,7 @@ extension View {
/// A list on the theme's background instead of the system one. /// A list on the theme's background instead of the system one.
func themedList(grouped: Bool = true) -> some View { modifier(ThemedList(grouped: grouped)) } func themedList(grouped: Bool = true) -> some View { modifier(ThemedList(grouped: grouped)) }
/// Rows on the theme's cell colour. /// Rows on the theme's cell color.
func themedRow(grouped: Bool = true) -> some View { modifier(ThemedRow(grouped: grouped)) } func themedRow(grouped: Bool = true) -> some View { modifier(ThemedRow(grouped: grouped)) }
} }
@@ -84,3 +85,44 @@ private struct ThemedRow: ViewModifier {
content.listRowBackground(grouped ? p.cell : p.bg).listRowSeparatorTint(p.separator) content.listRowBackground(grouped ? p.cell : p.bg).listRowSeparatorTint(p.separator)
} }
} }
// ---- album art theme ----------------------------------------------------------------------------
/// One hue taken from the album art (see vibrant in NowPlayingScreen).
struct ArtHue: Equatable { var h, s, v: CGFloat }
@MainActor
func artHue(_ thumb: String?) async -> ArtHue? {
guard let url = AppGraph.shared.plex.artUrl(thumb, px: 120) else { return nil }
let img: UIImage? = if let c = ArtLoader.shared.cached(url) { c } else { await ArtLoader.shared.image(url) }
guard let cg = img?.cgImage else { return nil }
return await Task.detached { () -> ArtHue? in
guard let (h, s, v) = vibrant(cg), s >= 0.12 else { return nil }
return ArtHue(h: h, s: s, v: v)
}.value
}
extension Palette {
/// The theme recolored around the art's hue: lightly tinted surfaces and an accent in the art's color.
/// Black keeps its true-black background for OLED.
func art(_ a: ArtHue, mode: ThemeMode) -> Palette {
var c = self
let s = min(a.s, 0.9), t = min(s * 0.5, 0.3)
func hsb(_ sat: CGFloat, _ b: CGFloat) -> Color { Color(hue: a.h, saturation: sat, brightness: b) }
switch mode {
case .White:
c.bg = hsb(t * 0.25, 1); c.groupedBg = hsb(t * 0.45, 0.965); c.cell = hsb(t * 0.2, 1)
c.fill = hsb(t * 0.5, 0.94); c.fillStrong = hsb(t * 0.6, 0.89); c.separator = hsb(t * 0.6, 0.86)
c.accent = hsb(max(s, 0.6), min(max(a.v, 0.5), 0.62))
case .Dark:
c.bg = hsb(t, 0.11); c.groupedBg = c.bg; c.cell = hsb(t, 0.17)
c.fill = c.cell; c.fillStrong = hsb(t, 0.27); c.separator = hsb(t, 0.22)
c.accent = hsb(max(s, 0.5), max(a.v, 0.85))
case .Black:
c.cell = hsb(t, 0.11); c.fill = c.cell; c.fillStrong = hsb(t, 0.22); c.separator = hsb(t, 0.17)
c.accent = hsb(max(s, 0.5), max(a.v, 0.85))
}
c.placeholder = c.fill
return c
}
}
+1 -1
View File
@@ -128,7 +128,7 @@ struct Art: View {
} }
} }
/// The primary-coloured capsule that moves to the next mix. /// The primary-colored capsule that moves to the next mix.
struct MixPill: View { struct MixPill: View {
let text: String let text: String
var icon = "chevron.right" var icon = "chevron.right"
+3 -3
View File
@@ -7,9 +7,9 @@ settings:
base: base:
SWIFT_VERSION: "5.0" SWIFT_VERSION: "5.0"
# iOS needs a plain number for the bundle version; the label is what the app and releases show. # iOS needs a plain number for the bundle version; the label is what the app and releases show.
MARKETING_VERSION: "0.9.0" MARKETING_VERSION: "0.10.1"
VERSION_LABEL: "0.9.0" VERSION_LABEL: "0.10.1"
CURRENT_PROJECT_VERSION: "30" CURRENT_PROJECT_VERSION: "52"
# Dev builds override these (build-ipa.sh dev) so they install next to the release app. # Dev builds override these (build-ipa.sh dev) so they install next to the release app.
APP_ID: org.cdnutter.stemify APP_ID: org.cdnutter.stemify
APP_NAME: Stemify APP_NAME: Stemify
+101
View File
@@ -0,0 +1,101 @@
"""Run from a venv with resvg-py and pillow: python make-icon.py OUTDIR
Stemify app icon: six stem-colored capsules (the app's stem palette) glowing on a deep night background.
Usage: make.py OUTDIR -> icon.png, icon-dev.png, icon-dev-dark.png, icon-dev-tinted.png"""
import io, sys
import resvg_py
from PIL import Image
S = 1024
# vocals, drums, bass, guitar, piano, other (PlaybackManager stem colors)
STEMS = [0xFF7AB6, 0xFFB547, 0x7C8CFF, 0xFF8A5C, 0xB48CFF, 0x4CD07D]
HEIGHTS = [300, 510, 390, 620, 455, 330]
W, GAP = 78, 30
def hx(c): return f"#{c:06X}"
def mix(c, t, k):
a = [(c >> s) & 255 for s in (16, 8, 0)]; b = [(t >> s) & 255 for s in (16, 8, 0)]
return "#" + "".join(f"{round(x + (y - x) * k):02X}" for x, y in zip(a, b))
def svg(mode="color", sash=False):
tint = mode == "tinted"
total = len(STEMS) * W + (len(STEMS) - 1) * GAP
x0 = (S - total) / 2
cy = S / 2 + 6
defs, glow, bars, shine = [], [], [], []
for i, (c, h) in enumerate(zip(STEMS, HEIGHTS)):
if tint: c = 0xFFFFFF
x, y = x0 + i * (W + GAP), cy - h / 2
defs.append(f'<linearGradient id="g{i}" x1="0" y1="0" x2="0" y2="1">'
f'<stop offset="0" stop-color="{mix(c, 0xFFFFFF, 0.38)}"/>'
f'<stop offset="0.55" stop-color="{hx(c)}"/>'
f'<stop offset="1" stop-color="{mix(c, 0x000000, 0.18 if not tint else 0.45)}"/></linearGradient>')
r = W / 2
glow.append(f'<rect x="{x}" y="{y}" width="{W}" height="{h}" rx="{r}" fill="{hx(c)}"/>')
bars.append(f'<rect x="{x}" y="{y}" width="{W}" height="{h}" rx="{r}" fill="url(#g{i})"/>')
# glassy highlight down the left edge
shine.append(f'<rect x="{x + W * 0.2}" y="{y + W * 0.32}" width="{W * 0.17}" height="{max(h * 0.42, 40)}" '
f'rx="{W * 0.085}" fill="#FFFFFF" opacity="0.22"/>')
if tint:
bg = '<rect width="1024" height="1024" fill="#000"/>'
aura = ""
else:
bg = ('<radialGradient id="bg" cx="0.5" cy="0.42" r="0.78">'
'<stop offset="0" stop-color="#211A3A"/><stop offset="0.55" stop-color="#110E1F"/>'
'<stop offset="1" stop-color="#05040A"/></radialGradient>'
'<rect width="1024" height="1024" fill="url(#bg)"/>')
# soft colored light pooling behind the bars
aura = ('<g filter="url(#aura)" opacity="0.55">'
f'<circle cx="330" cy="420" r="190" fill="{hx(STEMS[0])}"/>'
f'<circle cx="690" cy="400" r="200" fill="{hx(STEMS[4])}"/>'
f'<circle cx="520" cy="660" r="210" fill="{hx(STEMS[2])}"/>'
f'<circle cx="760" cy="640" r="150" fill="{hx(STEMS[5])}"/>'
f'<circle cx="290" cy="650" r="150" fill="{hx(STEMS[1])}"/></g>'
'<rect width="1024" height="1024" fill="#05040A" opacity="0.45"/>')
vignette = ('<radialGradient id="vig" cx="0.5" cy="0.5" r="0.72"><stop offset="0.6" stop-color="#000" stop-opacity="0"/>'
'<stop offset="1" stop-color="#000" stop-opacity="0.55"/></radialGradient>'
'<rect width="1024" height="1024" fill="url(#vig)"/>') if not tint else ""
sash_svg = ""
if sash:
sash_svg = ('<linearGradient id="sash" x1="0" y1="1" x2="1" y2="0">'
'<stop offset="0" stop-color="#FF9BD0"/><stop offset="1" stop-color="#C9A8FF"/></linearGradient>'
'<g transform="translate(222,222) rotate(-45)">'
'<rect x="-420" y="-58" width="840" height="116" fill="url(#sash)"/>'
'<line x1="-420" y1="-44" x2="420" y2="-44" stroke="#FFF" stroke-opacity="0.75" stroke-width="5" stroke-dasharray="18 14"/>'
'<line x1="-420" y1="44" x2="420" y2="44" stroke="#FFF" stroke-opacity="0.75" stroke-width="5" stroke-dasharray="18 14"/>'
'<text x="-30" y="30" text-anchor="middle" font-family="DejaVu Sans" font-weight="bold" font-size="88" '
'fill="#3A1F4D" opacity="0.45" transform="translate(4,5)">dev</text>'
'<text x="-30" y="30" text-anchor="middle" font-family="DejaVu Sans" font-weight="bold" font-size="88" fill="#FFF">dev</text>'
'<path transform="translate(118,-4) scale(2.6)" fill="#FFF" '
'd="M0 9 C-9 3 -12 -3 -8 -8 C-5 -11 -1 -10 0 -6 C1 -10 5 -11 8 -8 C12 -3 9 3 0 9 Z"/></g>')
return f'''<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
<defs>{"".join(defs)}
<filter id="aura" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="110"/></filter>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="26"/></filter>
<filter id="drop" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="10"/></filter>
</defs>
{bg}{aura}
<g filter="url(#glow)" opacity="{0.25 if tint else 0.7}">{"".join(glow)}</g>
<g filter="url(#drop)" opacity="0.5" transform="translate(0,14)">{"".join(g.replace('fill="#', 'fill="#000" data-c="') for g in glow)}</g>
<g>{"".join(bars)}</g>
<g>{"".join(shine)}</g>
{vignette}{sash_svg}
</svg>'''
def png(s, path, gray=False):
im = Image.open(io.BytesIO(bytes(resvg_py.svg_to_bytes(svg_string=s)))).convert("RGB")
(im.convert("L") if gray else im).save(path, optimize=True)
out = sys.argv[1]
png(svg(), f"{out}/icon.png")
png(svg(sash=True), f"{out}/icon-dev.png")
png(svg(sash=True), f"{out}/icon-dev-dark.png")
png(svg("tinted", sash=True), f"{out}/icon-dev-tinted.png", gray=True)
open(f"{out}/icon.svg", "w").write(svg())
+21 -191
View File
@@ -16,203 +16,33 @@
"category": "entertainment", "category": "entertainment",
"versions": [ "versions": [
{ {
"version": "1.0", "version": "0.10.1",
"marketingVersion": "1.0 RC 4", "marketingVersion": "0.10.1",
"buildVersion": "24", "buildVersion": "52",
"date": "2026-11-18T13:39:57-08:00", "date": "2026-11-20T12:25:58-08:00",
"localizedDescription": "Duo layout fixes for every fold and orientation", "localizedDescription": "Folded art-left: art's left edge matches the controls' padding",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0-rc4/stemify-1.0-rc4.ipa", "downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v0.10.1/stemify-0.10.1.ipa",
"size": 2650316, "size": 3142623,
"minOSVersion": "17.0" "minOSVersion": "17.0"
}, },
{ {
"version": "1.0", "version": "0.10.0",
"marketingVersion": "1.0 RC 3", "marketingVersion": "0.10.0",
"buildVersion": "23", "buildVersion": "40",
"date": "2026-11-09T08:01:30-08:00", "date": "2026-11-19T22:26:40-08:00",
"localizedDescription": "iPhone Duo: unfolded, the library sits on one side of the hinge and Now Playing stays docked on the other (no mini player while split). Folded and other iPhones are unchanged. Unsigned IPA for Sideloadly, AltStore, SideStore or Feather.", "localizedDescription": "## iOS\n\n- New app icon: glowing stem-colored capsules on a night gradient.\n- Plays straight from Plex when the stem server is off or can't be reached. Stems come back once it's reachable again.\n- Picks the Plex server address again after a network change, when the app returns to the foreground, and when a stream fails.\n- Folded Now Playing uses the space at the bottom and shows bigger art.\n- iPhone Duo:\n - Folded is portrait only, and unfolded is landscape only.\n - Left-aligned art applies only when folded.\n - Unfolded stem bars are full width with roomier rows.\n - Deck stems fill the pane down to the hinge and the bottom edge.\n - Tab bar slots stay put across fold and unfold.\n\n## Web player\n\n- New layout: icon sidebar, blurred-art album headers, track table with an album column, play on card hover.\n- Graphite is the new default theme.\n- Album art can expand into a tile in the sidebar.\n- The mixer has vertical channel strips with live level meters. Drag anywhere on a strip, or use the wheel or arrow keys.\n- Save mix and Add to playlist buttons sit under the mixer.\n- The queue button moved to the right side of the player bar.\n- Tracks without stems are tagged NO STEMS.\n- Explanatory text is gone, and the playlist list is gone from the sidebar.\n- Assets are cache-busted, so a plain reload picks up new versions.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0-rc3/stemify-1.0-rc3.ipa", "downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v0.10.0/stemify-0.10.0.ipa",
"size": 2596161, "size": 3124915,
"minOSVersion": "17.0" "minOSVersion": "17.0"
}, },
{ {
"version": "1.0", "version": "0.9.0",
"marketingVersion": "1.0 RC 2", "marketingVersion": "0.9.0",
"buildVersion": "22", "buildVersion": "31",
"date": "2026-11-06T08:55:28-08:00", "date": "2026-11-18T17:21:50-08:00",
"localizedDescription": "Plain Plex songs play when Remote Access has an upload speed limit (no more 500s). Shuffle buttons work and top up as you go. Random Album Radio works like Plexamp: a shuffled album list played album by album, in track order. Recently Added has See All with the full list. Stem playlist covers can come from Photos. Crossfade (Off or 1-12 s, Settings > Listening) with Sweet Fades for same-album songs. Update Download on downloaded playlists, albums and artists, plus Update All Downloads. Unsigned IPA for Sideloadly, AltStore, SideStore or Feather.", "localizedDescription": "Stemify iOS 0.9.0: Duo split layout, Library Layout in Settings, folded Duo fixes.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0-rc2/stemify-1.0-rc2.ipa", "downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v0.9.0/stemify-0.9.0.ipa",
"size": 2579022, "size": 2710062,
"minOSVersion": "17.0"
},
{
"version": "1.0.16",
"marketingVersion": "1.0.16",
"buildVersion": "17",
"date": "2026-10-20T14:39:00-07:00",
"localizedDescription": "More room between the seek bar and the time / codec row on Now Playing.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.16/stemify-1.0.16.ipa",
"size": 1626423,
"minOSVersion": "17.0"
},
{
"version": "1.0.15",
"marketingVersion": "1.0.15",
"buildVersion": "16",
"date": "2026-10-20T14:22:36-07:00",
"localizedDescription": "Mixer faders use the spare height on Now Playing, with more room above the seek bar. Unsigned IPA for Sideloadly, AltStore, SideStore or Feather.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.15/stemify-1.0.15.ipa",
"size": 1626425,
"minOSVersion": "17.0"
},
{
"version": "1.0.14",
"marketingVersion": "1.0.14",
"buildVersion": "15",
"date": "2026-10-20T14:14:26-07:00",
"localizedDescription": "Reorderable tab bar (Songs, Albums, Artists, Genres, Playlists, Search, Downloads), AirPlay route picker in Now Playing, debug logging with log export in Settings, more room above the seeker. Unsigned IPA.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.14/stemify-1.0.14.ipa",
"size": 1625201,
"minOSVersion": "17.0"
},
{
"version": "1.0.13",
"marketingVersion": "1.0.13",
"buildVersion": "14",
"date": "2026-10-20T13:42:31-07:00",
"localizedDescription": "- Export and import of stem playlists and sound settings (Settings > Backup)\n- Mixer: one-line faders, every stem fits without scrolling\n- Wide and landscape now-playing layout for iPhone Duo\n\nUnsigned IPA: re-sign with Sideloadly or AltStore.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.13/stemify-1.0.13.ipa",
"size": 1559179,
"minOSVersion": "17.0"
},
{
"version": "1.0.12",
"marketingVersion": "1.0.12",
"buildVersion": "13",
"date": "2026-10-20T13:29:05-07:00",
"localizedDescription": "More space between the seek bar and the transport buttons on Now Playing. Unsigned IPA: re-sign with Sideloadly, AltStore, SideStore or Feather.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.12/stemify-1.0.12.ipa",
"size": 1529939,
"minOSVersion": "17.0"
},
{
"version": "1.0.11",
"marketingVersion": "1.0.11",
"buildVersion": "12",
"date": "2026-10-20T12:24:42-07:00",
"localizedDescription": "Tapping the lock screen / Control Center player opens the app again.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.11/stemify-1.0.11.ipa",
"size": 1529241,
"minOSVersion": "17.0"
},
{
"version": "1.0.10",
"marketingVersion": "1.0.10",
"buildVersion": "11",
"date": "2026-10-20T11:21:34-07:00",
"localizedDescription": "Shuffle and repeat (list and song) on Now Playing. Playback speed from 0.5x to 2x, pitch kept.\n\nUnsigned IPA, not tested on device.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.10/stemify-1.0.10.ipa",
"size": 1529239,
"minOSVersion": "17.0"
},
{
"version": "1.0.9",
"marketingVersion": "1.0.9",
"buildVersion": "10",
"date": "2026-10-20T10:28:26-07:00",
"localizedDescription": "- Add to Playlist is now one sheet instead of a string of pop-ups: Plex and Stem tabs, type a new playlist name right in the list, playlist art, and mix chips for stem playlists.\n- Song menus have a single \"Add to Playlist\u2026\" entry for both kinds; the sheet remembers which tab you used last.\n\nUnsigned IPA: sideload with AltStore, SideStore or Feather.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.9/stemify-1.0.9.ipa",
"size": 1518270,
"minOSVersion": "17.0"
},
{
"version": "1.0.8",
"marketingVersion": "1.0.8",
"buildVersion": "9",
"date": "2026-10-20T10:02:44-07:00",
"localizedDescription": "- Playlists tab now has Plex and Stem sections. Plex playlists are unchanged and use their custom Plex poster when there is one.\n- Stem playlists: each song keeps its own mix (instrumental, a cappella, no drums, custom...). Add songs from any menu, or copy a Plex playlist over in one go. Change one song's mix or the whole list's.\n- Softness slider under the Vocals picker in the lyrics view when vocals are set to Soft.\n\nUnsigned IPA: sideload with AltStore, SideStore or Feather.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.8/stemify-1.0.8.ipa",
"size": 1462423,
"minOSVersion": "17.0"
},
{
"version": "1.0.7",
"marketingVersion": "1.0.7",
"buildVersion": "8",
"date": "2026-10-20T09:39:03-07:00",
"localizedDescription": "- Mini player now sits in the tab bar's Liquid Glass accessory on iOS 26.1 and later, like Music. The tab bar shrinks when you scroll down and the player collapses to title and play/pause. Older iOS keeps the floating card.\n- Settings > Sound > Karaoke Soft Vocals: set how quiet Soft vocals are (-30 to -3 dB, default -12).\n\nUnsigned IPA: sideload with AltStore, SideStore or Feather.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.7/stemify-1.0.7.ipa",
"size": 1390623,
"minOSVersion": "17.0"
},
{
"version": "1.0.6",
"marketingVersion": "1.0.6",
"buildVersion": "7",
"date": "2026-10-20T09:31:01-07:00",
"localizedDescription": "- Karaoke vocals option on the lyrics panel: On (full vocals), Soft (vocals about 12 dB down as a guide), Off (no vocals). Remembered between songs and launches.\n\nUnsigned IPA: sideload with AltStore, SideStore or Feather.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.6/stemify-1.0.6.ipa",
"size": 1375443,
"minOSVersion": "17.0"
},
{
"version": "1.0.5",
"marketingVersion": "1.0.5",
"buildVersion": "6",
"date": "2026-10-20T09:23:39-07:00",
"localizedDescription": "- Sort menu on Artists, Albums, Songs and Playlists (Name, Date Added, Last Played, Plays, Rating, Year, Duration and more). Tap the current field again to flip direction (A to Z / Z to A, newest / oldest).\n- Each screen remembers its sort.\n\nUnsigned IPA: sideload with AltStore, SideStore or Feather.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.5/stemify-1.0.5.ipa",
"size": 1370686,
"minOSVersion": "17.0"
},
{
"version": "1.0.4",
"marketingVersion": "1.0.4",
"buildVersion": "5",
"date": "2026-10-20T09:18:33-07:00",
"localizedDescription": "Save a stem mix for a song (Save chip in the mixer); it comes back every time that song plays. New mic button for karaoke mode: vocals muted on every song plus synced lyrics from LRCLIB, tap a line to jump to it.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.4/stemify-1.0.4.ipa",
"size": 1355610,
"minOSVersion": "17.0"
},
{
"version": "1.0.3",
"marketingVersion": "1.0.3",
"buildVersion": "4",
"date": "2026-10-20T09:08:18-07:00",
"localizedDescription": "Bundle ID is now org.cdnutter.stemify (delete the old app first; settings won't carry over). IPA is named stemify-<version>.ipa. Adds an AltStore/SideStore/Feather source.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.3/stemify-1.0.3.ipa",
"size": 1319672,
"minOSVersion": "17.0"
},
{
"version": "1.0.2",
"marketingVersion": "1.0.2",
"buildVersion": "1.0.2",
"date": "2026-10-20T08:53:24-07:00",
"localizedDescription": "Unsigned, iOS 17 or newer. Sideload `Stemify.ipa` with Sideloadly or AltStore.\n\n- Shuffle on the Songs screen now picks from the whole library instead of only the songs loaded so far (the A's and B's)\n\nIncludes everything in 1.0.1. CarPlay and Siri still need entitlements a free Apple ID can't sign.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.2/stemify-1.0.2.ipa",
"size": 1319672,
"minOSVersion": "17.0"
},
{
"version": "1.0.1",
"marketingVersion": "1.0.1",
"buildVersion": "1.0.1",
"date": "2026-10-20T08:50:56-07:00",
"localizedDescription": "Unsigned, iOS 17 or newer. Sideload `Stemify.ipa` with Sideloadly or AltStore.\n\n- The mini player no longer covers the bottom of lists, and it is now a solid card that matches the app instead of system glass\n- More room between the title and the scrubber on Now Playing\n- The play button no longer spins forever after you change tracks\n- The stems and queue buttons now animate their panels in and out\n- Springier button presses and play/pause transitions\n\nCarPlay and Siri still need entitlements a free Apple ID can't sign.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0.1/stemify-1.0.1.ipa",
"size": 1317680,
"minOSVersion": "17.0"
},
{
"version": "1.0",
"marketingVersion": "1.0",
"buildVersion": "1.0",
"date": "2026-10-20T07:16:41-07:00",
"localizedDescription": "First iOS build. Unsigned, iOS 17 or newer.\n\nSideload `Stemify.ipa` with Sideloadly or AltStore, which sign it with your Apple ID.\n\nCarPlay and Siri need entitlements a free Apple ID can't sign, so on a free sideload they won't show up. Everything on the phone works. Not yet tested on a device.",
"downloadURL": "https://git.iamchrisama.com/cdnutter/stemify/releases/download/ios-v1.0/stemify-1.0.ipa",
"size": 1305649,
"minOSVersion": "17.0" "minOSVersion": "17.0"
} }
], ],
+43 -5
View File
@@ -30,6 +30,7 @@ import glob
import hashlib import hashlib
import json import json
import operator import operator
import re
import os import os
import shutil import shutil
import signal import signal
@@ -63,6 +64,35 @@ PEAK_RATE = 2000 # Hz the envelope is computed at; plenty for a few hundred bar
CHUNK = 1 << 20 CHUNK = 1 << 20
# The web player. Served without the token; it asks for one in its settings when TOKEN is set. # The web player. Served without the token; it asks for one in its settings when TOKEN is set.
WEB_DIR = os.path.realpath(os.environ.get("WEB_DIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "web"))) WEB_DIR = os.path.realpath(os.environ.get("WEB_DIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "web")))
# Web player build stamp: changes whenever any file in web/ does.
_web_cache = {}
def web_version():
try:
sig = sorted((e.name, e.stat().st_mtime_ns, e.stat().st_size) for e in os.scandir(WEB_DIR) if e.is_file())
except OSError:
return "0"
return hashlib.sha1(repr(sig).encode()).hexdigest()[:10]
def web_file(full, ver):
"""File body with local asset URLs stamped with ?v=ver (html and js), and its ETag."""
hit = _web_cache.get(full)
if hit and hit[0] == ver:
return hit[1], hit[2]
with open(full, "rb") as f:
body = f.read()
ext = os.path.splitext(full)[1]
if ext == ".html":
body = re.sub(rb'((?:src|href)="(?:\./)?[\w-]+\.(?:js|css))"', rb'\1?v=' + ver.encode() + rb'"', body)
elif ext == ".js":
body = re.sub(rb'((?:from |import\()"\./[\w-]+\.js)"', rb'\1?v=' + ver.encode() + rb'"', body)
etag = '"%s-%s"' % (ver, hashlib.sha1(body).hexdigest()[:8])
_web_cache[full] = (ver, body, etag)
return body, etag
WEB_TYPES = {".html": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8", ".css": "text/css; charset=utf-8", WEB_TYPES = {".html": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8", ".css": "text/css; charset=utf-8",
".svg": "image/svg+xml", ".png": "image/png", ".ico": "image/x-icon", ".json": "application/json"} ".svg": "image/svg+xml", ".png": "image/png", ".ico": "image/x-icon", ".json": "application/json"}
@@ -315,7 +345,9 @@ class Handler(BaseHTTPRequestHandler):
def _error(self, status, msg): def _error(self, status, msg):
self._send(status, json.dumps({"error": msg}).encode()) self._send(status, json.dumps({"error": msg}).encode())
def _web(self, path): def _web(self, path, query=""):
"""The web player. index.html and the modules point at ?v=<build> URLs, so a new
build is picked up on a plain reload and the versioned files cache for good."""
if not SERVE_WEB: if not SERVE_WEB:
return self._error(404, "not found") return self._error(404, "not found")
if path == "/": if path == "/":
@@ -323,10 +355,16 @@ class Handler(BaseHTTPRequestHandler):
full = os.path.realpath(os.path.join(WEB_DIR, path.lstrip("/"))) full = os.path.realpath(os.path.join(WEB_DIR, path.lstrip("/")))
if not full.startswith(WEB_DIR + os.sep) or not os.path.isfile(full): if not full.startswith(WEB_DIR + os.sep) or not os.path.isfile(full):
return self._error(404, "not found") return self._error(404, "not found")
with open(full, "rb") as f: ver = web_version()
body = f.read() body, etag = web_file(full, ver)
ctype = WEB_TYPES.get(os.path.splitext(full)[1], "application/octet-stream") ctype = WEB_TYPES.get(os.path.splitext(full)[1], "application/octet-stream")
self._send(200, body, ctype, {"Cache-Control": "no-cache"}) if "v=" + ver in query.split("&"):
cache = "public, max-age=31536000, immutable"
else:
cache = "no-cache"
if self.headers.get("If-None-Match") == etag:
return self._send(304, b"", ctype, {"Cache-Control": cache, "ETag": etag})
self._send(200, body, ctype, {"Cache-Control": cache, "ETag": etag})
def do_HEAD(self): def do_HEAD(self):
self.do_GET() self.do_GET()
@@ -341,7 +379,7 @@ class Handler(BaseHTTPRequestHandler):
if path.startswith("/plex/") and PLEX_URL: if path.startswith("/plex/") and PLEX_URL:
return self._plex_proxy(path[len("/plex"):], url.query, query) return self._plex_proxy(path[len("/plex"):], url.query, query)
if not path.startswith(("/api/", "/file/")): if not path.startswith(("/api/", "/file/")):
return self._web(path) return self._web(path, url.query)
if not self._authorized(query): if not self._authorized(query):
return self._error(HTTPStatus.UNAUTHORIZED, "bad token") return self._error(HTTPStatus.UNAUTHORIZED, "bad token")
try: try:
+326 -123
View File
@@ -3,7 +3,7 @@
import { $, $$, esc, fmtTime, fmtBytes, plural, on, emit, toast, ICON, store, uuid } from "./util.js"; import { $, $$, esc, fmtTime, fmtBytes, plural, on, emit, toast, ICON, store, uuid } from "./util.js";
import { S, save, songMixes, saveSongMix, forgetSongMix, playlists, savePlaylists, newPlaylist, addToPlaylist, Offline } from "./store.js"; import { S, save, songMixes, saveSongMix, forgetSongMix, playlists, savePlaylists, newPlaylist, addToPlaylist, Offline } from "./store.js";
import { px, img, track, sources, liveServers, server, refreshServer, addServer, manualServer, signIn, sortState, pickSort, comparator, sortTracks, Pager, everything } from "./plex.js"; import { px, img, rawImg, track, sources, liveServers, server, refreshServer, addServer, manualServer, signIn, sortState, pickSort, comparator, sortTracks, Pager, everything } from "./plex.js";
import { Stems, Live, stemNow, stemTrack, stemBase, api } from "./stems.js"; import { Stems, Live, stemNow, stemTrack, stemBase, api } from "./stems.js";
import { E, Q, setting, stemGain, presets, allPresets, presetLabel, applyPreset, currentPreset, nextPreset, savePreset, deletePreset, movePreset, restorePresets, deleteAllCustom, toggleLock, import { E, Q, setting, stemGain, presets, allPresets, presetLabel, applyPreset, currentPreset, nextPreset, savePreset, deletePreset, movePreset, restorePresets, deleteAllCustom, toggleLock,
mixChanged, setKaraoke, setKaraokeMode, sameMix, setSpeed, saveQueue, saveOffline, Radio } from "./player.js"; mixChanged, setKaraoke, setKaraokeMode, sameMix, setSpeed, saveQueue, saveOffline, Radio } from "./player.js";
@@ -15,6 +15,7 @@ const view = $("#view");
// ---- appearance ------------------------------------------------------------------------------- // ---- appearance -------------------------------------------------------------------------------
const THEMES = { const THEMES = {
graphite: { bg: "#181819", panel: "#101010", raised: "#262628", line: "#2b2b2e", text: "#e7e7e7", muted: "#a8a8a8", accent: "#3a81ed" },
amber: { bg: "#0d0e12", panel: "#15171d", raised: "#1d2028", line: "#262a33", text: "#eceef3", muted: "#8a8f9c", accent: "#f2b544" }, amber: { bg: "#0d0e12", panel: "#15171d", raised: "#1d2028", line: "#262a33", text: "#eceef3", muted: "#8a8f9c", accent: "#f2b544" },
ocean: { bg: "#0a1018", panel: "#101a26", raised: "#172434", line: "#1f2f42", text: "#e6eef7", muted: "#8698ad", accent: "#4cc2ff" }, ocean: { bg: "#0a1018", panel: "#101a26", raised: "#172434", line: "#1f2f42", text: "#e6eef7", muted: "#8698ad", accent: "#4cc2ff" },
rose: { bg: "#120c10", panel: "#1b1218", raised: "#251922", line: "#33222e", text: "#f5e9f0", muted: "#a48b99", accent: "#ff6f9f" }, rose: { bg: "#120c10", panel: "#1b1218", raised: "#251922", line: "#33222e", text: "#f5e9f0", muted: "#a48b99", accent: "#ff6f9f" },
@@ -27,8 +28,55 @@ const inkFor = hex => {
const n = parseInt(hex.slice(1), 16), l = (0.299 * (n >> 16) + 0.587 * (n >> 8 & 255) + 0.114 * (n & 255)) / 255; const n = parseInt(hex.slice(1), 16), l = (0.299 * (n >> 16) + 0.587 * (n >> 8 & 255) + 0.114 * (n & 255)) / 255;
return l > 0.6 ? "#141414" : "#ffffff"; return l > 0.6 ? "#141414" : "#ffffff";
}; };
// Theme from the playing track's art: one hue taken from the art, laid over the chosen theme's lightness.
const hex = (h, s, l) => {
const f = n => { const k = (n + h * 12) % 12, c = l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1)); return Math.round(c * 255).toString(16).padStart(2, "0"); };
return "#" + f(0) + f(8) + f(4);
};
function artPalette([h, s0, v], base) {
const s = Math.min(s0, 0.9), tint = Math.min(s * 0.55, 0.32), clamp = (x, a, b) => Math.max(a, Math.min(b, x));
if (base.light) return { bg: hex(h, tint, .955), panel: hex(h, tint, .985), raised: hex(h, tint, .9), line: hex(h, tint, .85),
text: hex(h, .2, .1), muted: hex(h, .08, .42), accent: hex(h, Math.max(s, .55), clamp(v * .45, .32, .42)), light: true };
const black = base.bg === "#000000";
return { bg: black ? "#000000" : hex(h, tint, .09), panel: black ? "#000000" : hex(h, tint, .06), raised: hex(h, tint, black ? .085 : .145), line: hex(h, tint, black ? .12 : .18),
text: hex(h, .15, .93), muted: hex(h, .1, .66), accent: hex(h, Math.max(s, .55), clamp(v * .7, .58, .7)) };
}
// Roughly a vibrant swatch: the circular mean hue of the most colorful mid-bright pixels.
function vibrant(bm) {
const n = 24, cv = new OffscreenCanvas(n, n), cx = cv.getContext("2d", { willReadFrequently: true });
cx.drawImage(bm, 0, 0, n, n);
const d = cx.getImageData(0, 0, n, n).data, px = [];
for (let i = 0; i < d.length; i += 4) {
const r = d[i] / 255, g = d[i + 1] / 255, b = d[i + 2] / 255, mx = Math.max(r, g, b), mn = Math.min(r, g, b), c = mx - mn;
const h = !c ? 0 : mx === r ? ((g - b) / c + 6) % 6 / 6 : mx === g ? ((b - r) / c + 2) / 6 : ((r - g) / c + 4) / 6, s = mx ? c / mx : 0;
px.push([h, s, mx, s * (1 - Math.abs(mx - 0.55) * 1.4)]);
}
const top = px.sort((a, b) => b[3] - a[3]).slice(0, px.length / 6);
let x = 0, y = 0, s = 0, v = 0;
for (const p of top) { x += Math.cos(p[0] * 2 * Math.PI); y += Math.sin(p[0] * 2 * Math.PI); s += p[1]; v += p[2]; }
return s / top.length < 0.12 ? null : [(Math.atan2(y, x) / (2 * Math.PI) + 1) % 1, s / top.length, v / top.length];
}
const ArtTheme = {
url: "", hsv: null, seq: 0, cache: new Map(),
async set(url) {
if (!S.artTheme) url = "";
if (url === this.url) return;
this.url = url;
const n = ++this.seq;
let hsv = url ? this.cache.get(url) : null;
if (url && !this.cache.has(url)) {
try {
const r = await fetch(url, { signal: AbortSignal.timeout(8000) });
hsv = vibrant(await createImageBitmap(await r.blob()));
this.cache.set(url, hsv);
} catch { hsv = null; }
if (n !== this.seq) return;
}
this.hsv = hsv; applyTheme();
},
};
function applyTheme() { function applyTheme() {
const t = THEMES[S.theme] || THEMES.amber, a = S.accent || t.accent; const base = THEMES[S.theme] || THEMES.graphite, t = ArtTheme.hsv ? artPalette(ArtTheme.hsv, base) : base, a = ArtTheme.hsv ? t.accent : S.accent || t.accent;
$("#theme").textContent = `:root{--bg:${t.bg};--panel:${t.panel};--raised:${t.raised};--line:${t.line};--text:${t.text};--muted:${t.muted};` + $("#theme").textContent = `:root{--bg:${t.bg};--panel:${t.panel};--raised:${t.raised};--line:${t.line};--text:${t.text};--muted:${t.muted};` +
`--accent:${a};--accent-ink:${inkFor(a)};--glass:${t.panel}ee;--hover:${t.text}0d;--shadow:${t.light ? "#0003" : "#0009"};` + `--accent:${a};--accent-ink:${inkFor(a)};--glass:${t.panel}ee;--hover:${t.text}0d;--shadow:${t.light ? "#0003" : "#0009"};` +
`--wave:${t.text}44;--wave-ghost:${t.text}14;color-scheme:${t.light ? "light" : "dark"}}`; `--wave:${t.text}44;--wave-ghost:${t.text}14;color-scheme:${t.light ? "light" : "dark"}}`;
@@ -147,6 +195,22 @@ let drawer = null; // "mixer" | "lyrics" | "queue"
const Lyr = { id: null, data: null, idx: -1 }; const Lyr = { id: null, data: null, idx: -1 };
const artOf = (t, size) => t?.srv ? img(t.srv, t.thumb, size) : ""; const artOf = (t, size) => t?.srv ? img(t.srv, t.thumb, size) : "";
// Feishin-style big art at the foot of the sidebar, opened from the art in the player bar.
const wide = matchMedia("(min-width: 861px)");
const SideArt = {
src: "",
show(on) { S.sideArt = on; save(); this.fill(); },
fill() {
const t = Radio.station ? null : Q.cur(), src = artOf(t, 640), on = !!(S.sideArt && src && wide.matches);
$("#app").classList.toggle("sideart", on);
$("#player").classList.toggle("sideart", on);
if (!on || src === this.src) return;
// Swap only once the new art has decoded, so it never flashes empty between tracks.
this.src = src;
const im = new Image(); im.src = src;
im.decode().catch(() => {}).then(() => { if (this.src === src) $("#sideart img").src = src; });
},
};
const UI = { const UI = {
all() { this.track(); this.transport(); this.progress(); this.drawer(); marks(); }, all() { this.track(); this.transport(); this.progress(); this.drawer(); marks(); },
track() { track() {
@@ -157,6 +221,7 @@ const UI = {
$("#np-title").textContent = st.name; $("#np-title").textContent = st.name;
$("#np-sub").textContent = "Web Radio"; $("#np-sub").textContent = "Web Radio";
$("#np-art").removeAttribute("src"); $("#np-art").removeAttribute("src");
$("#b-art").hidden = true; SideArt.fill(); ArtTheme.set("");
document.title = `${st.name} · Stemify`; document.title = `${st.name} · Stemify`;
if ("mediaSession" in navigator) navigator.mediaSession.metadata = new MediaMetadata({ title: st.name, artist: "Web Radio" }); if ("mediaSession" in navigator) navigator.mediaSession.metadata = new MediaMetadata({ title: st.name, artist: "Web Radio" });
return; return;
@@ -167,6 +232,7 @@ const UI = {
$("#np-sub").textContent = t ? [t.artist, t.album].filter(Boolean).join(" · ") : ""; $("#np-sub").textContent = t ? [t.artist, t.album].filter(Boolean).join(" · ") : "";
const art = artOf(t, 120); const art = artOf(t, 120);
if (art) $("#np-art").src = art; else $("#np-art").removeAttribute("src"); if (art) $("#np-art").src = art; else $("#np-art").removeAttribute("src");
$("#b-art").hidden = !art; SideArt.fill(); ArtTheme.set(artOf(t, 64));
document.title = t ? `${t.title} · Stemify` : "Stemify"; document.title = t ? `${t.title} · Stemify` : "Stemify";
if ("mediaSession" in navigator) { if ("mediaSession" in navigator) {
navigator.mediaSession.metadata = t ? new MediaMetadata({ navigator.mediaSession.metadata = t ? new MediaMetadata({
@@ -188,6 +254,7 @@ const UI = {
for (const d of ["mixer", "lyrics", "queue"]) $(`#b-${d}`).classList.toggle("on", drawer === d); for (const d of ["mixer", "lyrics", "queue"]) $(`#b-${d}`).classList.toggle("on", drawer === d);
$("#b-mixer").classList.toggle("dot", S.karaoke); $("#b-mixer").classList.toggle("dot", S.karaoke);
if ("mediaSession" in navigator) navigator.mediaSession.playbackState = playing ? "playing" : "paused"; if ("mediaSession" in navigator) navigator.mediaSession.playbackState = playing ? "playing" : "paused";
if (drawer === "mixer") Meter.start();
}, },
progress() { progress() {
$("#t-pos").textContent = E.loading ? `${Math.round(E.loadFrac * 100)}%` : fmtTime(E.position()); $("#t-pos").textContent = E.loading ? `${Math.round(E.loadFrac * 100)}%` : fmtTime(E.position());
@@ -207,6 +274,7 @@ const UI = {
d.innerHTML = tabs + `<div id="dbody">${drawer === "mixer" ? mixerHtml() : drawer === "queue" ? queueHtml() : lyricsShell()}</div>`; d.innerHTML = tabs + `<div id="dbody">${drawer === "mixer" ? mixerHtml() : drawer === "queue" ? queueHtml() : lyricsShell()}</div>`;
if (drawer === "lyrics") loadLyrics(); if (drawer === "lyrics") loadLyrics();
if (drawer === "queue") $(".q-item.cur", d)?.scrollIntoView({ block: "center" }); if (drawer === "queue") $(".q-item.cur", d)?.scrollIntoView({ block: "center" });
d.classList.toggle("mixing", drawer === "mixer");
} }
this.transport(); this.transport();
}, },
@@ -219,29 +287,91 @@ const karaokeHtml = () => `<div class="kara">
<div class="seg">${[["off", "No vocals"], ["soft", "Soft vocals"], ["on", "Vocals on"]].map(([m, l]) => `<button class="${S.karaokeMode === m ? "on" : ""}" data-kmode="${m}">${l}</button>`).join("")}</div> <div class="seg">${[["off", "No vocals"], ["soft", "Soft vocals"], ["on", "Vocals on"]].map(([m, l]) => `<button class="${S.karaokeMode === m ? "on" : ""}" data-kmode="${m}">${l}</button>`).join("")}</div>
${S.karaokeMode === "soft" ? `<label class="note">Soft vocals: <b id="softdb">${S.softDb} dB</b><input type="range" min="-30" max="-3" step="1" value="${S.softDb}" data-softdb></label>` : ""}</div>`; ${S.karaokeMode === "soft" ? `<label class="note">Soft vocals: <b id="softdb">${S.softDb} dB</b><input type="range" min="-30" max="-3" step="1" value="${S.softDb}" data-softdb></label>` : ""}</div>`;
// Stem colors match the iOS app.
const STEM_COLORS = { vocals: "#ff7ab6", drums: "#ffb547", bass: "#7c8cff", other: "#4cd07d", guitar: "#ff8a5c", piano: "#b48cff", instrumental: "#3dd6c6" };
const pct = v => Math.round(v * 100) + "%";
function presetsHtml(names) {
const cur = currentPreset(names), lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset);
return presets().map(p => `<button class="chip ${cur?.id === p.id ? "on" : ""} ${lock?.id === p.id ? "locked" : ""}" data-preset="${esc(p.id)}" ${p.build(names) ? "" : "disabled"}
title="Tap again for Full Mix. Long press to ${lock?.id === p.id ? "unlock" : "lock"}.">${lock?.id === p.id ? ICON.lock : ""}${esc(presetLabel(p.name))}</button>`).join("") + `<button class="chip" data-newpreset title="Save this mix as a preset">+</button>`;
}
function mixFoot(names) {
const saved = songMixes[E.entry.key], same = saved && sameMix(saved, S.mix, names);
return `<div class="mixacts">
<button class="mact ${same ? "on" : ""}" data-savemix>${same ? ICON.check : ICON.save}<span>${same ? "Mix saved" : saved ? "Update mix" : "Save mix"}</span></button>
<button class="mact" data-mixtopl>${ICON.pladd}<span>Add to playlist</span></button>
${saved ? `<button class="mact ic" data-forgetmix title="Forget this song's saved mix">${ICON.x}</button>` : ""}
</div>`;
}
function mixerHtml() { function mixerHtml() {
const names = mixNames(); const names = mixNames();
if (!names.length) return `<p class="note">${E.loading ? "Loading stems…" : Q.cur() ? "This track has no stems yet. Right-click it and pick Stem Now." : "Play something with stems to mix it."}</p>`; if (!names.length) return `<p class="note">${E.loading ? "Loading stems…" : Q.cur() ? "No stems for this track." : "Nothing playing."}</p>`;
const cur = currentPreset(names), key = E.entry.key, saved = songMixes[key]; return `<div id="mixer" data-names="${esc(names.join(","))}">
const lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset); <div class="presets">${presetsHtml(names)}</div>
const savedNote = saved ? (sameMix(saved, S.mix, names) ? "Using this song's saved mix." : "Changed from this song's saved mix.") : ""; <div class="strips">${names.map(n => {
return karaokeHtml() + ` const s = setting(n);
<div class="presets">${presets().map(p => `<button class="chip ${cur?.id === p.id ? "on" : ""} ${lock?.id === p.id ? "locked" : ""}" data-preset="${esc(p.id)}" ${p.build(names) ? "" : "disabled"} return `<div class="stem ${stemGain(n, names) ? "" : "silent"} ${s.muted ? "muted" : ""}" data-stem="${esc(n)}" style="--c:${STEM_COLORS[n] || "#8e8e93"}">
title="Tap again for Full Mix. Long press to ${lock?.id === p.id ? "unlock" : "lock"}.">${lock?.id === p.id ? ICON.lock : ""}${esc(presetLabel(p.name))}</button>`).join("")}<button class="chip" data-newpreset title="Save this mix as a preset">+</button></div> <div class="pct">${pct(s.level)}</div>
${names.map(n => { <div class="fader" data-fader="${esc(n)}" role="slider" aria-orientation="vertical" tabindex="0" aria-label="${esc(n)} level" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(s.level * 100)}" style="--v:${s.level}">
const s = setting(n), g = stemGain(n, names); <i class="lvl"></i><i class="mtr"></i><i class="cap"><b></b></i></div>
return `<div class="stem ${g ? "" : "silent"}"><span class="name">${esc(n)}</span> <div class="name" title="${esc(n)}">${esc(n)}</div>
<button class="ms ${s.muted ? "on" : ""}" data-mute="${esc(n)}" title="Mute">M</button> <div class="msrow"><button class="ms mute ${s.muted ? "on" : ""}" data-mute="${esc(n)}" title="Mute">M</button><button class="ms solo ${s.solo ? "on" : ""}" data-solo="${esc(n)}" title="Solo">S</button></div></div>`;
<button class="ms solo ${s.solo ? "on" : ""}" data-solo="${esc(n)}" title="Solo">S</button> }).join("")}</div>
<input type="range" min="0" max="1" step="0.01" value="${s.level}" data-level="${esc(n)}"></div>`; <div id="mixfoot">${mixFoot(names)}</div></div>`;
}).join("")} }
<div class="row mixrow"> // Updates the open mixer in place, so taps answer at once and the slider being dragged keeps
<button class="btn small" data-savemix>${saved ? "Update saved mix" : "Save mix for this song"}</button> // its grip. False when the stems changed and it needs a full render.
${saved ? `<button class="btn small" data-forgetmix>Forget</button>` : ""} function syncMixer() {
<button class="btn small" data-mixtopl>Add to stem playlist…</button> const box = $("#mixer"), names = mixNames();
</div> if (!box || box.dataset.names !== names.join(",")) return false;
<p class="note">${savedNote} ${S.karaoke ? "Karaoke is on, so saved mixes are ignored until you turn it off." : lock ? `${esc(presetLabel(lock.name))} is locked, so every song starts with it. Long press it to unlock.` const presetBox = box.querySelector(".presets"), html = presetsHtml(names);
: (S.keepMix ? "Songs without a saved mix keep this mix." : "Songs without a saved mix start at full mix.") + " Long press a preset to lock it."}</p>`; if (presetBox.innerHTML !== html) presetBox.innerHTML = html;
for (const row of box.querySelectorAll(".stem")) {
const n = row.dataset.stem, st = setting(n);
row.classList.toggle("silent", !stemGain(n, names));
row.classList.toggle("muted", !!st.muted);
row.querySelector(".mute").classList.toggle("on", !!st.muted);
row.querySelector(".solo").classList.toggle("on", !!st.solo);
paintFader(row.querySelector(".fader"), st.level);
}
box.querySelector("#mixfoot").innerHTML = mixFoot(names);
return true;
}
const paintFader = (f, v) => {
if (f.style.getPropertyValue("--v") === String(v)) return;
f.style.setProperty("--v", v); f.setAttribute("aria-valuenow", Math.round(v * 100)); f.parentNode.querySelector(".pct").textContent = pct(v);
};
// Live meters: each stem's bar rises and falls with its audio (pre-fader peak, shown under the
// fader's level like the iOS mixer). Runs on animation frames only while the mixer is open and
// playing or still falling, and writes nothing but transforms.
const Meter = {
raf: 0, rows: null, box: null, shown: new Map(),
start() { if (!this.raf) this.raf = requestAnimationFrame(this.tick); },
tick: () => {
const M = Meter, box = $("#mixer");
M.raf = 0;
if (!box || drawer !== "mixer" || document.hidden) return;
if (M.box !== box) { M.box = box; M.rows = [...box.querySelectorAll(".stem")].map(r => ({ n: r.dataset.stem, el: r.querySelector(".mtr") })); M.shown.clear(); }
const playing = E.playing && !E.buffering, names = mixNames();
let moving = false;
for (const r of M.rows) {
const st = setting(r.n), live = playing && stemGain(r.n, names) ? E.meter(r.n) * st.level : 0;
const prev = M.shown.get(r.n) || 0, v = live >= prev ? live : Math.max(live, prev - 0.025);
if (Math.abs(v - prev) > 0.002 || (v === 0 && prev !== 0)) { r.el.style.transform = `scaleY(${v.toFixed(3)})`; M.shown.set(r.n, v); }
if (v > 0) moving = true;
}
if (playing || moving) M.start();
},
};
// Sets a stem's level live; the save and mixer refresh wait until the gesture settles.
let levelSave = 0;
function setLevel(n, v) {
v = Math.round(Math.max(0, Math.min(1, v)) * 100) / 100;
if (setting(n).level === v) return;
S.mix[n] = { ...setting(n), level: v }; E.applyGains(); Wave.draw();
const f = $(`#mixer .fader[data-fader="${CSS.escape(n)}"]`); if (f) paintFader(f, v);
clearTimeout(levelSave); levelSave = setTimeout(() => { save(); syncMixer(); }, 250);
} }
function queueHtml() { function queueHtml() {
@@ -292,21 +422,60 @@ d$.addEventListener("click", ev => {
else if (ds.solo) { S.mix[ds.solo] = { ...setting(ds.solo), solo: !setting(ds.solo).solo }; mixChanged(); } else if (ds.solo) { S.mix[ds.solo] = { ...setting(ds.solo), solo: !setting(ds.solo).solo }; mixChanged(); }
else if ("kara" in ds) setKaraoke(!S.karaoke); else if ("kara" in ds) setKaraoke(!S.karaoke);
else if (ds.kmode) setKaraokeMode(ds.kmode); else if (ds.kmode) setKaraokeMode(ds.kmode);
else if ("savemix" in ds) { saveSongMix(E.entry.key, S.mix); toast("Saved the mix for this song"); UI.drawer(); } else if ("savemix" in ds) { saveSongMix(E.entry.key, S.mix); toast("Saved the mix for this song"); syncMixer() || UI.drawer(); }
else if ("forgetmix" in ds) { forgetSongMix(E.entry.key); UI.drawer(); } else if ("forgetmix" in ds) { forgetSongMix(E.entry.key); syncMixer() || UI.drawer(); }
else if ("mixtopl" in ds) { const r = b.getBoundingClientRect(); pickPlaylist(r.left, r.bottom, [Q.cur()], S.mix); } else if ("mixtopl" in ds) { const r = b.getBoundingClientRect(); pickPlaylist(r.left, r.bottom, [Q.cur()], S.mix); }
else if ("qclear" in ds) Q.clear(); else if ("qclear" in ds) Q.clear();
else if (ds.qx) Q.remove(+ds.qx); else if (ds.qx) Q.remove(+ds.qx);
else if (ds.q) Q.jump(+ds.q); else if (ds.q) Q.jump(+ds.q);
else if (ds.li) E.seek(Lyr.data.lines[+ds.li].t); else if (ds.li) E.seek(Lyr.data.lines[+ds.li].t);
}); });
// Faders: vertical. Grabbing the cap (or any touch) moves it from where it is; a mouse press
// elsewhere on the track jumps there first. Touches never scroll the drawer from a fader.
{
let drag = null;
const span = r => r.height - 8, val = (r, y) => (r.bottom - 4 - y) / span(r);
d$.addEventListener("pointerdown", ev => {
const f = ev.target.closest(".fader");
if (!f || ev.button) return;
ev.preventDefault();
const n = f.dataset.fader, r = f.getBoundingClientRect(), v = setting(n).level;
const onCap = Math.abs(ev.clientY - (r.bottom - 4 - v * span(r))) < 14;
drag = { f, n, id: ev.pointerId, y0: ev.clientY, v0: v, r, rel: onCap || ev.pointerType !== "mouse" };
f.setPointerCapture(ev.pointerId); f.classList.add("drag");
if (!drag.rel) setLevel(n, val(r, ev.clientY));
});
d$.addEventListener("pointermove", ev => {
if (!drag || ev.pointerId !== drag.id) return;
setLevel(drag.n, drag.rel ? drag.v0 + (drag.y0 - ev.clientY) / span(drag.r) : val(drag.r, ev.clientY));
});
const end = ev => {
if (!drag || ev.pointerId !== drag.id) return;
drag.f.classList.remove("drag"); drag = null;
};
d$.addEventListener("pointerup", end);
d$.addEventListener("pointercancel", end);
d$.addEventListener("dblclick", ev => { const f = ev.target.closest(".fader"); if (f) setLevel(f.dataset.fader, 1); });
d$.addEventListener("wheel", ev => {
const f = ev.target.closest(".fader");
if (!f) return;
ev.preventDefault();
setLevel(f.dataset.fader, setting(f.dataset.fader).level - Math.sign(ev.deltaY || ev.deltaX) * 0.02);
}, { passive: false });
d$.addEventListener("keydown", ev => {
const f = ev.target.closest(".fader");
if (!f) return;
const n = f.dataset.fader, v = setting(n).level, step = ev.shiftKey ? 0.1 : 0.02;
const to = { ArrowRight: v + step, ArrowUp: v + step, ArrowLeft: v - step, ArrowDown: v - step, Home: 0, End: 1 }[ev.key];
if (to == null) return;
ev.preventDefault(); ev.stopPropagation(); setLevel(n, to);
});
}
d$.addEventListener("input", ev => { d$.addEventListener("input", ev => {
const ds = ev.target.dataset; const ds = ev.target.dataset;
if (ds.level) { S.mix[ds.level] = { ...setting(ds.level), level: +ev.target.value }; E.applyGains(); Wave.draw(); save(); }
if (ds.softdb) $("#softdb").textContent = ev.target.value + " dB"; if (ds.softdb) $("#softdb").textContent = ev.target.value + " dB";
}); });
d$.addEventListener("change", ev => { d$.addEventListener("change", ev => {
if (ev.target.dataset.level) UI.drawer();
if (ev.target.dataset.softdb) setKaraokeMode("soft", +ev.target.value); if (ev.target.dataset.softdb) setKaraokeMode("soft", +ev.target.value);
}); });
// Long press (or right-click) a preset chip to lock it. // Long press (or right-click) a preset chip to lock it.
@@ -373,6 +542,10 @@ function applyBar() {
$("#speed").style.display = S.bar.speed ? "" : "none"; $("#speed").style.display = S.bar.speed ? "" : "none";
for (const k of ["mixer", "lyrics", "queue"]) $(`#b-${k}`).style.display = S.bar[k] ? "" : "none"; for (const k of ["mixer", "lyrics", "queue"]) $(`#b-${k}`).style.display = S.bar[k] ? "" : "none";
} }
$("#b-art").onclick = ev => { if (wide.matches) { ev.stopPropagation(); SideArt.show(true); } };
$("#sideart .sa-col").onclick = () => SideArt.show(false);
$("#sideart .sa-img").onclick = () => { const t = Q.cur(); if (t?.albumKey) location.hash = `#/album/${t.srv}:${t.albumKey}`; };
wide.addEventListener("change", () => SideArt.fill());
$(".np").onclick = () => { const t = Q.cur(); if (t?.albumKey) location.hash = `#/album/${t.srv}:${t.albumKey}`; }; $(".np").onclick = () => { const t = Q.cur(); if (t?.albumKey) location.hash = `#/album/${t.srv}:${t.albumKey}`; };
if ("mediaSession" in navigator) { if ("mediaSession" in navigator) {
@@ -420,21 +593,24 @@ on("queue", () => { if (drawer === "queue") UI.drawer(); });
on("radio", () => { UI.track(); UI.transport(); const el = $("#stations"); if (el) el.innerHTML = stationsHtml(); }); on("radio", () => { UI.track(); UI.transport(); const el = $("#stations"); if (el) el.innerHTML = stationsHtml(); });
on("mix", () => { on("mix", () => {
Wave.draw(); UI.transport(); Wave.draw(); UI.transport();
if (drawer === "mixer") UI.drawer(); if (drawer === "mixer") syncMixer() || UI.drawer();
else if (drawer === "lyrics" && $("#lyrhead")) $("#lyrhead").innerHTML = mixNames().includes("vocals") ? karaokeHtml() : ""; else if (drawer === "lyrics" && $("#lyrhead")) $("#lyrhead").innerHTML = mixNames().includes("vocals") ? karaokeHtml() : "";
}); });
// ---- live stem status --------------------------------------------------------------------------- // ---- live stem status ---------------------------------------------------------------------------
const base = p => (p || "").split("/").pop().replace(/\.[^.]+$/, ""); const base = p => (p || "").split("/").pop().replace(/\.[^.]+$/, "");
// Stems are the norm, so only songs without them get a tag (once the index has loaded).
const badge = t => { const badge = t => {
if (Stems.find(t)) return '<span class="tag stems">STEMS</span>'; if (Stems.find(t)) return "";
const s = Live.state(t); const s = Live.state(t);
return s ? `<span class="tag ${s}">${{ queued: "QUEUED", stemming: "STEMMING", failed: "FAILED" }[s]}</span>` : ""; if (s) return `<span class="tag ${s}">${{ queued: "QUEUED", stemming: "STEMMING", failed: "FAILED" }[s]}</span>`;
return Stems.entries.length ? '<span class="tag nostems">NO STEMS</span>' : "";
}; };
// Refreshes playing, stem and download markers in whatever is on screen. // Refreshes playing, stem and download markers in whatever is on screen.
function marks() { function marks() {
const id = Q.cur()?.id; const id = Q.cur()?.id;
document.body.classList.toggle("stems-ready", Stems.entries.length > 0);
for (const r of $$("tr[data-list]", view)) { for (const r of $$("tr[data-list]", view)) {
const t = lists[r.dataset.list]?.[+r.dataset.i]; const t = lists[r.dataset.list]?.[+r.dataset.i];
if (!t) continue; if (!t) continue;
@@ -549,11 +725,19 @@ function playFrom(listId, i) {
Q.playList(vis.includes(pick) ? vis : all, Math.max(0, (vis.includes(pick) ? vis : all).indexOf(pick)), false); Q.playList(vis.includes(pick) ? vis : all, Math.max(0, (vis.includes(pick) ? vis : all).indexOf(pick)), false);
} }
function card({ href, img: src, t, s = "", round, kind, srv, key }) { // A broken image tries its fallback (data-fb) once, then shows the placeholder.
const FB = `onerror="if(this.dataset.fb){this.src=this.dataset.fb;this.dataset.fb=''}else{this.onerror=null;this.src='data:image/gif;base64,R0lGODlhAQABAAAAACw='}"`;
function card({ href, img: src, fb, t, s = "", round, kind, srv, key }) {
const nk = kind === "album" || kind === "artist" ? nameKey(t) : ""; const nk = kind === "album" || kind === "artist" ? nameKey(t) : "";
const hide = nk && !stemSets()[kind].has(nk); const hide = nk && !stemSets()[kind].has(nk);
return `<a class="card ${round ? "round" : ""} ${hide ? "nostem" : ""}" href="${href}" ${kind ? `data-kind="${kind}" data-srv="${esc(srv)}" data-key="${esc(key)}"` : ""} ${nk ? `data-nk="${esc(nk)}"` : ""}> return `<a class="card ${round ? "round" : ""} ${hide ? "nostem" : ""}" href="${href}" ${kind ? `data-kind="${kind}" data-srv="${esc(srv)}" data-key="${esc(key)}"` : ""} ${nk ? `data-nk="${esc(nk)}"` : ""}>
${src ? `<img loading="lazy" src="${esc(src)}" alt="">` : `<div class="ph"></div>`}<div class="t">${esc(t)}</div><div class="s">${esc(s)}</div></a>`; <div class="art">${src ? `<img loading="lazy" decoding="async" src="${esc(src)}" ${fb ? `data-fb="${esc(fb)}"` : ""} ${FB} alt="">` : `<div class="ph"></div>`}${kind ? `<button class="cplay" data-cardplay title="Play">${ICON.play}</button>` : ""}</div><div class="t">${esc(t)}</div><div class="s">${esc(s)}</div></a>`;
}
// Tracks behind a card, for its play button and right-click menu.
async function cardTracks(c) {
const { kind, srv, key } = c.dataset;
if (kind === "playlist") return ((await px(srv, `/playlists/${key}/items`)).Metadata || []).map(m => track(srv, m));
return leaves(srv, key);
} }
const albumCard = m => card({ href: `#/album/${m._srv}:${m.ratingKey}`, img: img(m._srv, m.thumb), t: m.title, s: [m.parentTitle, m.year].filter(Boolean).join(" · "), kind: "album", srv: m._srv, key: m.ratingKey }); const albumCard = m => card({ href: `#/album/${m._srv}:${m.ratingKey}`, img: img(m._srv, m.thumb), t: m.title, s: [m.parentTitle, m.year].filter(Boolean).join(" · "), kind: "album", srv: m._srv, key: m.ratingKey });
const artistCard = m => card({ href: `#/artist/${m._srv}:${m.ratingKey}`, img: img(m._srv, m.thumb), t: m.title, round: true, kind: "artist", srv: m._srv, key: m.ratingKey }); const artistCard = m => card({ href: `#/artist/${m._srv}:${m.ratingKey}`, img: img(m._srv, m.thumb), t: m.title, round: true, kind: "artist", srv: m._srv, key: m.ratingKey });
@@ -561,15 +745,18 @@ const artistCard = m => card({ href: `#/artist/${m._srv}:${m.ratingKey}`, img: i
const rowHtml = (listId, t, i, { numbers, album = true, mix } = {}) => ` const rowHtml = (listId, t, i, { numbers, album = true, mix } = {}) => `
<tr data-list="${listId}" data-i="${i}" class="${Stems.find(t) ? "" : "nostem"} ${Q.cur()?.id === t.id ? "playing" : ""}"> <tr data-list="${listId}" data-i="${i}" class="${Stems.find(t) ? "" : "nostem"} ${Q.cur()?.id === t.id ? "playing" : ""}">
<td class="n">${numbers ? t.index ?? i + 1 : i + 1}</td> <td class="n">${numbers ? t.index ?? i + 1 : i + 1}</td>
<td class="ti">${esc(t.title)}<span class="badge">${badge(t)}</span>${mix ? '<span class="tag">MIX</span>' : ""}${album ? `<small>${esc([t.artist, t.album].filter(Boolean).join(" · "))}</small>` : ""}</td> <td class="ti"><div class="tt">${esc(t.title)}<span class="badge">${badge(t)}</span>${mix ? '<span class="tag">MIX</span>' : ""}</div><small>${esc(t.artist || "")}</small></td>
${album ? `<td class="al">${esc(t.album || "")}</td>` : ""}
<td class="off">${Offline.has(t.id) ? ICON.download : ""}</td> <td class="off">${Offline.has(t.id) ? ICON.download : ""}</td>
<td class="d">${fmtTime(t.duration / 1000)}</td> <td class="d">${fmtTime(t.duration / 1000)}</td>
<td class="acts"><button data-add title="Add to queue (shift: play next)">+</button><button data-menu title="More">${ICON.more}</button></td> <td class="acts"><button data-add title="Add to queue (shift: play next)">+</button><button data-menu title="More">${ICON.more}</button></td>
</tr>`; </tr>`;
const CLOCK = '<svg viewBox="0 0 24 24"><path d="M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm-1 3h2v4.6l3.4 2-1 1.7L11 12.7V7z"/></svg>';
const thead = (album = true) => `<thead><tr><th class="n">#</th><th class="ti">Title</th>${album ? '<th class="al">Album</th>' : ""}<th class="off"></th><th class="d">${CLOCK}</th><th class="acts"></th></tr></thead>`;
function trackTable(listId, tracks, opts = {}) { function trackTable(listId, tracks, opts = {}) {
lists[listId] = tracks; lists[listId] = tracks;
if (!tracks.length) return `<p class="empty-msg">Nothing here.</p>`; if (!tracks.length) return `<p class="empty-msg">Nothing here.</p>`;
return `<table class="tracks"><tbody>${tracks.map((t, i) => rowHtml(listId, t, i, { ...opts, mix: listItems[listId]?.[i]?.mix })).join("")}</tbody></table> return `<table class="tracks">${thead(opts.album)}<tbody>${tracks.map((t, i) => rowHtml(listId, t, i, { ...opts, mix: listItems[listId]?.[i]?.mix })).join("")}</tbody></table>
<p class="empty-msg only-stems">None of these have stems yet.</p><p class="empty-msg only-nostems">All of these have stems.</p>`; <p class="empty-msg only-stems">None of these have stems yet.</p><p class="empty-msg only-nostems">All of these have stems.</p>`;
} }
@@ -584,12 +771,13 @@ function sortControl(screen) {
const bar = (title, { sort, filter = true, extra = "" } = {}) => const bar = (title, { sort, filter = true, extra = "" } = {}) =>
`<div class="bar"><h1>${esc(title)}</h1><span class="sub" id="count"></span><span class="grow"></span>${extra}${filter ? stemsChip() : ""}${sort ? sortControl(sort) : ""}</div>`; `<div class="bar"><h1>${esc(title)}</h1><span class="sub" id="count"></span><span class="grow"></span>${extra}${filter ? stemsChip() : ""}${sort ? sortControl(sort) : ""}</div>`;
const actions = id => `<div class="actions"> const actions = id => `<div class="actions">
<button class="btn primary" data-play="${id}">${ICON.play} Play</button> <button class="bigplay" data-play="${id}" title="Play">${ICON.play}</button>
<button class="btn" data-play="${id}" data-mode="shuffle">${ICON.shuffle} Shuffle</button> <button class="ibtn" data-play="${id}" data-mode="shuffle" title="Shuffle">${ICON.shuffle}</button>
<button class="btn" data-play="${id}" data-mode="stem">Stem Now</button> <button class="btn" data-play="${id}" data-mode="stem">Stem Now</button>
<button class="btn icon" data-listmenu="${id}" title="More">${ICON.more}</button></div>`; <button class="ibtn" data-listmenu="${id}" title="More">${ICON.more}</button></div>`;
const hero = (src, kind, title, sub, id, round) => `<div class="hero">${src ? `<img src="${esc(src)}" alt="" ${round ? 'class="round"' : ""}>` : `<div class="ph ${round ? "round" : ""}"></div>`} const hero = (src, kind, title, sub, id, round, fb) => `<header class="hero">${src ? `<div class="hero-bg"><img src="${esc(src)}" alt="" onerror="this.style.display='none'"></div>` : ""}
<div class="meta"><div class="kind">${kind}</div><h1>${esc(title)}</h1><div class="sub">${sub}</div>${id ? actions(id) : ""}</div></div>`; <div class="hero-in">${src ? `<img class="art ${round ? "round" : ""}" src="${esc(src)}" ${fb ? `data-fb="${esc(fb)}"` : ""} ${FB} alt="">` : `<div class="ph ${round ? "round" : ""}"></div>`}
<div class="meta"><div class="kind">${kind}</div><h1>${esc(title)}</h1><div class="sub">${sub}</div></div></div></header>${id ? actions(id) : ""}`;
function needPlex() { function needPlex() {
view.innerHTML = `<h1>Welcome</h1><p class="sub">Add a Plex server in <a class="link" href="#/settings">Settings</a> to browse your library, or <a class="link" href="#/stems">browse the stems</a> on their own.</p>`; view.innerHTML = `<h1>Welcome</h1><p class="sub">Add a Plex server in <a class="link" href="#/settings">Settings</a> to browse your library, or <a class="link" href="#/stems">browse the stems</a> on their own.</p>`;
@@ -684,7 +872,7 @@ const stationsHtml = () => S.stations.length ? `<div class="stationlist">${S.sta
return `<div class="stn ${on ? "on" : ""}"><button class="btn icon ${playing ? "primary" : ""}" data-radio="${esc(st.id)}" title="${playing ? "Stop" : "Play"}">${playing ? ICON.pause : ICON.play}</button> return `<div class="stn ${on ? "on" : ""}"><button class="btn icon ${playing ? "primary" : ""}" data-radio="${esc(st.id)}" title="${playing ? "Stop" : "Play"}">${playing ? ICON.pause : ICON.play}</button>
<div class="tx"><b>${esc(st.name)}</b><span class="note">${esc(st.url)}</span></div> <div class="tx"><b>${esc(st.name)}</b><span class="note">${esc(st.url)}</span></div>
<button class="btn small" data-rdrename="${esc(st.id)}">Rename</button><button class="btn small" data-rddelete="${esc(st.id)}">Delete</button></div>`; <button class="btn small" data-rdrename="${esc(st.id)}">Rename</button><button class="btn small" data-rddelete="${esc(st.id)}">Delete</button></div>`;
}).join("")}</div>` : `<p class="empty-msg">No stations yet. Add one with its stream URL.</p>`; }).join("")}</div>` : `<p class="empty-msg">No stations yet.</p>`;
const routes = { const routes = {
async home(my) { async home(my) {
@@ -717,8 +905,7 @@ const routes = {
<h2>Add a station</h2><div class="form"> <h2>Add a station</h2><div class="form">
<label>Name<input type="text" id="rname" placeholder="KEXP"></label> <label>Name<input type="text" id="rname" placeholder="KEXP"></label>
<label>Stream URL<input type="url" id="rurl" placeholder="https://example.com/stream.mp3"></label> <label>Stream URL<input type="url" id="rurl" placeholder="https://example.com/stream.mp3"></label>
<div class="row"><button class="btn primary" data-rdadd>Add station</button></div> <div class="row"><button class="btn primary" data-rdadd>Add station</button></div></div>`;
<p class="note">Any stream the browser can play, like MP3, AAC or Ogg. Playing a station pauses the queue, and playing the queue stops the station.</p></div>`;
}, },
async albums(my) { async albums(my) {
const srcs = sources(); const srcs = sources();
@@ -736,7 +923,7 @@ const routes = {
const srcs = sources(); const srcs = sources();
if (!srcs.length) return needPlex(); if (!srcs.length) return needPlex();
view.innerHTML = bar("Songs", { sort: "songs", extra: `<button class="chip" data-shuffleall>${ICON.shuffle} Shuffle all</button>` }) view.innerHTML = bar("Songs", { sort: "songs", extra: `<button class="chip" data-shuffleall>${ICON.shuffle} Shuffle all</button>` })
+ `<table class="tracks"><tbody></tbody></table><p class="empty-msg only-stems">No songs with stems loaded yet. Scroll for more.</p><p class="empty-msg only-nostems">Every song loaded so far has stems. Scroll for more.</p>`; + `<table class="tracks">${thead()}<tbody></tbody></table><p class="empty-msg only-stems">No songs with stems yet.</p><p class="empty-msg only-nostems">Every song has stems.</p>`;
lists.songs = []; lists.songs = [];
const size = S.stemFilter ? 1000 : 150; const size = S.stemFilter ? 1000 : 150;
await paged(my, $("tbody", view), new Pager(srcs, secPath, { type: 10, sort: sortState("songs").param }, size), size, (ms, off) => { await paged(my, $("tbody", view), new Pager(srcs, secPath, { type: 10, sort: sortState("songs").param }, size), size, (ms, off) => {
@@ -768,14 +955,15 @@ const routes = {
view.innerHTML = bar("Playlists", { sort: "playlists", filter: false }) view.innerHTML = bar("Playlists", { sort: "playlists", filter: false })
+ `<div class="bar sm"><h2>Stem playlists</h2><button class="chip" data-newpl>+ New</button></div>` + `<div class="bar sm"><h2>Stem playlists</h2><button class="chip" data-newpl>+ New</button></div>`
+ (playlists.length ? `<div class="grid">${playlists.map(p => card({ href: `#/stemplaylist/${p.id}`, img: artOf(p.items[0]?.track, 300), t: p.title, s: plural(p.items.length, "track") })).join("")}</div>` + (playlists.length ? `<div class="grid">${playlists.map(p => card({ href: `#/stemplaylist/${p.id}`, img: artOf(p.items[0]?.track, 300), t: p.title, s: plural(p.items.length, "track") })).join("")}</div>`
: `<p class="note">Stem playlists remember a mix for each song. Right-click any song to add it.</p>`) : `<p class="empty-msg">No stem playlists.</p>`)
+ `<h2>Plex playlists</h2><div id="plexpl"><p class="note">${liveServers().length ? "Loading…" : "No Plex server set up."}</p></div>`; + `<h2>Plex playlists</h2><div id="plexpl"><p class="note">${liveServers().length ? "Loading…" : "No Plex server set up."}</p></div>`;
if (!liveServers().length) return; if (!liveServers().length) return;
let pls = await everything(liveServers().map(srv => ({ srv })), "/playlists", { playlistType: "audio" }); let pls = await everything(liveServers().map(srv => ({ srv })), "/playlists", { playlistType: "audio" });
if (my !== seq) return; if (my !== seq) return;
pls = st.random ? pls.sort(() => Math.random() - 0.5) : pls.sort(comparator(st.param)); pls = st.random ? pls.sort(() => Math.random() - 0.5) : pls.sort(comparator(st.param));
count(pls.length + playlists.length, "playlist"); count(pls.length + playlists.length, "playlist");
$("#plexpl").innerHTML = pls.length ? `<div class="grid">${pls.map(p => card({ href: `#/playlist/${p._srv}:${p.ratingKey}`, img: img(p._srv, p.composite || p.thumb), t: p.title, s: plural(p.leafCount || 0, "track") })).join("")}</div>`
$("#plexpl").innerHTML = pls.length ? `<div class="grid">${pls.map(p => card({ href: `#/playlist/${p._srv}:${p.ratingKey}`, img: img(p._srv, p.thumb || p.composite), fb: p.composite && rawImg(p._srv, p.composite), t: p.title, s: plural(p.leafCount || 0, "track"), kind: "playlist", srv: p._srv, key: p.ratingKey })).join("")}</div>`
: `<p class="empty-msg">No music playlists.</p>`; : `<p class="empty-msg">No music playlists.</p>`;
}, },
async album(my, arg) { async album(my, arg) {
@@ -805,7 +993,7 @@ const routes = {
const [info, items] = await Promise.all([px(srv, `/playlists/${key}`), px(srv, `/playlists/${key}/items`)]); const [info, items] = await Promise.all([px(srv, `/playlists/${key}`), px(srv, `/playlists/${key}/items`)]);
if (my !== seq) return; if (my !== seq) return;
const p = info.Metadata?.[0] || {}, tracks = sortTracks((items.Metadata || []).map(m => track(srv, m)), sortState("playlist")); const p = info.Metadata?.[0] || {}, tracks = sortTracks((items.Metadata || []).map(m => track(srv, m)), sortState("playlist"));
view.innerHTML = hero(img(srv, p.composite || p.thumb, 420), "Playlist", p.title, plural(tracks.length, "track"), "playlist") view.innerHTML = hero(img(srv, p.thumb || p.composite, 420), "Playlist", p.title, plural(tracks.length, "track"), "playlist", false, p.composite && rawImg(srv, p.composite, 420))
+ `<div class="bar sm"><span class="grow"></span>${stemsChip()}${sortControl("playlist")}</div>` + trackTable("playlist", tracks); + `<div class="bar sm"><span class="grow"></span>${stemsChip()}${sortControl("playlist")}</div>` + trackTable("playlist", tracks);
}, },
async stemplaylist(my, id) { async stemplaylist(my, id) {
@@ -840,7 +1028,7 @@ const routes = {
view.innerHTML = bar("Downloads", { filter: false, extra: recs.length ? `<button class="chip" data-dlclear>Remove all</button>` : "" }) view.innerHTML = bar("Downloads", { filter: false, extra: recs.length ? `<button class="chip" data-dlclear>Remove all</button>` : "" })
+ `<p class="note">${plural(recs.length, "track")}, ${fmtBytes(total)} stored in this browser${est?.quota ? ` (${fmtBytes(est.usage)} of ${fmtBytes(est.quota)} used)` : ""}. + `<p class="note">${plural(recs.length, "track")}, ${fmtBytes(total)} stored in this browser${est?.quota ? ` (${fmtBytes(est.usage)} of ${fmtBytes(est.quota)} used)` : ""}.
Downloads play without the network. ${isSecureContext ? "" : "This page isn't on HTTPS, so the browser may clear them when space runs low."}</p>` Downloads play without the network. ${isSecureContext ? "" : "This page isn't on HTTPS, so the browser may clear them when space runs low."}</p>`
+ (recs.length ? dlGroups(recs) : `<p class="empty-msg">Nothing downloaded. Right-click a song or album and pick Download for offline.</p>`); + (recs.length ? dlGroups(recs) : `<p class="empty-msg">Nothing downloaded.</p>`);
count(recs.length, "track"); count(recs.length, "track");
}, },
async stems(my) { async stems(my) {
@@ -852,7 +1040,7 @@ const routes = {
const f = $("#sf").value.toLowerCase(); const f = $("#sf").value.toLowerCase();
const hits = f ? all.filter(t => t.stem.key.toLowerCase().includes(f)) : all; const hits = f ? all.filter(t => t.stem.key.toLowerCase().includes(f)) : all;
$("#sl").innerHTML = (hits.length ? trackTable("stems", hits.slice(0, 400)) : `<p class="empty-msg">${Stems.ok ? "No matches." : "Can't reach stemserve. Check Settings."}</p>`) $("#sl").innerHTML = (hits.length ? trackTable("stems", hits.slice(0, 400)) : `<p class="empty-msg">${Stems.ok ? "No matches." : "Can't reach stemserve. Check Settings."}</p>`)
+ (hits.length > 400 ? `<p class="note">Showing 400 of ${hits.length}. Filter to narrow it down.</p>` : ""); + (hits.length > 400 ? `<p class="note">400 of ${hits.length}</p>` : "");
}; };
$("#sf").oninput = render; $("#sf").oninput = render;
render(); render();
@@ -884,6 +1072,11 @@ view.addEventListener("click", async ev => {
const el = ev.target.closest("button, tr[data-list]"); const el = ev.target.closest("button, tr[data-list]");
if (!el) return; if (!el) return;
const ds = el.dataset, row = ev.target.closest("tr[data-list]"); const ds = el.dataset, row = ev.target.closest("tr[data-list]");
if ("cardplay" in ds) {
ev.preventDefault();
const ts = await cardTracks(el.closest(".card"));
return ts.length ? Q.playList(ts, 0, false) : toast("Nothing to play");
}
if (ds.stemfilter) { S.stemFilter = S.stemFilter === ds.stemfilter ? "" : ds.stemfilter; save(); applyStemFilter(); return; } if (ds.stemfilter) { S.stemFilter = S.stemFilter === ds.stemfilter ? "" : ds.stemfilter; save(); applyStemFilter(); return; }
if ("sortdir" in ds) { pickSort(ds.sortdir, sortState(ds.sortdir).i); return route(); } if ("sortdir" in ds) { pickSort(ds.sortdir, sortState(ds.sortdir).i); return route(); }
if ("reshuffle" in ds) return route(); if ("reshuffle" in ds) return route();
@@ -950,7 +1143,7 @@ view.addEventListener("change", ev => {
view.addEventListener("contextmenu", ev => { view.addEventListener("contextmenu", ev => {
const row = ev.target.closest("tr[data-list]"), c = ev.target.closest(".card[data-kind]"); const row = ev.target.closest("tr[data-list]"), c = ev.target.closest(".card[data-kind]");
if (row) { ev.preventDefault(); trackMenu(ev.clientX, ev.clientY, row.dataset.list, +row.dataset.i); } if (row) { ev.preventDefault(); trackMenu(ev.clientX, ev.clientY, row.dataset.list, +row.dataset.i); }
else if (c) { ev.preventDefault(); listMenu(ev.clientX, ev.clientY, () => leaves(c.dataset.srv, c.dataset.key), { title: $(".t", c).textContent, href: c.getAttribute("href") }); } else if (c) { ev.preventDefault(); listMenu(ev.clientX, ev.clientY, () => cardTracks(c), { title: $(".t", c).textContent, href: c.getAttribute("href") }); }
}); });
// ---- settings ----------------------------------------------------------------------------------- // ---- settings -----------------------------------------------------------------------------------
@@ -959,98 +1152,98 @@ const SECTIONS = [["plex", "Plex"], ["stems", "Stem server"], ["stemopts", "Stem
["offline", "Offline"], ["backup", "Backup"], ["keys", "Keys"], ["about", "About"]]; ["offline", "Offline"], ["backup", "Backup"], ["keys", "Keys"], ["about", "About"]];
const BAR = [["speed", "Speed"], ["mixer", "Mixer"], ["lyrics", "Lyrics"], ["queue", "Queue"]]; const BAR = [["speed", "Speed"], ["mixer", "Mixer"], ["lyrics", "Lyrics"], ["queue", "Queue"]];
// Settings rows: label on the left, control on the right, grouped into cards.
const srow = (title, ctrl, sub = "") => `<div class="sr"><div class="sl"><span>${title}</span>${sub ? `<small>${sub}</small>` : ""}</div><div class="sc">${ctrl}</div></div>`;
const stog = (title, input, sub = "") => `<label class="sr"><div class="sl"><span>${title}</span>${sub ? `<small>${sub}</small>` : ""}</div><div class="sc">${input}</div></label>`;
const sw = (attrs, on) => `<input type="checkbox" class="sw" ${attrs} ${on ? "checked" : ""}>`;
function presetEditor() { function presetEditor() {
const ps = presets(), lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset); const ps = presets(), lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset);
return `<h3>Locked</h3> return `<div class="sg">${srow("Locked preset", lock
${lock ? `<div class="prow"><span class="pn">${ICON.lock}${esc(presetLabel(lock.name))}</span><span class="grow"></span><button class="btn small" data-plock="${esc(lock.id)}">Unlock</button></div>` : `<p class="note">Nothing locked.</p>`} ? `<span class="val">${ICON.lock}${esc(presetLabel(lock.name))}</span><button class="btn small" data-plock="${esc(lock.id)}">Unlock</button>`
<p class="note">Every song starts with this mix, whether or not Keep Stem Mix Between Songs is on. Long press a preset in the mixer to lock or unlock it.</p> : `<span class="val dim">None</span>`)}</div>
<h3>Mixer Bar</h3><div class="plist">${ps.map((p, i) => `<div class="prow"><span class="pn">${esc(presetLabel(p.name))}${p.custom ? ' <span class="tag">CUSTOM</span>' : ""}</span><span class="grow"></span> <h3 class="sgh">Mixer bar</h3>
<button class="btn small ${lock?.id === p.id ? "on" : ""}" data-plock="${esc(p.id)}" title="${lock?.id === p.id ? "Unlock" : "Lock"}">${ICON.lock}</button> <div class="sg">${ps.map((p, i) => `<div class="sr"><div class="sl"><span>${esc(presetLabel(p.name))}${p.custom ? ' <span class="tag">CUSTOM</span>' : ""}</span></div><div class="sc ibs">
<button class="btn small" data-pmove="${esc(p.id)}" data-pdir="-1" ${i ? "" : "disabled"} title="Move up">↑</button> <button class="ib ${lock?.id === p.id ? "on" : ""}" data-plock="${esc(p.id)}" title="${lock?.id === p.id ? "Unlock" : "Lock"}">${ICON.lock}</button>
<button class="btn small" data-pmove="${esc(p.id)}" data-pdir="1" ${i < ps.length - 1 ? "" : "disabled"} title="Move down">↓</button> <button class="ib" data-pmove="${esc(p.id)}" data-pdir="-1" ${i ? "" : "disabled"} title="Move up">${ICON.up}</button>
<button class="btn small" data-pdel="${esc(p.id)}" ${p.id === "b:Full Mix" ? "disabled" : ""} title="Delete">×</button></div>`).join("")}</div> <button class="ib" data-pmove="${esc(p.id)}" data-pdir="1" ${i < ps.length - 1 ? "" : "disabled"} title="Move down">${ICON.down}</button>
<h3>Stems</h3><div class="row"> <button class="ib bad" data-pdel="${esc(p.id)}" ${p.id === "b:Full Mix" ? "disabled" : ""} title="Delete">${ICON.x}</button></div></div>`).join("")}</div>
<button class="btn small" data-padd ${mixNames().length ? "" : "disabled"} title="Play a song with stems to save its mix">Save the current mix as a preset</button> <div class="sg">
<button class="btn small" data-prestore ${S.hiddenPresets.length ? "" : "disabled"}>Restore Deleted Presets</button> <button class="sr act" data-padd ${mixNames().length ? "" : "disabled"}>Save current mix as preset</button>
<button class="btn small" data-pclear ${S.customPresets.length ? "" : "disabled"}>Delete All Custom Presets</button></div>`; <button class="sr act" data-prestore ${S.hiddenPresets.length ? "" : "disabled"}>Restore deleted presets</button>
<button class="sr act bad" data-pclear ${S.customPresets.length ? "" : "disabled"}>Delete all custom presets</button></div>`;
} }
on("presets", () => { const el = $("#pedit"); if (el) el.innerHTML = presetEditor(); }); on("presets", () => { const el = $("#pedit"); if (el) el.innerHTML = presetEditor(); });
const FORMATS = [["opus96", "Opus 96 kbps"], ["opus160", "Opus 160 kbps"], ["opus256", "Opus 256 kbps"], ["flac", "FLAC (original)"]]; const FORMATS = [["opus96", "Opus 96 kbps"], ["opus160", "Opus 160 kbps"], ["opus256", "Opus 256 kbps"], ["flac", "FLAC (original)"]];
function serverHtml(srv) { function serverHtml(srv) {
const dup = srv.mid && S.servers.find(o => o !== srv && o.mid === srv.mid && S.servers.indexOf(o) < S.servers.indexOf(srv)); const dup = srv.mid && S.servers.find(o => o !== srv && o.mid === srv.mid && S.servers.indexOf(o) < S.servers.indexOf(srv));
return `<div class="srv"><div class="row"><b>${esc(srv.name || srv.url)}</b> const secs = srv.sections || [];
<span class="note">${srv.env ? "through this stemserve (PLEX_URL)" : esc(srv.url)}</span><span class="grow"></span> return `<div class="sr srv"><div class="sl"><span>${esc(srv.name || srv.url)}</span><small>${srv.env ? "Through stemserve" : esc(srv.url)}</small></div><div class="sc">
<button class="btn small" data-refsrv="${esc(srv.id)}">Refresh</button> <button class="btn small" data-refsrv="${esc(srv.id)}">Refresh</button>
${srv.env ? "" : `<button class="btn small" data-rmsrv="${esc(srv.id)}">Remove</button>`}</div> ${srv.env ? "" : `<button class="btn small" data-rmsrv="${esc(srv.id)}">Remove</button>`}</div>
${dup ? `<p class="note">Same Plex server as ${esc(dup.name)}, which is used instead.</p>` <div class="libs">${dup ? `<small>Duplicate of ${esc(dup.name)}</small>`
: (srv.sections || []).length ? `<div class="secs">${srv.sections.map(sec => `<label class="check"><input type="checkbox" data-sec="${esc(srv.id)}|${esc(sec.key)}" ${sec.on ? "checked" : ""}>${esc(sec.title)}</label>`).join("")}</div>` : secs.length ? secs.map(sec => `<label class="lib"><input type="checkbox" data-sec="${esc(srv.id)}|${esc(sec.key)}" ${sec.on ? "checked" : ""}>${esc(sec.title)}</label>`).join("")
: `<p class="note">No music libraries found. Try Refresh.</p>`}</div>`; : `<small>No music libraries</small>`}</div></div>`;
} }
const KEYS = [["Space", "Play / pause"], ["← →", "Seek 5 s"], ["⇧ ← →", "Seek 30 s"], ["S", "Shuffle"], ["R", "Repeat"], ["[ ]", "Speed"],
["M", "Mixer"], ["L", "Lyrics"], ["Q", "Queue"], ["K", "Karaoke"], ["P", "Next preset"]];
function renderSettings() { function renderSettings() {
const theme = THEMES[S.theme] || THEMES.amber; const theme = THEMES[S.theme] || THEMES.graphite, nMix = Object.keys(songMixes).length;
view.innerHTML = `<div class="settings"><nav class="toc">${SECTIONS.map(([id, l]) => `<a href="#/settings" data-jump="${id}">${l}</a>`).join("")}</nav><div class="panes"> view.innerHTML = `<div class="settings"><nav class="toc">${SECTIONS.map(([id, l]) => `<a href="#/settings" data-jump="${id}">${l}</a>`).join("")}</nav><div class="panes">
<h1>Settings</h1>
<section id="set-plex"><h2>Plex</h2> <section id="set-plex"><h2>Plex</h2>
<p class="note">Turn on the music libraries you want. Everything that's on is browsed as one library.</p> <div class="sg">${S.servers.map(serverHtml).join("") || srow(`<span class="dim">No servers</span>`, "")}
<div id="srvs">${S.servers.map(serverHtml).join("") || `<p class="note">No servers yet.</p>`}</div> ${srow(`<span class="dim" id="sstatus"></span>`, `<button class="btn primary small" id="signin">Sign in with Plex</button>`)}</div>
<div class="row"><button class="btn primary" id="signin">Sign in with Plex</button><span class="note" id="sstatus"></span></div> <details class="sg"><summary class="sr"><div class="sl"><span>Add by URL and token</span></div><div class="sc chev">${ICON.down}</div></summary>
<details><summary class="note">Add a server by URL and token</summary><div class="form"> ${srow("Server URL", `<input type="url" id="purl" placeholder="http://10.0.0.2:32400">`)}
<label>Server URL<input type="url" id="purl" placeholder="http://10.0.0.2:32400"></label> ${srow("Token", `<input type="password" id="ptok">`)}
<label>Token<input type="password" id="ptok"></label> <div class="sr end"><button class="btn small" id="padd">Add server</button></div></details>
<div class="row"><button class="btn" id="padd">Add server</button></div></div></details>
</section> </section>
<section id="set-stems"><h2>Stem server</h2><div class="form"> <section id="set-stems"><h2>Stem server</h2><div class="sg">
<p class="note" id="stem-info">Checking stemserve…</p> ${srow("Status", `<span class="stat" id="stem-info">Checking…</span>`)}
<label>URL (blank = this page's server)<input type="url" id="surl" placeholder="${esc(location.origin)}" value="${esc(S.stemUrl)}"></label> ${srow("URL", `<input type="url" id="surl" placeholder="${esc(location.origin)}" value="${esc(S.stemUrl)}">`)}
<label>Token (if stemserve has TOKEN set)<input type="password" id="stok" value="${esc(S.stemToken)}"></label> ${srow("Token", `<input type="password" id="stok" value="${esc(S.stemToken)}" placeholder="None">`)}
<div class="row"><button class="btn" id="ssave">Save and reconnect</button></div></div> <div class="sr end"><button class="btn small" id="ssave">Save and reconnect</button></div></div>
</section> </section>
<section id="set-stemopts"><h2>Stems</h2><div class="form"> <section id="set-stemopts"><h2>Stems</h2><div class="sg">
<label>Stem format<select id="fmt">${FORMATS.map(([v, l]) => `<option value="${v}" ${S.fmt === v ? "selected" : ""}>${l}</option>`).join("")}</select></label> ${srow("Format", `<select id="fmt">${FORMATS.map(([v, l]) => `<option value="${v}" ${S.fmt === v ? "selected" : ""}>${l}</option>`).join("")}</select>`)}
<p class="note">Stems are downloaded whole before a song starts. Opus 160 is about 1 MB per stem-minute; FLAC is around eight times that.</p> ${srow("Cache ahead", `<input type="range" id="precache" min="0" max="50" step="1" value="${S.precache}"><input type="number" id="precachen" min="0" max="50" value="${S.precache}"><span class="dim">songs</span>`)}
<label>Cache Ahead<div class="row"><input type="range" id="precache" min="0" max="50" step="1" value="${S.precache}"><input type="number" id="precachen" min="0" max="50" value="${S.precache}"> songs</div></label> ${stog("Keep mix between songs", sw(`id="keepmix"`, S.keepMix))}
<p class="note">How many upcoming songs load their stems in the background. Each one is held in memory, so keep it low on phones. FLAC loads one at most.</p> ${srow("Saved song mixes", `<span class="val">${nMix}</span>${nMix ? `<button class="btn small" id="forgetall">Forget all</button>` : ""}`)}</div>
<label class="check"><input type="checkbox" id="keepmix" ${S.keepMix ? "checked" : ""}>Keep Stem Mix Between Songs</label>
<p class="note">Songs without a saved mix keep the current mix. When it's off they start at full mix, and karaoke turns off.</p>
<div class="row"><span class="note">${plural(Object.keys(songMixes).length, "saved song mix")}</span>${Object.keys(songMixes).length ? `<button class="btn small" id="forgetall">Forget all</button>` : ""}</div></div>
</section> </section>
<section id="set-presets"><h2>Stem Editor</h2><div id="pedit">${presetEditor()}</div></section> <section id="set-presets"><h2>Stem Editor</h2><div id="pedit">${presetEditor()}</div></section>
<section id="set-karaoke"><h2>Karaoke</h2><div class="form"> <section id="set-karaoke"><h2>Karaoke</h2><div class="sg">
<label class="check"><input type="checkbox" id="kon" ${S.karaoke ? "checked" : ""}>Karaoke on (K)</label> ${stog(`Karaoke <kbd>K</kbd>`, sw(`id="kon"`, S.karaoke))}
<label>Vocals in karaoke<select id="kmode">${[["off", "Off"], ["soft", "Soft"], ["on", "Left on (lyrics only)"]].map(([v, l]) => `<option value="${v}" ${S.karaokeMode === v ? "selected" : ""}>${l}</option>`).join("")}</select></label> ${srow("Vocals", `<select id="kmode">${[["off", "Off"], ["soft", "Soft"], ["on", "Left on (lyrics only)"]].map(([v, l]) => `<option value="${v}" ${S.karaokeMode === v ? "selected" : ""}>${l}</option>`).join("")}</select>`)}
<label>Soft vocal level: <span id="kdbv">${S.softDb} dB</span><input type="range" id="kdb" min="-30" max="-3" step="1" value="${S.softDb}"></label> ${srow("Soft vocal level", `<input type="range" id="kdb" min="-30" max="-3" step="1" value="${S.softDb}"><span class="val num" id="kdbv">${S.softDb} dB</span>`)}</div>
<p class="note">Synced lyrics come from LRCLIB, shown in the Lyrics drawer (L).</p></div>
</section> </section>
<section id="set-look"><h2>Appearance</h2><div class="form"> <section id="set-look"><h2>Appearance</h2>
<div class="themes">${Object.entries(THEMES).map(([k, t]) => `<button class="swatch ${S.theme === k ? "on" : ""}" data-theme="${k}" style="background:${t.bg};color:${t.text};border-color:${t.line}"><i style="background:${t.accent}"></i>${k[0].toUpperCase() + k.slice(1)}</button>`).join("")}</div> <div class="sg"><div class="sr col"><div class="sl"><span>Theme</span></div>
<div class="row"><label class="check">Accent <input type="color" id="accent" value="${S.accent || theme.accent}"></label>${S.accent ? `<button class="btn small" id="accentreset">Use the theme's</button>` : ""}</div> <div class="themes">${Object.entries(THEMES).map(([k, t]) => `<button class="swatch ${S.theme === k ? "on" : ""}" data-theme="${k}" style="background:${t.bg};color:${t.text};border-color:${t.line}"><i style="background:${t.accent}"></i>${k[0].toUpperCase() + k.slice(1)}</button>`).join("")}</div></div>
<label class="check"><input type="checkbox" id="acapella" ${S.acapella ? "checked" : ""}>Spell the vocals-only preset “Acapella”</label> ${srow("Accent", `${S.accent ? `<button class="btn small" id="accentreset">Reset</button>` : ""}<input type="color" id="accent" value="${S.accent || theme.accent}">`)}
<div class="row"><span class="note">Player bar</span>${BAR.map(([k, l]) => `<label class="check"><input type="checkbox" data-bar="${k}" ${S.bar[k] ? "checked" : ""}>${l}</label>`).join("")}</div> ${stog("Match album art", sw(`id="arttheme"`, S.artTheme))}
<label>Custom CSS<textarea id="css" rows="8" spellcheck="false" placeholder=":root { --accent: #7cf; --radius: 4px; }\n.card img { border-radius: 0; }">${esc(S.css)}</textarea></label> ${stog("Call the vocals-only preset “Acapella”", sw(`id="acapella"`, S.acapella))}</div>
<p class="note">Applied live, after the theme. Variables: --bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost.</p></div> <h3 class="sgh">Player bar</h3>
<div class="sg">${BAR.map(([k, l]) => stog(l, sw(`data-bar="${k}"`, S.bar[k]))).join("")}</div>
<h3 class="sgh">Custom CSS</h3>
<div class="sg"><div class="sr col"><textarea id="css" rows="7" spellcheck="false" placeholder=":root { --accent: #7cf; --radius: 4px; }\n.card img { border-radius: 0; }">${esc(S.css)}</textarea>
<small class="mono">--bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost</small></div></div>
</section> </section>
<section id="set-offline"><h2>Offline</h2> <section id="set-offline"><h2>Offline</h2><div class="sg">
<p class="note" id="storage-info">${plural(Offline.ids.size, "track")} downloaded. <a class="link" href="#/downloads">Manage downloads</a></p> ${srow("Downloads", `<span class="val" id="storage-info">${plural(Offline.ids.size, "track")}</span><a class="btn small" href="#/downloads">Manage</a>`)}
${isSecureContext && navigator.storage?.persist ? `<div class="row"><button class="btn small" id="persist">Ask the browser to keep downloads</button></div>` : `<p class="note">Over plain HTTP the browser may clear downloads when it's short on space.</p>`} ${isSecureContext && navigator.storage?.persist ? srow("Keep downloads", `<button class="btn small" id="persist">Ask browser</button>`) : ""}</div>
</section> </section>
<section id="set-backup"><h2>Backup</h2> <section id="set-backup"><h2>Backup</h2><div class="sg">
<p class="note">Settings, saved mixes and stem playlists. The file includes your Plex tokens.</p> ${srow("Settings, mixes and playlists", `<button class="btn small" id="export">Export</button><label class="btn small">Import<input type="file" id="import" accept="application/json" hidden></label>`, "Includes your Plex tokens")}</div>
<div class="row"><button class="btn" id="export">Export</button><label class="btn">Import<input type="file" id="import" accept="application/json" hidden></label></div>
</section> </section>
<section id="set-keys"><h2>Keys</h2><p class="note">Space play/pause · ←/→ seek 5s (shift 30s) · S shuffle · R repeat · [ ] speed · M mixer · L lyrics · Q queue · K karaoke · P next preset · hold Next to skip the album · right-click a song or album for more</p></section> <section id="set-keys"><h2>Keys</h2><div class="sg"><div class="keys">${KEYS.map(([k, l]) => `<div><span>${l}</span>${k.split(" ").map(x => `<kbd>${x}</kbd>`).join("")}</div>`).join("")}</div></div></section>
<section id="set-about"><h2>About</h2> <section id="set-about"><h2>About</h2><div class="sg">
<p><b>Stemify</b> <span class="note" id="about-ver"></span></p> ${srow("Stemify", `<span class="val dim" id="about-ver"></span>`, "Your Plex and Jellyfin music, split into stems you can mix")}
<p class="note">Your Plex and Jellyfin music, split into stems you can mix.</p> ${srow("Chris Nutter", `<a class="btn small" href="https://iamchrisama.com" target="_blank" rel="noopener">Website</a><a class="btn small" href="https://buymeacoffee.com/cdnutter" target="_blank" rel="noopener">Buy Me a Coffee</a>`, "Web UI and iOS app")}
<div class="people"> ${srow("Kevin Viers", `<a class="btn small" href="https://github.com/kevinViers/" target="_blank" rel="noopener">GitHub</a><a class="btn small" href="https://venmo.com/code?user_id=2910252785729536546&amp;created=1792897467" target="_blank" rel="noopener">Venmo</a>`, "stemd and Android app")}</div>
<div class="person"><b>Chris Nutter</b><span class="note">Stemify WebUI and the iOS app</span><div class="row">
<a class="btn small" href="https://iamchrisama.com" target="_blank" rel="noopener">iamchrisama.com</a>
<a class="btn small" href="https://buymeacoffee.com/cdnutter" target="_blank" rel="noopener">Buy Me a Coffee</a></div></div>
<div class="person"><b>Kevin Viers</b><span class="note">stemd and the Android app</span><div class="row">
<a class="btn small" href="https://github.com/kevinViers/" target="_blank" rel="noopener">GitHub</a>
<a class="btn small" href="https://venmo.com/code?user_id=2910252785729536546&amp;created=1792897467" target="_blank" rel="noopener">Venmo</a></div></div>
</div>
<p class="note">Stemify is free. A tip goes straight to the person you pick.</p>
</section> </section>
</div></div>`; </div></div>`;
@@ -1059,9 +1252,16 @@ function renderSettings() {
const el = $("#stem-info"); const el = $("#stem-info");
const v = $("#about-ver"); const v = $("#about-ver");
if (v && info) v.textContent = `stemserve v${info.version}`; if (v && info) v.textContent = `stemserve v${info.version}`;
if (el) el.textContent = info ? `stemserve v${info.version} at ${stemBase()}, ${info.tracks} tracks with stems${info.ffmpeg ? ", Opus available" : ""}.` : `Can't reach stemserve at ${stemBase()}.`; if (el) { el.textContent = info ? `v${info.version} · ${info.tracks} tracks${info.ffmpeg ? " · Opus" : ""}` : "Unreachable"; el.classList.add(info ? "ok" : "bad"); }
}); });
navigator.storage?.estimate?.().then(e => { const el = $("#storage-info"); if (el && e?.quota) el.insertAdjacentText("afterbegin", `${fmtBytes(e.usage)} of ${fmtBytes(e.quota)} used. `); }).catch(() => {}); navigator.storage?.estimate?.().then(e => { const el = $("#storage-info"); if (el && e?.quota) el.insertAdjacentText("beforeend", ` · ${fmtBytes(e.usage)} of ${fmtBytes(e.quota)}`); }).catch(() => {});
// The section in view lights up in the side list.
const toc = [...view.querySelectorAll(".toc a")];
const spy = new IntersectionObserver(es => {
for (const e of es) if (e.isIntersecting) for (const a of toc) a.classList.toggle("on", "set-" + a.dataset.jump === e.target.id);
}, { root: view, rootMargin: "0px 0px -70% 0px" });
view.querySelectorAll(".panes section").forEach(s => spy.observe(s));
const again = () => { if (location.hash.startsWith("#/settings")) renderSettings(); }; const again = () => { if (location.hash.startsWith("#/settings")) renderSettings(); };
const plexChanged = () => { genreCache = null; save(); }; const plexChanged = () => { genreCache = null; save(); };
@@ -1086,6 +1286,7 @@ function renderSettings() {
const ahead = v => { S.precache = Math.max(0, Math.min(50, Math.round(+v || 0))); $("#precache").value = $("#precachen").value = S.precache; save(); }; const ahead = v => { S.precache = Math.max(0, Math.min(50, Math.round(+v || 0))); $("#precache").value = $("#precachen").value = S.precache; save(); };
$("#precache").oninput = ev => ahead(ev.target.value); $("#precache").oninput = ev => ahead(ev.target.value);
$("#precachen").onchange = ev => ahead(ev.target.value); $("#precachen").onchange = ev => ahead(ev.target.value);
$("#arttheme").onchange = ev => { S.artTheme = ev.target.checked; save(); ArtTheme.set(S.artTheme ? artOf(Q.cur(), 64) : ""); };
$("#acapella").onchange = ev => { S.acapella = ev.target.checked; save(); emit("presets"); emit("mix"); }; $("#acapella").onchange = ev => { S.acapella = ev.target.checked; save(); emit("presets"); emit("mix"); };
if ($("#forgetall")) $("#forgetall").onclick = () => { for (const k of Object.keys(songMixes)) forgetSongMix(k); again(); }; if ($("#forgetall")) $("#forgetall").onclick = () => { for (const k of Object.keys(songMixes)) forgetSongMix(k); again(); };
$("#kon").onchange = ev => setKaraoke(ev.target.checked); $("#kon").onchange = ev => setKaraoke(ev.target.checked);
@@ -1117,7 +1318,7 @@ function renderSettings() {
const b = ev.target.closest("[data-jump], [data-theme], [data-refsrv], [data-rmsrv], [data-plock], [data-pmove], [data-pdel], [data-padd], [data-prestore], [data-pclear]"); const b = ev.target.closest("[data-jump], [data-theme], [data-refsrv], [data-rmsrv], [data-plock], [data-pmove], [data-pdel], [data-padd], [data-prestore], [data-pclear]");
if (!b) return; if (!b) return;
const ds = b.dataset; const ds = b.dataset;
if (ds.jump) { ev.preventDefault(); $("#set-" + ds.jump).scrollIntoView({ behavior: "smooth" }); } if (ds.jump) { ev.preventDefault(); $("#set-" + ds.jump).scrollIntoView({ behavior: "smooth", block: "start" }); }
else if (ds.theme) { S.theme = ds.theme; S.accent = ""; applyTheme(); save(); again(); } else if (ds.theme) { S.theme = ds.theme; S.accent = ""; applyTheme(); save(); again(); }
else if (ds.refsrv) { try { await refreshServer(server(ds.refsrv)); toast("Refreshed"); } catch (e) { toast(e.message); } plexChanged(); again(); } else if (ds.refsrv) { try { await refreshServer(server(ds.refsrv)); toast("Refreshed"); } catch (e) { toast(e.message); } plexChanged(); again(); }
else if (ds.rmsrv && confirm("Remove this server?")) { S.servers = S.servers.filter(s => s.id !== ds.rmsrv); plexChanged(); again(); } else if (ds.rmsrv && confirm("Remove this server?")) { S.servers = S.servers.filter(s => s.id !== ds.rmsrv); plexChanged(); again(); }
@@ -1162,15 +1363,17 @@ async function connect() {
save(); save();
} }
let connecting = null;
(async () => { (async () => {
applyTheme(); applyTheme();
applyStemFilter(); applyStemFilter();
applyBar(); applyBar();
await Offline.init(); await Offline.init();
await Promise.race([connect(), new Promise(r => setTimeout(r, 5000))]); connecting = connect();
await Promise.race([connecting, new Promise(r => setTimeout(r, 5000))]);
Q.restore(); Q.restore();
UI.all(); UI.all();
route(); route();
Live.poll(); Live.poll();
setInterval(() => { if (!document.hidden) Stems.refresh(); }, 5 * 60 * 1000); setInterval(() => { if (!document.hidden) { Stems.refresh(); } }, 5 * 60 * 1000);
})(); })();
+14 -11
View File
@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="theme-color" content="#0d0e12"> <meta name="theme-color" content="#181819">
<title>Stemify</title> <title>Stemify</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<style id="theme"></style> <style id="theme"></style>
@@ -14,25 +14,28 @@
<aside id="nav"> <aside id="nav">
<div class="brand">stemify</div> <div class="brand">stemify</div>
<form id="search"><input type="search" name="q" placeholder="Search" autocomplete="off"></form> <form id="search"><input type="search" name="q" placeholder="Search" autocomplete="off"></form>
<a href="#/home" data-nav="home">Home</a> <a href="#/home" data-nav="home"><svg viewBox="0 0 24 24"><path d="M12 3l9 7.5V21h-6.5v-6h-5v6H3V10.5L12 3zm0 2.6L5 11.4V19h2.5v-6h9v6H19v-7.6l-7-5.8z"/></svg>Home</a>
<a href="#/albums" data-nav="albums">Albums</a> <a href="#/albums" data-nav="albums"><svg viewBox="0 0 24 24"><path d="M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>Albums</a>
<a href="#/artists" data-nav="artists">Artists</a> <a href="#/artists" data-nav="artists"><svg viewBox="0 0 24 24"><path d="M12 3a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9zm0 2a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zm0 8c4.4 0 8 2.2 8 5v3H4v-3c0-2.8 3.6-5 8-5zm0 2c-3.4 0-6 1.6-6 3v1h12v-1c0-1.4-2.6-3-6-3z"/></svg>Artists</a>
<a href="#/songs" data-nav="songs">Songs</a> <a href="#/songs" data-nav="songs"><svg viewBox="0 0 24 24"><path d="M9 4l12-2v13.5a3.5 3.5 0 1 1-2-3.16V6.4l-8 1.33v9.77A3.5 3.5 0 1 1 9 14.34V4zm-3.5 12a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm12-1a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z"/></svg>Songs</a>
<a href="#/genres" data-nav="genres">Genres</a> <a href="#/genres" data-nav="genres"><svg viewBox="0 0 24 24"><path d="M3 3h8.4l9.3 9.3a1.5 1.5 0 0 1 0 2.1l-6.3 6.3a1.5 1.5 0 0 1-2.1 0L3 11.4V3zm2 2v5.6l8.4 8.4 5.6-5.6L10.6 5H5zm2.5 1.5a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3z"/></svg>Genres</a>
<a href="#/playlists" data-nav="playlists">Playlists</a> <a href="#/playlists" data-nav="playlists"><svg viewBox="0 0 24 24"><path d="M3 5h14v2H3zm0 6h14v2H3zm0 6h9v2H3zm16-4v-2l4 1v2l-2-.5V19a2.5 2.5 0 1 1-2-2.45V13z"/></svg>Playlists</a>
<a href="#/downloads" data-nav="downloads">Downloads</a> <a href="#/downloads" data-nav="downloads"><svg viewBox="0 0 24 24"><path d="M11 3h2v10.2l3.6-3.6 1.4 1.4-6 6-6-6 1.4-1.4 3.6 3.6V3zM4 19h16v2H4z"/></svg>Downloads</a>
<a href="#/radio" data-nav="radio">Web Radio</a> <a href="#/radio" data-nav="radio"><svg viewBox="0 0 24 24"><path d="M12 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4zM7.8 7.8l1.4 1.4a4 4 0 0 0 0 5.6l-1.4 1.4a6 6 0 0 1 0-8.4zm8.4 0a6 6 0 0 1 0 8.4l-1.4-1.4a4 4 0 0 0 0-5.6l1.4-1.4zM5 5l1.4 1.4a8 8 0 0 0 0 11.2L5 19A10 10 0 0 1 5 5zm14 0a10 10 0 0 1 0 14l-1.4-1.4a8 8 0 0 0 0-11.2L19 5z"/></svg>Web Radio</a>
<a href="#/settings" data-nav="settings" class="settings-link"><svg viewBox="0 0 24 24"><path d="M10.3 2h3.4l.5 2.6c.6.2 1.2.5 1.7.9l2.5-.9 1.7 2.9-2 1.8a7 7 0 0 1 0 1.9l2 1.8-1.7 2.9-2.5-.9c-.5.4-1.1.7-1.7.9l-.5 2.6h-3.4l-.5-2.6a7 7 0 0 1-1.7-.9l-2.5.9-1.7-2.9 2-1.8a7 7 0 0 1 0-1.9l-2-1.8 1.7-2.9 2.5.9c.5-.4 1.1-.7 1.7-.9l.5-2.6zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z" transform="translate(0 1)"/></svg>Settings</a>
<div id="live" hidden></div> <div id="live" hidden></div>
<a href="#/settings" data-nav="settings" class="settings-link">Settings</a> <div id="sideart"><button class="sa-img" title="Go to album"><img alt=""></button><button class="sa-col" title="Collapse art"><svg viewBox="0 0 24 24"><path d="M12 16.4L4.3 8.7l1.4-1.4 6.3 6.3 6.3-6.3 1.4 1.4z"/></svg></button></div>
</aside> </aside>
<main id="view"></main> <main id="view"></main>
<aside id="drawer" hidden></aside> <aside id="drawer" hidden></aside>
</div> </div>
<footer id="player" class="empty"> <footer id="player" class="empty">
<div class="left">
<div class="np"> <div class="np">
<img id="np-art" alt=""> <button id="b-art" title="Expand art" hidden><img id="np-art" alt=""><span class="exp"><svg viewBox="0 0 24 24"><path d="M12 7.6l7.7 7.7-1.4 1.4-6.3-6.3-6.3 6.3-1.4-1.4z"/></svg></span></button>
<div class="np-text"><div id="np-title"></div><div id="np-sub"></div></div> <div class="np-text"><div id="np-title"></div><div id="np-sub"></div></div>
</div> </div>
</div>
<div class="center"> <div class="center">
<div class="transport"> <div class="transport">
<button id="b-shuffle" class="side" title="Shuffle (S)"></button> <button id="b-shuffle" class="side" title="Shuffle (S)"></button>
+18 -5
View File
@@ -193,7 +193,7 @@ const Pre = {
// ---- engine ----------------------------------------------------------------------------------- // ---- engine -----------------------------------------------------------------------------------
export const E = { export const E = {
els: [], names: [], gains: [], urls: [], ctx: null, master: null, els: [], names: [], gains: [], meters: [], urls: [], ctx: null, master: null, mbuf: new Float32Array(1024),
want: false, stalled: false, loading: false, loadFrac: 0, pendingPos: 0, want: false, stalled: false, loading: false, loadFrac: 0, pendingPos: 0,
entry: null, offline: null, ctl: null, gen: 0, entry: null, offline: null, ctl: null, gen: 0,
@@ -262,13 +262,15 @@ export const E = {
el.src = s.url; el.src = s.url;
el.playbackRate = el.defaultPlaybackRate = S.speed; el.playbackRate = el.defaultPlaybackRate = S.speed;
if (this.pendingPos) el.currentTime = this.pendingPos; if (this.pendingPos) el.currentTime = this.pendingPos;
let gain = null; let gain = null, meter = null;
if (graph) { if (graph) {
gain = this.ctx.createGain(); gain = this.ctx.createGain();
this.ctx.createMediaElementSource(el).connect(gain).connect(this.master); meter = this.ctx.createAnalyser();
meter.fftSize = 1024;
this.ctx.createMediaElementSource(el).connect(meter).connect(gain).connect(this.master);
} }
if (s.blob) this.urls.push(s.url); if (s.blob) this.urls.push(s.url);
this.els.push(el); this.gains.push(gain); this.names.push(s.name); this.els.push(el); this.gains.push(gain); this.meters.push(meter); this.names.push(s.name);
} }
this.graph = graph; this.graph = graph;
const lead = this.els[0]; const lead = this.els[0];
@@ -284,10 +286,21 @@ export const E = {
this.ctl?.abort(); this.ctl = null; this.ctl?.abort(); this.ctl = null;
for (const el of this.els) { el.pause(); el.removeAttribute("src"); el.load(); } for (const el of this.els) { el.pause(); el.removeAttribute("src"); el.load(); }
for (const u of this.urls) URL.revokeObjectURL(u); for (const u of this.urls) URL.revokeObjectURL(u);
this.els = []; this.names = []; this.gains = []; this.urls = []; this.els = []; this.names = []; this.gains = []; this.meters = []; this.urls = [];
this.loading = false; this.loading = false;
}, },
// A stem's live peak before its fader, 0..1 over a 48 dB range (0 without Web Audio).
meter(name) {
const a = this.meters[this.names.indexOf(name)];
if (!a) return 0;
const b = this.mbuf;
a.getFloatTimeDomainData(b);
let p = 0;
for (let i = 0; i < b.length; i++) { const v = b[i] < 0 ? -b[i] : b[i]; if (v > p) p = v; }
return p < 0.004 ? 0 : Math.min(1, (20 * Math.log10(p) + 48) / 48);
},
applyGains() { applyGains() {
const named = this.names.filter(Boolean); const named = this.names.filter(Boolean);
this.els.forEach((el, i) => { this.els.forEach((el, i) => {
+6 -3
View File
@@ -26,14 +26,17 @@ export async function px(srv, path, params = {}) {
export function img(srvId, thumb, size = 300) { export function img(srvId, thumb, size = 300) {
const s = server(srvId); const s = server(srvId);
if (!thumb || !s) return ""; if (!thumb || !s) return "";
// Playlist composites are already images Plex renders at any size; the photo transcoder
// can't fetch them, so ask for them directly.
if (thumb.includes("/composite/")) return `${s.url}${thumb}${thumb.includes("?") ? "&" : "?"}width=${size}&height=${size}&X-Plex-Token=${s.token}`;
return thumb && s return thumb && s
? `${s.url}/photo/:/transcode?width=${size}&height=${size}&minSize=1&upscale=1&url=${encodeURIComponent(thumb)}&X-Plex-Token=${s.token}` ? `${s.url}/photo/:/transcode?width=${size}&height=${size}&minSize=1&upscale=1&url=${encodeURIComponent(thumb)}&X-Plex-Token=${s.token}`
: ""; : "";
} }
// Straight from Plex, no transcoder: the fallback for playlist composites.
export function rawImg(srvId, path, size = 300) {
const s = server(srvId);
return s && path ? `${s.url}${path}${path.includes("?") ? "&" : "?"}width=${size}&height=${size}&X-Plex-Token=${s.token}` : "";
}
export function partUrl(t) { export function partUrl(t) {
const s = server(t.srv); const s = server(t.srv);
return s && t.part ? `${s.url}${t.part}?X-Plex-Token=${s.token}` : null; return s && t.part ? `${s.url}${t.part}?X-Plex-Token=${s.token}` : null;
+2 -1
View File
@@ -24,10 +24,11 @@ export const S = Object.assign({
acapella: false, // spell "A Cappella" as "Acapella" acapella: false, // spell "A Cappella" as "Acapella"
bar: { speed: true, mixer: true, lyrics: true, queue: true }, // player bar buttons bar: { speed: true, mixer: true, lyrics: true, queue: true }, // player bar buttons
stations: [], // web radio: [{id, name, url}] stations: [], // web radio: [{id, name, url}]
theme: "amber", accent: "", css: "", theme: "graphite", accent: "", css: "", sideArt: false, artTheme: false,
}, load(KEY) || {}); }, load(KEY) || {});
if (!S.clientId) S.clientId = uuid(); if (!S.clientId) S.clientId = uuid();
if (!S.ui2) { if (S.theme === "amber" && !S.accent) S.theme = "graphite"; S.ui2 = true; }
if (S.fmt.startsWith("opus") && !new Audio().canPlayType('audio/ogg; codecs="opus"')) S.fmt = "flac"; if (S.fmt.startsWith("opus") && !new Audio().canPlayType('audio/ogg; codecs="opus"')) S.fmt = "flac";
// Before multiple servers there was one S.plex and one S.section. // Before multiple servers there was one S.plex and one S.section.
+270 -96
View File
@@ -1,83 +1,132 @@
:root { :root {
--bg: #0d0e12; --bg: #181819;
--panel: #15171d; --panel: #101010;
--raised: #1d2028; --raised: #262628;
--line: #262a33; --line: #2b2b2e;
--text: #eceef3; --text: #e7e7e7;
--muted: #8a8f9c; --muted: #a8a8a8;
--accent: #f2b544; --accent: #3a81ed;
--accent-ink: #1a1306; --accent-ink: #ffffff;
--radius: 12px; --radius: 6px;
--player-h: 96px; --player-h: 100px;
--glass: #15171dee; --nav-w: 240px;
--hover: #eceef30d; --glass: #101010ee;
--hover: #e7e7e70d;
--shadow: #0009; --shadow: #0009;
--wave: #eceef344; --wave: #e7e7e744;
--wave-ghost: #eceef314; --wave-ghost: #e7e7e714;
color-scheme: dark; color-scheme: dark;
} }
* { box-sizing: border-box; } * { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; } font: 13px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
* { scrollbar-width: thin; scrollbar-color: #5a5a5a80 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #5a5a5a80; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #5a5a5a; }
::-webkit-scrollbar-track { background: transparent; }
button, input, select, textarea { font: inherit; color: inherit; } button, input, select, textarea { font: inherit; color: inherit; }
button:disabled { opacity: .4; cursor: default; } button:disabled { opacity: .4; cursor: default; }
button { background: none; border: 0; cursor: pointer; padding: 0; } button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; } a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; fill: currentColor; display: block; } svg { width: 1em; height: 1em; fill: currentColor; display: block; }
#app { display: grid; grid-template-columns: 210px 1fr auto; height: calc(100% - var(--player-h)); } #app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); height: calc(100% - var(--player-h)); }
#nav { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; } #nav { background: var(--panel); padding: 16px 10px 0; display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.brand { white-space: nowrap; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; padding: 0 10px 18px; } #nav > * { flex: none; }
.brand { white-space: nowrap; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; padding: 0 10px 6px; }
.brand::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 3px; } .brand::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 3px; }
#nav a { padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; } #nav a { display: flex; align-items: center; gap: 12px; min-height: 34px; padding: 0 10px; border-radius: 4px; color: var(--muted); font-weight: 500; white-space: nowrap; transition: color .12s, background-color .12s; }
#nav a:hover { color: var(--text); } #nav a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#nav a svg { width: 18px; height: 18px; flex: none; }
#nav a:hover { color: var(--text); background: var(--hover); }
#nav a.on { background: var(--raised); color: var(--text); } #nav a.on { background: var(--raised); color: var(--text); }
#search input { width: 100%; margin: 12px 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; outline: none; } #search input { width: 100%; margin: 10px 0; padding: 7px 10px; background: var(--raised); border: 1px solid transparent; border-radius: 4px; outline: none; }
#search input:focus { border-color: var(--accent); } #search input:focus { border-color: var(--accent); }
.settings-link { margin-top: auto; } .settings-link { margin-top: 2px; }
#sideart { display: none; position: sticky; bottom: 0; z-index: 2; margin-top: auto; padding: 10px 0 12px; background: var(--panel); }
#sideart::before { content: ""; position: absolute; left: -10px; right: -10px; bottom: 100%; height: 28px; pointer-events: none; background: linear-gradient(to top, var(--panel), transparent); }
#app.sideart #sideart { display: block; animation: sain .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes sain { from { opacity: 0; transform: translateY(16px); } }
#sideart .sa-img { display: block; width: 100%; aspect-ratio: 1; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--raised);
box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent), 0 8px 22px rgba(0, 0, 0, .32); }
#sideart img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
#sideart .sa-img:hover img { transform: scale(1.035); }
#sideart img:not([src]) { visibility: hidden; }
#sideart .sa-col { position: absolute; top: 18px; right: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transform: scale(.9); transition: opacity .15s, transform .15s, background-color .15s; }
#sideart .sa-col svg { width: 18px; height: 18px; fill: #fff; }
#sideart:hover .sa-col, #sideart .sa-col:focus-visible { opacity: 1; transform: none; }
#sideart .sa-col:hover { background: rgba(0, 0, 0, .8); }
#view { overflow-y: auto; padding: 28px 32px 48px; } #view { overflow-y: auto; padding: 24px 32px 48px; background: var(--bg); }
h1 { font-size: 28px; letter-spacing: -0.02em; margin: 0 0 4px; } h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 28px 0 12px; } h2 { font-size: 18px; font-weight: 700; margin: 28px 0 12px; }
.sub { color: var(--muted); } .sub { color: var(--muted); }
.bar { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; flex-wrap: wrap; } .bar { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; flex-wrap: wrap; }
.bar h1 { margin-right: auto; } .bar h1 { margin-right: auto; }
select, textarea, input[type=text], input[type=url], input[type=password] { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; outline: none; } select, textarea, input[type=text], input[type=url], input[type=password] { background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; outline: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 18px; } .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card { display: block; min-width: 0; } .card { display: block; min-width: 0; padding: 10px; border-radius: var(--radius); content-visibility: auto; contain-intrinsic-size: auto 240px; transition: background-color .15s; }
.card img, .card .ph { width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; background: var(--raised); display: block; transition: transform .15s; } .card:hover { background: var(--hover); }
.card:hover img { transform: translateY(-2px); } .card .art { position: relative; }
.card img, .card .ph { width: 100%; aspect-ratio: 1; border-radius: 4px; object-fit: cover; background: var(--raised); display: block; }
.card.round img, .card.round .ph { border-radius: 50%; } .card.round img, .card.round .ph { border-radius: 50%; }
.card .t { margin-top: 8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .cplay { position: absolute; right: 8px; bottom: 8px; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
.card .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } display: grid; place-items: center; font-size: 17px; box-shadow: 0 6px 16px #0008; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; }
.cplay svg { margin-left: 2px; }
.card:hover .cplay, .cplay:focus-visible { opacity: 1; transform: none; }
.cplay:hover { transform: scale(1.06) !important; }
.card .t { margin-top: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero { display: flex; gap: 28px; align-items: flex-end; margin-bottom: 26px; } .hero { position: relative; isolation: isolate; overflow: hidden; margin: -24px -32px 0; padding: 64px 32px 28px; }
.hero img { width: 210px; height: 210px; border-radius: var(--radius); object-fit: cover; background: var(--raised); box-shadow: 0 20px 50px var(--shadow); } .hero-bg { position: absolute; inset: 0; z-index: -1; will-change: transform; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(48px) saturate(1.4); transform: scale(1.3); opacity: .55; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 0%, color-mix(in srgb, var(--bg) 55%, transparent) 55%, var(--bg) 100%); }
.hero-in { display: flex; gap: 28px; align-items: flex-end; }
.hero .art { width: 220px; height: 220px; flex: none; border-radius: 4px; object-fit: cover; background: var(--raised); box-shadow: 0 16px 40px #000a; }
.hero .meta { min-width: 0; } .hero .meta { min-width: 0; }
.hero .kind { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; } .hero h1 { font-size: clamp(32px, 4.6vw, 64px); line-height: 1.05; font-weight: 900; margin: 6px 0 12px; overflow-wrap: anywhere;
.actions { display: flex; gap: 10px; margin-top: 16px; } display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.btn { background: var(--raised); border-radius: 999px; padding: 9px 18px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; } .hero .sub { color: var(--text); opacity: .8; }
.hero .sub a:hover { text-decoration: underline; }
.hero .kind { color: var(--text); opacity: .75; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.actions { display: flex; gap: 14px; align-items: center; margin: 4px 0 6px; padding: 14px 0; }
.bigplay { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 22px;
box-shadow: 0 6px 18px #0006; transition: transform .1s, filter .15s; }
.bigplay svg { margin-left: 3px; }
.bigplay:hover { transform: scale(1.05); filter: brightness(1.1); }
.ibtn { color: var(--muted); font-size: 22px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.ibtn:hover { color: var(--text); }
.btn { background: var(--raised); border-radius: 4px; padding: 8px 16px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); } .btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.12); } .btn:hover { filter: brightness(1.12); }
.tracks { width: 100%; border-collapse: collapse; } .tracks { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.tracks tr { border-radius: 8px; } .tracks th { position: sticky; top: -24px; z-index: 1; background: var(--bg); padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left;
.tracks td { padding: 8px 10px; border-bottom: 1px solid var(--hover); white-space: nowrap; } font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tracks tr:hover td { background: var(--panel); } .tracks th svg { width: 14px; height: 14px; margin-left: auto; }
.tracks tr.playing td { color: var(--accent); } .tracks td { padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 52px; }
.tracks .n { width: 36px; color: var(--muted); text-align: right; } .tracks tbody tr:hover td { background: var(--hover); }
.tracks .ti { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; } .tracks td:first-child { border-radius: 4px 0 0 4px; }
.tracks .ti small { color: var(--muted); margin-left: 8px; } .tracks td:last-child { border-radius: 0 4px 4px 0; }
.tracks .d { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; } .tracks tr.playing .tt, .tracks tr.playing .n { color: var(--accent); }
.tracks .n { width: 48px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tracks .ti .tt { overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 500; }
.tracks .ti small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.tracks .al { width: 32%; color: var(--muted); }
.tracks .d { width: 64px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tracks tr { cursor: default; } .tracks tr { cursor: default; }
.tracks .off { color: var(--accent); width: 20px; padding: 0 2px; font-size: 13px; } .tracks .off { color: var(--accent); width: 24px; padding: 0 2px; font-size: 13px; }
.tracks .acts { width: 1px; padding: 0 4px; } .tracks .acts { width: 64px; padding: 0 4px; text-align: right; }
.tracks .acts button { opacity: 0; color: var(--muted); font-size: 18px; width: 26px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center; vertical-align: middle; } .tracks .acts button { opacity: 0; color: var(--muted); font-size: 18px; width: 26px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center; vertical-align: middle; }
.tracks tr:hover .acts button { opacity: 1; } .tracks tr:hover .acts button { opacity: 1; }
.tracks .acts button:hover { color: var(--text); background: var(--raised); } .tracks .acts button:hover { color: var(--text); background: var(--raised); }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--muted); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 8px; vertical-align: 1px; } .tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--muted); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 8px; vertical-align: 1px; }
.tag.stems { color: var(--accent); } .tag.nostems { color: var(--muted); opacity: .8; }
body.stems-ready .card.nostem .t::after { content: "NO STEMS"; font-size: 9px; font-weight: 700; letter-spacing: .05em; color: var(--muted); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }
.tag.queued { color: var(--muted); } .tag.queued { color: var(--muted); }
.tag.stemming { color: var(--accent); animation: pulse 1.4s ease-in-out infinite; } .tag.stemming { color: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.tag.failed { color: #e5534b; } .tag.failed { color: #e5534b; }
@@ -96,16 +145,16 @@ select, textarea, input[type=text], input[type=url], input[type=password] { back
.link { color: var(--accent); cursor: pointer; } .link { color: var(--accent); cursor: pointer; }
.btn.small { padding: 5px 12px; font-size: 13px; } .btn.small { padding: 5px 12px; font-size: 13px; }
.btn.icon { padding: 9px 12px; } .btn.icon { padding: 9px 12px; }
.hero .ph { width: 210px; height: 210px; border-radius: var(--radius); background: var(--raised); flex: none; } .hero .ph { width: 220px; height: 220px; border-radius: 4px; background: var(--raised); flex: none; }
.hero .round { border-radius: 50%; } .hero .round { border-radius: 50%; }
/* Stems-only filter hides rows and cards without stems. */ /* Stems-only filter hides rows and cards without stems. */
body.stems-only .tracks tr.nostem, body.stems-only .card.nostem { display: none; } body.stems-only .tracks tr.nostem, body.stems-only .card.nostem { display: none; }
.only-stems { display: none; } .only-stems { display: none; }
body.stems-only .tracks:not(:has(tr:not(.nostem))) + .only-stems { display: block; } body.stems-only .tracks:not(:has(tbody tr:not(.nostem))) + .only-stems { display: block; }
.only-nostems { display: none; } .only-nostems { display: none; }
body.no-stems .tracks tr:not(.nostem) { display: none; } body.no-stems .tracks tbody tr:not(.nostem) { display: none; }
body.no-stems .tracks:not(:has(tr.nostem)) ~ .only-nostems { display: block; } body.no-stems .tracks:not(:has(tbody tr.nostem)) ~ .only-nostems { display: block; }
.seg.stemfilter { display: inline-flex; } .seg.stemfilter { display: inline-flex; }
.seg.stemfilter button { padding: 5px 10px; white-space: nowrap; } .seg.stemfilter button { padding: 5px 10px; white-space: nowrap; }
@@ -133,27 +182,86 @@ body.no-stems .tracks:not(:has(tr.nostem)) ~ .only-nostems { display: block; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; } .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.check { display: flex !important; gap: 8px; align-items: center; color: var(--text) !important; font-size: 14px !important; } .check { display: flex !important; gap: 8px; align-items: center; color: var(--text) !important; font-size: 14px !important; }
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; color: var(--text); } textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; color: var(--text); }
.settings { display: grid; grid-template-columns: 150px 1fr; gap: 32px; align-items: start; } .settings { display: grid; grid-template-columns: 168px minmax(0, 680px); gap: 40px; align-items: start; }
.toc { position: sticky; top: 0; display: grid; gap: 2px; } .settings h1 { margin-bottom: 18px; }
.toc a { padding: 6px 10px; border-radius: 8px; color: var(--muted); } .toc { position: sticky; top: 0; display: grid; gap: 2px; padding-top: 52px; }
.toc a { position: relative; padding: 7px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 13px; transition: color .12s, background-color .12s; }
.toc a:hover { color: var(--text); background: var(--hover); } .toc a:hover { color: var(--text); background: var(--hover); }
.panes section { max-width: 640px; padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); scroll-margin-top: 10px; } .toc a.on { color: var(--text); background: var(--raised); }
.panes section h2 { margin-top: 0; } .toc a.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.srv { padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); } .panes section { scroll-margin-top: 8px; margin-bottom: 34px; }
.srv .row { margin: 0; } .panes section h2 { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.secs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; } .sgh { margin: 18px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
details summary { cursor: pointer; margin: 12px 0; } .sg { display: block; margin-bottom: 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; } .sr { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 52px; padding: 10px 16px; text-align: left; }
.swatch { border: 1px solid; border-radius: 10px; padding: 10px; text-align: left; font-weight: 600; display: flex; gap: 8px; align-items: center; } .sr + .sr { border-top: 1px solid var(--line); }
label.sr { cursor: pointer; }
.sl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.sl > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sl small, .libs small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; max-width: 62%; }
.sc input[type=url], .sc input[type=password], .sc select { width: 260px; max-width: 100%; height: 32px; border-radius: 6px; }
.sc input[type=range] { width: 160px; }
.sc input[type=number]#precachen { width: 56px; height: 32px; border-radius: 6px; }
.sr.col { flex-direction: column; align-items: stretch; gap: 12px; }
.sr.end { justify-content: flex-end; }
.sg .val { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.sg .val svg { width: 15px; height: 15px; fill: currentColor; }
.val.num { min-width: 48px; justify-content: flex-end; }
.dim { color: var(--muted); }
.sr.act { justify-content: flex-start; color: var(--accent); font-weight: 500; font-size: 14px; transition: background-color .12s; }
.sr.act:not(:disabled):hover { background: var(--hover); }
.sr.act.bad { color: #ff453a; }
.ibs { gap: 2px; }
.ib { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); transition: color .12s, background-color .12s; }
.ib svg { width: 16px; height: 16px; fill: currentColor; }
.ib:not(:disabled):hover { color: var(--text); background: var(--hover); }
.ib.on { color: var(--accent); }
.ib.bad:not(:disabled):hover { color: #ff453a; }
.sw { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 40px; height: 24px; margin: 0; border-radius: 12px; cursor: pointer;
background: color-mix(in srgb, var(--text) 18%, transparent); transition: background-color .18s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.sw:checked { background: var(--accent); }
.sw:checked::after { transform: translateX(16px); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.stat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; }
.stat.ok::before { background: #30d158; opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, #30d158 22%, transparent); }
.stat.bad::before { background: #ff453a; opacity: 1; }
.sr.srv { flex-wrap: wrap; }
.libs { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.lib { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 13px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted);
background: var(--raised); transition: color .12s, background-color .12s; }
.lib input { display: none; }
.lib:has(:checked) { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--raised)); }
details.sg > summary { list-style: none; cursor: pointer; }
details.sg > summary::-webkit-details-marker { display: none; }
.chev svg { width: 18px; height: 18px; fill: var(--muted); transition: transform .2s; }
details[open] .chev svg { transform: rotate(180deg); }
.sg textarea { min-height: 120px; border-radius: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--muted); line-height: 1.6; }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 5px; font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
color: var(--text); background: var(--raised); box-shadow: inset 0 -1px 0 var(--line), 0 0 0 1px var(--line); }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.keys > div { display: flex; align-items: center; gap: 4px; min-height: 42px; padding: 8px 16px; font-size: 13px; border-top: 1px solid var(--line); margin-top: -1px; }
.keys > div > span { flex: 1; color: var(--muted); }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.swatch { border: 1px solid; border-radius: 8px; padding: 10px 12px; text-align: left; font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; transition: transform .12s; }
.swatch:hover { transform: translateY(-1px); }
.swatch i { width: 12px; height: 12px; border-radius: 50%; flex: none; } .swatch i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; } .swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; } input[type=color] { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }
.note { color: var(--muted); font-size: 13px; } .note { color: var(--muted); font-size: 13px; }
#drawer { width: 340px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 20px; } #drawer { width: 320px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 20px; }
#drawer h2 { margin: 0 0 14px; } #drawer h2 { margin: 0 0 14px; }
#drawer { display: flex; flex-direction: column; padding-top: 12px; } #drawer { display: flex; flex-direction: column; padding-top: 12px; }
#drawer[hidden] { display: none; } #drawer[hidden] { display: none; }
#drawer.mixing { width: 340px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; position: sticky; top: -12px; background: var(--panel); padding: 6px 0; z-index: 1; } .tabs { display: flex; gap: 4px; margin-bottom: 16px; position: sticky; top: -12px; background: var(--panel); padding: 6px 0; z-index: 1; }
.tabs button { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; } .tabs button { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--raised); color: var(--text); } .tabs button.on { background: var(--raised); color: var(--text); }
@@ -164,7 +272,17 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
.seg button { flex: 1; padding: 5px 4px; border-radius: 6px; font-size: 12px; color: var(--muted); } .seg button { flex: 1; padding: 5px 4px; border-radius: 6px; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); } .seg button.on { background: var(--accent); color: var(--accent-ink); }
.kara label { display: grid; gap: 4px; } .kara label { display: grid; gap: 4px; }
.mixrow { margin-top: 16px; } .mixacts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 18px; }
.mixacts:has(.ic) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) 36px; }
.mact { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; min-width: 0; padding: 0 8px; border-radius: 8px;
background: var(--raised); color: var(--text); font-size: 13px; font-weight: 600; transition: background-color .12s, color .12s, transform .08s; }
.mact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mact svg { width: 17px; height: 17px; flex: none; fill: currentColor; }
.mact:hover { background: var(--hover); }
.mact:active { transform: scale(.97); }
.mact.on { background: color-mix(in srgb, var(--accent) 18%, var(--raised)); color: var(--accent); }
.mact.ic { padding: 0; color: var(--muted); }
.mact.ic:hover { color: #ff453a; }
#lyr.synced p { margin: 0; padding: 7px 4px; font-size: 19px; font-weight: 700; line-height: 1.3; color: var(--muted); opacity: .55; cursor: pointer; transition: opacity .2s, color .2s; } #lyr.synced p { margin: 0; padding: 7px 4px; font-size: 19px; font-weight: 700; line-height: 1.3; color: var(--muted); opacity: .55; cursor: pointer; transition: opacity .2s, color .2s; }
#lyr.synced p:hover { opacity: .85; } #lyr.synced p:hover { opacity: .85; }
#lyr.synced p.on { color: var(--text); opacity: 1; } #lyr.synced p.on { color: var(--text); opacity: 1; }
@@ -175,13 +293,31 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
.chip { background: var(--raised); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; } .chip { background: var(--raised); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; }
.chip.on { background: var(--accent); color: var(--accent-ink); } .chip.on { background: var(--accent); color: var(--accent-ink); }
.chip:disabled { opacity: .35; cursor: default; } .chip:disabled { opacity: .35; cursor: default; }
.stem { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 6px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); } .strips { display: flex; gap: 8px; justify-content: center; margin: 4px 0 6px; --fh: clamp(170px, calc(100vh - var(--player-h) - 470px), 320px); }
.stem .name { text-transform: capitalize; font-weight: 600; } .stem { --c: #8e8e93; flex: 1 1 0; min-width: 0; max-width: 58px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.stem.silent .name { color: var(--muted); } .stem .pct { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.stem input { grid-column: 1 / -1; width: 100%; } .stem .name { text-align: center; text-transform: capitalize; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms { width: 30px; height: 26px; border-radius: 6px; background: var(--raised); font-size: 12px; font-weight: 700; color: var(--muted); } .fader { position: relative; height: var(--fh); border-radius: 12px; overflow: hidden; cursor: ns-resize; touch-action: none; user-select: none; -webkit-user-select: none; outline: none;
.ms.on { background: var(--text); color: var(--bg); } background: color-mix(in srgb, var(--c) 9%, var(--raised)); contain: strict; }
.ms.solo.on { background: var(--accent); color: var(--accent-ink); } .fader i { position: absolute; display: block; pointer-events: none; }
.fader .lvl, .fader .mtr { inset: 0; transform-origin: bottom; will-change: transform; }
.fader .lvl { transform: scaleY(var(--v)); background: linear-gradient(to top, color-mix(in srgb, var(--c) 30%, transparent), color-mix(in srgb, var(--c) 46%, transparent)); }
.fader .mtr { transform: scaleY(0); background: linear-gradient(to top, color-mix(in srgb, var(--c) 82%, #000), var(--c)); }
.fader .cap { left: 0; right: 0; top: 4px; bottom: 4px; transform: translateY(calc((1 - var(--v)) * 100%)); will-change: transform; }
.fader .cap b { position: absolute; left: 6px; right: 6px; top: -3px; height: 6px; border-radius: 3px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); transition: transform .1s; }
.fader:hover .cap b, .fader.drag .cap b { transform: scaleY(1.35); }
.fader:focus-visible { box-shadow: inset 0 0 0 2px var(--c); }
.stem.silent .fader, .stem.silent .name { opacity: .4; }
.stem.silent .mtr { visibility: hidden; }
.msrow { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.ms { height: 26px; min-width: 0; border-radius: 6px; background: var(--raised); font-size: 11px; font-weight: 800; color: var(--muted);
transition: transform .08s, background-color .12s, color .12s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.ms:hover { color: var(--text); }
.ms:active { transform: scale(.88); }
.ms.mute.on { background: #ff453a; color: #fff; }
.ms.solo.on { background: #ffcc00; color: #1a1400; }
.chip, .pill, .seg button, .transport button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.chip:active:not(:disabled), .pill:active { transform: scale(.94); }
.q-item { display: flex; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 8px; cursor: pointer; } .q-item { display: flex; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
.q-item:hover { background: var(--raised); } .q-item:hover { background: var(--raised); }
.q-item img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; background: var(--raised); flex: none; } .q-item img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; background: var(--raised); flex: none; }
@@ -194,30 +330,42 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
.q-item .x { color: var(--muted); font-size: 18px; padding: 0 4px; opacity: 0; } .q-item .x { color: var(--muted); font-size: 18px; padding: 0 4px; opacity: 0; }
.q-item:hover .x { opacity: 1; } .q-item:hover .x { opacity: 1; }
#player { position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h); background: var(--glass); backdrop-filter: blur(20px); body, #nav, #player, .sg { transition: background-color .5s; }
border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(180px, 1fr) minmax(320px, 1.6fr) minmax(180px, 1fr); align-items: center; gap: 20px; padding: 0 20px; } #player { position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h); background: var(--bg);
#player.empty .center, #player.empty .right { opacity: .35; pointer-events: none; } border-top: 1px solid rgba(50, 50, 50, .7); display: grid; grid-template-columns: minmax(180px, 1fr) minmax(320px, 1.6fr) minmax(180px, 1fr); align-items: center; gap: 20px; padding: 0 20px; }
#player.empty .center, #player.empty .right, #player.empty #b-art { opacity: .35; pointer-events: none; }
.left { display: flex; align-items: center; gap: 10px; min-width: 0; }
#b-art { position: relative; flex: none; width: 60px; height: 60px; padding: 0; border-radius: 4px; overflow: hidden; }
#b-art[hidden] { display: none; }
#b-art .exp { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .7);
opacity: 0; transform: scale(.85); transition: opacity .15s, transform .15s; }
#b-art .exp svg { width: 15px; height: 15px; fill: #fff; }
#b-art:hover .exp, #b-art:focus-visible .exp { opacity: 1; transform: none; }
#player.sideart #b-art { display: none; }
.np { display: flex; gap: 12px; align-items: center; min-width: 0; } .np { display: flex; gap: 12px; align-items: center; min-width: 0; }
#np-art { width: 58px; height: 58px; border-radius: 8px; object-fit: cover; background: var(--raised); flex: none; } #np-art { width: 60px; height: 60px; border-radius: 4px; object-fit: cover; background: var(--raised); flex: none; }
#np-art:not([src]) { display: none; } #np-art:not([src]) { display: none; }
.np-text { min-width: 0; } .np-text { min-width: 0; }
#np-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #np-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#np-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #np-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { display: grid; gap: 4px; } .center { display: grid; gap: 10px; }
.transport { display: flex; justify-content: center; align-items: center; gap: 18px; font-size: 20px; } .transport { display: flex; justify-content: center; align-items: center; gap: 20px; font-size: 18px; }
.transport button { color: var(--text); } .transport button { color: #c5c5c5; }
.transport button:hover { color: #fff; }
.transport .side { color: var(--muted); font-size: 17px; position: relative; } .transport .side { color: var(--muted); font-size: 17px; position: relative; }
.transport .side.on { color: var(--accent); } .transport .side.on { color: var(--accent); }
.transport .side.on::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; } .transport .side.on::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.transport .play { width: 40px; height: 40px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 18px; } .transport .play { width: 36px; height: 36px; border-radius: 50%; background: var(--text); color: var(--bg) !important; display: grid; place-items: center; font-size: 16px; transition: transform .1s; }
.transport .play:hover { transform: scale(1.06); }
.transport .play.busy svg { animation: spin 1s linear infinite; } .transport .play.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } } @keyframes spin { to { transform: rotate(360deg); } }
.seek { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; } .seek { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek span:last-child { text-align: right; } .seek span:last-child { text-align: right; }
#wave { width: 100%; height: 32px; cursor: pointer; display: block; } #wave { width: 100%; height: 32px; cursor: pointer; display: block; }
.right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; } .right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.pill { color: var(--muted); font-size: 18px; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; } .pill { color: #c5c5c5; font-size: 18px; width: 34px; height: 34px; border-radius: 4px; display: grid; place-items: center; }
.pill.on { background: var(--raised); color: var(--accent); } .pill:hover { color: #fff; }
.pill.on { color: var(--accent); }
.pill { position: relative; } .pill { position: relative; }
.pill.dot::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); } .pill.dot::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.np { cursor: pointer; } .np { cursor: pointer; }
@@ -227,26 +375,40 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
input[type=range] { accent-color: var(--accent); } input[type=range] { accent-color: var(--accent); }
@media (max-width: 860px) { @media (max-width: 860px) {
:root { --player-h: 150px; } :root { --player-h: 162px; }
#app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } #app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
#nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; } #nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; }
.brand { padding: 0 8px 0 4px; } .brand { padding: 0 8px 0 4px; }
#nav a { white-space: nowrap; } #nav a { white-space: nowrap; overflow: visible; }
#nav a svg, #sideart, #b-art .exp { display: none !important; }
#nav { overflow-y: hidden; }
#nav a { min-height: 32px; }
#search input { margin: 0; width: 120px; } #search input { margin: 0; width: 120px; }
#live { margin: 0; white-space: nowrap; } #live { margin: 0; white-space: nowrap; }
.settings { grid-template-columns: 1fr; } .settings { grid-template-columns: 1fr; gap: 0; }
.toc { position: static; display: flex; flex-wrap: wrap; } .toc { display: none; }
.sr:not(.col) { flex-wrap: wrap; gap: 8px 16px; }
.sc { max-width: 100%; }
.sc input[type=url], .sc input[type=password], .sc select { width: 100%; }
.sr:has(input[type=url], input[type=password], select, input[type=range]) .sc { flex: 1 1 100%; }
.tracks .acts button { opacity: 1; } .tracks .acts button { opacity: 1; }
.tracks .ti small { display: block; margin-left: 0; } .tracks .al, .tracks .off { display: none; }
.tracks .n { width: 34px; }
.tracks th { top: -20px; }
.settings-link { margin-top: 0; } .settings-link { margin-top: 0; }
#view { padding: 20px 16px 40px; } #view { padding: 20px 16px 40px; }
#drawer { position: fixed; inset: auto 0 var(--player-h) 0; width: auto; max-height: 60vh; border-left: 0; border-top: 1px solid var(--line); z-index: 5; } #drawer, #drawer.mixing { position: fixed; inset: auto 0 var(--player-h) 0; width: auto; max-height: 60vh; border-left: 0; border-top: 1px solid var(--line); z-index: 5; }
#player { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); } #player { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.center { grid-column: 1 / -1; grid-row: 2; } .center { grid-column: 1 / -1; grid-row: 2; }
.right #volume { display: none; } .right #volume { display: none; }
.hero { flex-direction: column; align-items: flex-start; } .hero { margin: -20px -16px 0; padding: 32px 16px 20px; }
.hero img { width: 160px; height: 160px; } .hero-in { flex-direction: column; align-items: flex-start; gap: 18px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px 12px; } .hero .art, .hero .ph { width: 160px; height: 160px; }
.cplay { opacity: 1; transform: none; width: 36px; height: 36px; font-size: 14px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.card { padding: 6px; }
.strips { --fh: clamp(140px, 24vh, 220px); }
.stem { max-width: 64px; }
} }
/* presets */ /* presets */
@@ -260,7 +422,7 @@ input[type=range] { accent-color: var(--accent); }
.prow .btn.on { background: var(--accent); color: var(--accent-ink); } .prow .btn.on { background: var(--accent); color: var(--accent-ink); }
/* home */ /* home */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 16px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; } .shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 170px; gap: 4px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }
.shelf.two { grid-template-rows: auto auto; } .shelf.two { grid-template-rows: auto auto; }
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; } .stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.station { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 16px; border-radius: 12px; background: var(--raised); } .station { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 16px; border-radius: 12px; background: var(--raised); }
@@ -283,3 +445,15 @@ input[type=number]#precachen { width: 64px; background: var(--raised); border: 1
/* about */ /* about */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; } .people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
.person { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; background: var(--raised); } .person { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; background: var(--raised); }
/* toolbar shares its row with the filter/sort bar on wide screens */
@media (min-width: 861px) {
.actions + .bar.sm { margin: -66px 0 12px auto; min-height: 52px; pointer-events: none; }
.actions + .bar.sm > * { pointer-events: auto; }
}
#volume { -webkit-appearance: none; appearance: none; height: 16px; background: none; cursor: pointer; }
#volume::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #3c3f43; }
#volume::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: #e7e7e7; border: 0; }
#volume::-moz-range-track { height: 4px; border-radius: 2px; background: #3c3f43; }
#volume::-moz-range-progress { height: 4px; border-radius: 2px; background: #cccccc; }
#volume::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #e7e7e7; border: 0; }
+6
View File
@@ -33,6 +33,12 @@ export function toast(msg, ms = 2400) {
} }
export const ICON = { export const ICON = {
save: '<svg viewBox="0 0 24 24"><path d="M6 3h10l4 4v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm0 2v14h12V7.8L15.2 5H15v4H7V5H6zm3 0v2h4V5H9zm3 7a3 3 0 1 1 0 6 3 3 0 0 1 0-6z"/></svg>',
check: '<svg viewBox="0 0 24 24"><path d="M9.5 16.2L5.3 12l-1.4 1.4 5.6 5.6L20.1 8.4 18.7 7z"/></svg>',
pladd: '<svg viewBox="0 0 24 24"><path d="M3 5h13v2H3zm0 5h13v2H3zm0 5h8v2H3zm15-2h2v3h3v2h-3v3h-2v-3h-3v-2h3z"/></svg>',
up: '<svg viewBox="0 0 24 24"><path d="M12 7.6l7.7 7.7-1.4 1.4-6.3-6.3-6.3 6.3-1.4-1.4z"/></svg>',
down: '<svg viewBox="0 0 24 24"><path d="M12 16.4L4.3 8.7l1.4-1.4 6.3 6.3 6.3-6.3 1.4 1.4z"/></svg>',
x: '<svg viewBox="0 0 24 24"><path d="M6.4 5L12 10.6 17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6L6.4 19 5 17.6 10.6 12 5 6.4z"/></svg>',
lock: '<svg viewBox="0 0 24 24"><path d="M7 10V7a5 5 0 0 1 10 0v3h.5A1.5 1.5 0 0 1 19 11.5v8a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 5 19.5v-8A1.5 1.5 0 0 1 6.5 10H7zm2 0h6V7a3 3 0 0 0-6 0v3z"/></svg>', lock: '<svg viewBox="0 0 24 24"><path d="M7 10V7a5 5 0 0 1 10 0v3h.5A1.5 1.5 0 0 1 19 11.5v8a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 5 19.5v-8A1.5 1.5 0 0 1 6.5 10H7zm2 0h6V7a3 3 0 0 0-6 0v3z"/></svg>',
play: '<svg viewBox="0 0 24 24"><path d="M7 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L8.5 3.64A1 1 0 0 0 7 4.5z"/></svg>', play: '<svg viewBox="0 0 24 24"><path d="M7 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L8.5 3.64A1 1 0 0 0 7 4.5z"/></svg>',
pause: '<svg viewBox="0 0 24 24"><rect x="5.5" y="4" width="4.5" height="16" rx="1.2"/><rect x="14" y="4" width="4.5" height="16" rx="1.2"/></svg>', pause: '<svg viewBox="0 0 24 24"><rect x="5.5" y="4" width="4.5" height="16" rx="1.2"/><rect x="14" y="4" width="4.5" height="16" rx="1.2"/></svg>',