Compare commits

...
24 changed files with 132 additions and 147 deletions

No files matched your search

+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
over a Plexamp-style waveform seek bar, a 10-band graphic EQ plus Equalizer APO-style
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
@@ -48,7 +48,7 @@ import java.io.IOException
import java.util.concurrent.CopyOnWriteArrayList
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 {
val ORDER = listOf("vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix")
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
fun SettingsIcon(vector: ImageVector, bg: Color) {
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
* 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
fun EqCurve(
@@ -102,8 +102,8 @@ import kotlin.math.min
enum class NpPanel { Art, Mixer, Queue }
/**
* A solid colour from the album art, pushed dark (or light for the White theme) so text
* stays readable. One flat colour: no gradients.
* A solid color from the album art, pushed dark (or light for the White theme) so text
* stays readable. One flat color: no gradients.
*/
@Composable
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 {
Cell("Album Colour Background", trailing = { IosSwitch(albumColor, { s.albumColorNowPlaying.value = it }) })
section("np", header = "Now Playing", footer = "Paints the Now Playing screen in one solid color taken from the album art.", rows = listOf {
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 kotlin.math.exp
/** iOS semantic colours, flattened to solid values for each scheme. */
/** iOS semantic colors, flattened to solid values for each scheme. */
@Immutable
data class Palette(
val dark: Boolean,
@@ -130,7 +130,7 @@ fun IosTheme(mode: ThemeMode, accent: Accent, content: @Composable () -> Unit) {
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
fun Txt(
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.
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
@@ -15,7 +15,7 @@ RED = "#D13438"
ORANGE = "#E8912D"
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 = {
"play": f'<path fill="{GREEN}" d="M9 5v22l18-11z"/>',
"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.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"]
COLORS = {
"vocals": "#FF7AB6", "drums": "#FFB547", "bass": "#7C8CFF", "other": "#4CD07D",
+1 -1
View File
@@ -93,7 +93,7 @@ class IconProvider(QQuickImageProvider):
BG = _hex("1D1E21")
GLASS_TINT = _hex("242529")
# (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 = [
(_hex("3BA8FF"), 0.10, 0.05, 0.30, 0.14),
(_hex("7C8CFF"), 0.62, 0.18, 0.22, 0.06),
+1 -1
View File
@@ -50,7 +50,7 @@ final class HomeReach: @unchecked Sendable {
let (at, last) = stamp.with { (checkedAt, _last) }
if at != 0 && now - at < Self.ttl { return last }
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
for u in urls { g.addTask { await self.answers(u) } }
for await r in g where r { g.cancelAll(); return true }
+3 -2
View File
@@ -107,7 +107,7 @@ final class Settings: @unchecked Sendable {
private static let keys = [
"servers", "plexUrl", "plexToken", "plexUser", "plexMachineId", "musicSection", "musicSectionTitle",
"stemUrl", "stemToken", "plexAccountToken", "stemRoots", "theme", "accent", "albumTheme", "albumColorNowPlaying", "highRefreshRate",
"stemUrl", "stemToken", "stemServerOff", "plexAccountToken", "stemRoots", "theme", "accent", "albumTheme", "highRefreshRate",
"stemQuality", "cacheLimitGb", "downloadsWifiOnly", "downloadSort", "keepStemMix", "masterVolume", "tabLayout",
"karaokeVocals", "karaokeSoftDb", "playbackSpeed", "stemsOnly", "noStems", "precacheCount", "hiddenNowPlaying", "presets", "presetOrder", "hiddenPresets", "lockedPreset", "webStations", "lockScreenMix", "swipeUpQueue", "acapella", "crossfadeSec", "sweetFades", "foldedArtLeft",
]
@@ -205,6 +205,8 @@ final class Settings: @unchecked Sendable {
/// 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() : "" }
/// 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 stemToken: String { get { read(\.stemToken, "stemToken", "") } set { write(\.stemToken, "stemToken", newValue, "") } }
var plexAccountToken: String { get { read(\.plexAccountToken, "plexAccountToken", "") } set { write(\.plexAccountToken, "plexAccountToken", newValue, "") } }
@@ -221,7 +223,6 @@ final class Settings: @unchecked Sendable {
var lockScreenMix: Bool { get { read(\.lockScreenMix, "lockScreenMix", false) } set { write(\.lockScreenMix, "lockScreenMix", 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) } }
var albumColorNowPlaying: Bool { get { read(\.albumColorNowPlaying, "albumColorNowPlaying", false) } set { write(\.albumColorNowPlaying, "albumColorNowPlaying", 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) } }
+1 -1
View File
@@ -1,7 +1,7 @@
import AVFoundation
import Foundation
/// Display order and colours for stems, matching the desktop app.
/// Display order and colors for stems, matching the desktop app.
enum Stems {
static let order = ["vocals", "drums", "bass", "guitar", "piano", "other", "instrumental", "mix"]
private static let colors: [String: UInt32] = [
+15 -2
View File
@@ -5,6 +5,7 @@ enum StemServerStatus: Equatable {
case unknown
case online(tracks: Int, transcode: Bool)
case offline(reason: String, cachedTracks: Int)
case off
var isOnline: Bool { if case .online = self { true } else { false } }
}
@@ -65,7 +66,8 @@ final class StemServer: @unchecked Sendable {
self.settings = settings
indexFile = dir.appendingPathComponent("stem_index.json")
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) {
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.
func pollQueue() async {
guard !base.isEmpty,
guard !settings.stemServerOff, !base.isEmpty,
let u = try? url("/api/queue"),
let data = try? await http.data(req(u)),
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 {
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 {
let info = try JSONDecoder().decode(ServerInfo.self, from: try await http.data(req(try url("/api/info"))))
transcode = info.ffmpeg
@@ -185,6 +197,7 @@ final class StemServer: @unchecked Sendable {
}
func find(_ track: Track) -> StemEntry? {
if settings.stemServerOff { return nil }
let idx = index
if let k = track.stemKey { return idx.entries.first { $0.key == k } }
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 {
let symbol: String
let bg: UInt32
+3
View File
@@ -195,6 +195,7 @@ private struct DuoPane<Content: View>: View {
@ViewBuilder var content: Content
@Environment(Ui.self) private var ui
@AppStorage("duoSwap") private var swap = false
@Environment(\.palette) private var p
private var g: AppGraph { .shared }
var body: some View {
@@ -221,6 +222,8 @@ private struct DuoPane<Content: View>: View {
// Right-to-left lays the same two children out mirrored, so swapping doesn't rebuild either.
.environment(\.layoutDirection, flip ? .rightToLeft : .leftToRight)
.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)
.onChange(of: cut != nil, initial: true) { _, on in ui.setSplit(on) }
}
+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
/// 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 {
let chain: [EqFilter]
let preampDb: Float
+25 -78
View File
@@ -15,23 +15,6 @@ 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.
func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
let n = 24
@@ -44,7 +27,7 @@ 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)
var h: CGFloat = 0, s: CGFloat = 0, v: CGFloat = 0, a: CGFloat = 0
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)
all.append((h, s, v, score))
}
@@ -58,32 +41,6 @@ func vibrant(_ cg: CGImage) -> (CGFloat, CGFloat, CGFloat)? {
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 ----------------------------------------------------------------------------
/// Full screen, Now Playing owns the window's color scheme. Docked beside the library it only
@@ -105,7 +62,6 @@ struct NowPlayingScreen: View {
@Environment(\.palette) private var base
@Environment(\.dismiss) private var dismiss
@State private var panel = NpPanel.Art
@State private var tint: Color?
/// How far the screen is being dragged down to close it.
@State private var drop: CGFloat = 0
/// Docked beside the hinge the pane is narrow, so the controls pack tighter. Full screen
@@ -124,7 +80,7 @@ struct NowPlayingScreen: View {
var body: some View {
let pm = g.playback
let c = tint.map { base.tinted($0) } ?? base
let c = base
let track = pm.current?.track
// 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.
@@ -190,13 +146,8 @@ struct NowPlayingScreen: View {
.environment(\.palette, c)
.modifier(NpScheme(dark: c.dark, docked: docked))
.tint(c.label)
.animation(.easeInOut(duration: 0.3), value: tint)
.presentationBackground(.clear)
.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
@@ -219,7 +170,7 @@ struct NowPlayingScreen: View {
// Folded, the controls keep the tight stems-panel spacing on every panel, so the art gets the room.
let snug = folded
let pm = g.playback
let c = tint.map { base.tinted($0) } ?? base
let c = base
let pad: CGFloat = wide && tight ? 14 : hPad
// Full-size transport needs 312 pt; below that the buttons shrink to fit.
let narrow = width - 2 * pad < 312
@@ -856,7 +807,7 @@ extension MixerPanel {
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 {
let text: String
var icon: String? = nil
@@ -972,7 +923,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.
struct FaderSlider: View {
let value: Float
@@ -980,7 +931,7 @@ struct FaderSlider: View {
var detent: Float?
var enabled = true
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?
let onChange: (Float) -> Void
@@ -1000,8 +951,8 @@ struct FaderSlider: View {
let x = CGFloat(min(max(value, 0), 1)) * track
ZStack(alignment: .leading) {
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
// runs over it in the full colour, so the two never blend.
// 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 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)
if let meter, meter > 0.01 {
Capsule().fill(fill).frame(width: meter * (x + thumb / 2), height: bar)
@@ -1044,11 +995,10 @@ struct NowPlayingDeck: View {
@Environment(Ui.self) private var ui
@Environment(\.palette) private var base
@AppStorage("duoSwap") private var swap = false
@State private var tint: Color?
private var g: AppGraph { .shared }
var body: some View {
let c = tint.map { base.tinted($0) } ?? base
let c = base
let track = g.playback.current?.track
GeometryReader { _ in
if let track {
@@ -1076,12 +1026,7 @@ struct NowPlayingDeck: View {
.environment(\.palette, c)
.modifier(NpScheme(dark: c.dark, docked: true))
.tint(c.label)
.animation(.easeInOut(duration: 0.3), value: tint)
.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.
@@ -1233,7 +1178,7 @@ struct MiniPlayer: View {
.padding(.leading, 8).padding(.trailing, 6)
.frame(height: 60)
.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)
ZStack {
shape.fill(p.cell)
@@ -1322,22 +1267,24 @@ private struct LyricsPanel: View {
var body: some View {
VStack(spacing: 0) {
// Soft leaves the singer in quietly as a guide.
HStack(spacing: 12) {
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
if g.playback.source == .Stems && g.playback.stemNames.contains("vocals") {
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)
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) {
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
}
+14 -2
View File
@@ -159,11 +159,12 @@ struct StemPlaylistScreen: View {
}
.toolbar {
ToolbarItemGroup(placement: .topBarTrailing) {
if !editing { MoreMenu(items: moreItems(pl)) }
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 } }
if !editing { MoreMenu(items: moreItems(pl)) }
}
}
.modifier(SplitHidesTitle())
}
private func header(_ pl: StemPlaylist) -> some View {
@@ -267,14 +268,15 @@ struct PlaylistScreen: View {
}
.toolbar {
ToolbarItemGroup(placement: .topBarTrailing) {
if !editing { MoreMenu(items: moreItems(list)) }
if !playlist.smart && !list.isEmpty {
if saving { ProgressView() }
else if editing { Button("Done") { commit(list) }.bold() }
else { Button("Edit") { items = list; removed = []; editing = true } }
}
if !editing { MoreMenu(items: moreItems(list)) }
}
}
.modifier(SplitHidesTitle())
.task(id: reload) {
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) } }
}
}
}
+47 -38
View File
@@ -140,7 +140,7 @@ private func clean(_ url: String) -> String {
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 {
var scale: CGFloat = 1
var body: some View {
@@ -279,6 +279,7 @@ struct SettingsScreen: View {
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 .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"),
]
/// 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 {
let m: Maintainer
@Environment(\.palette) private var p
@@ -826,40 +827,51 @@ struct StemServerScreen: View {
let status = g.stems.status
List {
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)
}
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)
}
Toggle(isOn: Binding(get: { !g.settings.stemServerOff }, set: { on in
g.settings.stemServerOff = !on
Task { await g.stems.refresh(force: true) }
})) { Text("Use Stem Server").foregroundStyle(p.label) }
.tint(Color(hex: 0x34C759))
.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)
.themedList()
@@ -1031,13 +1043,10 @@ struct AppearanceScreen: View {
.themedRow()
}
Section {
Toggle(isOn: $s.albumColorNowPlaying) { Text("Album Colour Background").foregroundStyle(c.label) }
.tint(Color(hex: 0x34C759))
.themedRow()
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: "Album Colour paints the Now Playing screen in one solid colour taken from the album art. Left-Align moves the art to the left edge on the folded iPhone Duo.") }
} header: { Header(text: "Now Playing") } footer: { Footer(text: "Left-Align moves the art to the left edge on the folded iPhone Duo.") }
Section {
Toggle(isOn: $s.acapella) { Text("Spell It “Acapella”").foregroundStyle(c.label) }
.tint(Color(hex: 0x34C759))
+3 -3
View File
@@ -8,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 {
var dark: Bool
var bg: Color
@@ -60,7 +60,7 @@ extension View {
/// A list on the theme's background instead of the system one.
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)) }
}
@@ -103,7 +103,7 @@ func artHue(_ thumb: String?) async -> ArtHue? {
}
extension Palette {
/// The theme recoloured around the art's hue: lightly tinted surfaces and an accent in the art's colour.
/// 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
+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 {
let text: String
var icon = "chevron.right"
+1 -1
View File
@@ -9,7 +9,7 @@ settings:
# iOS needs a plain number for the bundle version; the label is what the app and releases show.
MARKETING_VERSION: "0.10.0"
VERSION_LABEL: "0.10.0"
CURRENT_PROJECT_VERSION: "41"
CURRENT_PROJECT_VERSION: "44"
# Dev builds override these (build-ipa.sh dev) so they install next to the release app.
APP_ID: org.cdnutter.stemify
APP_NAME: Stemify
+2 -2
View File
@@ -41,7 +41,7 @@ function artPalette([h, s0, v], base) {
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 colourful mid-bright pixels.
// 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);
@@ -287,7 +287,7 @@ 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>
${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 colours match the iOS app.
// 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) {