0.2.0: play through Spotify Soloist
All checks were successful
release / release (push) Successful in 10m37s
All checks were successful
release / release (push) Successful in 10m37s
Spotify refuses librespot the audio keys ("error audio key 0 1",
librespot #1649), so nothing played. Playback now goes through Spotify
Soloist, Spotify's own headless Linux player:
- The TV downloads it from Spotify (redistribution is not allowed), keeps
it fresh (builds expire after 90 days), runs and restarts it, and drives
it over its local WebSocket API; its events feed Most szól.
- It needs the user's own Soloist API key: the key screen shows a QR code
to a small page on the TV where the phone pastes it (or type it on the
TV); asked once after sign-in, also in Settings. Then the TV is picked
once in the phone's Spotify app (pairing); home shows that step.
- Soloist is the Connect device; librespot only signs in (pairing code)
and browses. Its player, Connect and zeroconf are gone, and with them
GStreamer.
- A track from a list plays and the next ones are queued (Soloist's play
takes one URI). The queue panel is back (Soloist reports the queue).
- Settings: the player's state and key instead of quality/normalisation/
autoplay (Soloist decides those).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
17
ui/app.slint
17
ui/app.slint
@@ -11,7 +11,7 @@ import { TvWindow, Tv, SfText, GlassRect, MenuItem } from "@sf-ui/sf-ui.slint";
|
||||
import { Line, Chip, Card, Check, QueueItem } from "types.slint";
|
||||
import { LinePage } from "page.slint";
|
||||
import { NowPlayingScreen } from "nowplaying.slint";
|
||||
import { ConnectScreen, InputScreen, MessageScreen } from "signin.slint";
|
||||
import { ConnectScreen, InputScreen, MessageScreen, KeyScreen } from "signin.slint";
|
||||
import { SelectOverlay, Toast } from "overlays.slint";
|
||||
|
||||
export { Tv, SfText, MenuItem, Line, Chip, Card, Check, QueueItem }
|
||||
@@ -20,7 +20,7 @@ export component App inherits TvWindow {
|
||||
title: "Spotify";
|
||||
forward-focus: keys;
|
||||
|
||||
// "message", "signin", "page", "nowplaying"
|
||||
// "message", "signin", "solokey", "page", "nowplaying"
|
||||
in property <string> screen: "message";
|
||||
// The key text (Slint's Key codes) and whether it repeats; true = handled.
|
||||
callback key(string, bool) -> bool;
|
||||
@@ -29,6 +29,8 @@ export component App inherits TvWindow {
|
||||
animate message-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
||||
out property <float> signin-t: self.screen == "signin" ? 1 : 0;
|
||||
animate signin-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
||||
out property <float> solokey-t: self.screen == "solokey" ? 1 : 0;
|
||||
animate solokey-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
||||
out property <float> page-t: self.screen == "page" ? 1 : 0;
|
||||
animate page-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); }
|
||||
out property <float> np-t: self.screen == "nowplaying" ? 1 : 0;
|
||||
@@ -79,6 +81,14 @@ export component App inherits TvWindow {
|
||||
visible: self.alpha > 0.001;
|
||||
}
|
||||
|
||||
// ---- Soloist key ----
|
||||
in property <image> solokey-qr <=> solokey.qr;
|
||||
in property <string> solokey-url <=> solokey.url;
|
||||
solokey := KeyScreen {
|
||||
alpha: root.vis(root.solokey-t) * root.under;
|
||||
visible: root.solokey-t > 0.001;
|
||||
}
|
||||
|
||||
// ---- page ----
|
||||
in property <[Line]> page-lines <=> page.lines;
|
||||
in property <int> page-focus <=> page.focus-line;
|
||||
@@ -139,6 +149,8 @@ export component App inherits TvWindow {
|
||||
in property <int> np-lyric-line <=> np.lyric-line;
|
||||
in property <bool> np-lyrics-synced <=> np.lyrics-synced;
|
||||
in property <string> np-lyrics-note <=> np.lyrics-note;
|
||||
in property <[QueueItem]> np-queue <=> np.queue;
|
||||
in property <string> np-queue-note <=> np.queue-note;
|
||||
in property <string> np-device <=> np.device;
|
||||
np := NowPlayingScreen {
|
||||
alpha: root.vis(root.np-t) * root.under;
|
||||
@@ -183,6 +195,7 @@ export component App inherits TvWindow {
|
||||
|
||||
// ---- glass, in drawing order (listed by src/main.rs) ----
|
||||
out property <[GlassRect]> glass-signin: signin.glass;
|
||||
out property <[GlassRect]> glass-solokey: solokey.glass;
|
||||
out property <[GlassRect]> glass-page: page.glass;
|
||||
out property <[GlassRect]> glass-page-keyboard: page.glass-keyboard;
|
||||
out property <[GlassRect]> glass-np: np.glass;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// Most szól: the cover, the title, the progress and the controls. With the
|
||||
// lyrics open, the cover and the texts move to the left and a glass panel
|
||||
// holds the lyrics on the right.
|
||||
// lyrics or the queue open, the cover and the texts move to the left and a
|
||||
// glass panel holds the lyrics / the queue on the right.
|
||||
//
|
||||
// Rust owns the focus: `button` is the focused button (0..6), `area` 1 means
|
||||
// Rust owns the focus: `button` is the focused button (0..7), `area` 1 means
|
||||
// the progress bar (left/right seek there).
|
||||
|
||||
import { Tv, GlassRect, GlassPane, Spinner, Caption } from "@sf-ui/sf-ui.slint";
|
||||
import { QueueItem } from "types.slint";
|
||||
import { SpIcon } from "icons.slint";
|
||||
import { Accent, Equalizer } from "page.slint";
|
||||
|
||||
@@ -72,12 +73,14 @@ export component NowPlayingScreen inherits Rectangle {
|
||||
in property <int> liked: -1;
|
||||
in property <int> button: 2;
|
||||
in property <int> area;
|
||||
// 0 none, 1 lyrics
|
||||
// 0 none, 1 lyrics, 2 queue
|
||||
in property <int> panel;
|
||||
in property <[string]> lyrics;
|
||||
in property <int> lyric-line: -1;
|
||||
in property <bool> lyrics-synced;
|
||||
in property <string> lyrics-note;
|
||||
in property <[QueueItem]> queue;
|
||||
in property <string> queue-note;
|
||||
in property <string> device;
|
||||
|
||||
// 0: the big layout, 1: side by side with the panel.
|
||||
@@ -266,8 +269,9 @@ export component NowPlayingScreen inherits Rectangle {
|
||||
Rectangle { width: root.mix(24, 6); }
|
||||
b5 := NpButton { y: (parent.height - self.height) / 2; icon: root.liked == 1 ? "heart-filled" : "heart"; size: root.bs; on: root.liked == 1; focused: root.area == 0 && root.button == 5; alpha: root.alpha * (root.liked < 0 ? 0.4 : 1); }
|
||||
b6 := NpButton { y: (parent.height - self.height) / 2; icon: "lyrics"; size: root.bs; on: root.panel == 1; focused: root.area == 0 && root.button == 6; alpha: root.alpha; }
|
||||
b7 := NpButton { y: (parent.height - self.height) / 2; icon: "queue"; size: root.bs; on: root.panel == 2; focused: root.area == 0 && root.button == 7; alpha: root.alpha; }
|
||||
}
|
||||
property <[string]> hints: ["Keverés", "Előző", root.playing ? "Szünet" : "Lejátszás", "Következő", "Ismétlés", "Kedvelés", "Dalszöveg"];
|
||||
property <[string]> hints: ["Keverés", "Előző", root.playing ? "Szünet" : "Lejátszás", "Következő", "Ismétlés", "Kedvelés", "Dalszöveg", "Lejátszási sor"];
|
||||
Caption {
|
||||
x: root.tx;
|
||||
y: controls.y + controls.height + 18 * Tv.u;
|
||||
@@ -276,7 +280,7 @@ export component NowPlayingScreen inherits Rectangle {
|
||||
opacity: root.alpha;
|
||||
}
|
||||
|
||||
// ---- the panel: lyrics ----
|
||||
// ---- the panel: lyrics or the queue ----
|
||||
property <float> pa: root.alpha * clamp(root.t * 1.6 - 0.6, 0, 1);
|
||||
panel-pane := GlassPane {
|
||||
x: 820 * Tv.u;
|
||||
@@ -319,6 +323,66 @@ export component NowPlayingScreen inherits Rectangle {
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
// queue
|
||||
if root.panel == 2: Rectangle {
|
||||
clip: true;
|
||||
opacity: root.pa;
|
||||
Text {
|
||||
x: 56 * Tv.u;
|
||||
y: 44 * Tv.u;
|
||||
text: "Következik";
|
||||
font-size: 38 * Tv.u;
|
||||
font-weight: 700;
|
||||
color: Tv.text;
|
||||
}
|
||||
for q[i] in root.queue: Rectangle {
|
||||
x: 56 * Tv.u;
|
||||
y: (120 + i * 84) * Tv.u;
|
||||
width: parent.width - 112 * Tv.u;
|
||||
height: 72 * Tv.u;
|
||||
Rectangle {
|
||||
x: 0;
|
||||
width: 64 * Tv.u;
|
||||
height: 64 * Tv.u;
|
||||
y: 4 * Tv.u;
|
||||
border-radius: 8 * Tv.u;
|
||||
clip: true;
|
||||
background: #1b1d24;
|
||||
Image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
source: q.image;
|
||||
image-fit: cover;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
x: 88 * Tv.u;
|
||||
y: 6 * Tv.u;
|
||||
width: parent.width - 88 * Tv.u;
|
||||
text: q.title;
|
||||
font-size: 26 * Tv.u;
|
||||
font-weight: 600;
|
||||
color: Tv.text;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
x: 88 * Tv.u;
|
||||
y: 40 * Tv.u;
|
||||
width: parent.width - 88 * Tv.u;
|
||||
text: q.artist;
|
||||
font-size: 21 * Tv.u;
|
||||
color: Tv.text-tertiary;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if root.queue-note != "": Text {
|
||||
x: 56 * Tv.u;
|
||||
y: 130 * Tv.u;
|
||||
text: root.queue-note;
|
||||
font-size: 26 * Tv.u;
|
||||
color: Tv.text-secondary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out property <[GlassRect]> glass: [
|
||||
@@ -335,7 +399,7 @@ export component NowPlayingScreen inherits Rectangle {
|
||||
tint: #ffffff.with-alpha(0.14 + 0.1 * root.pf),
|
||||
group: 0,
|
||||
},
|
||||
b0.glass, b1.glass, b2.glass, b3.glass, b4.glass, b5.glass, b6.glass,
|
||||
b0.glass, b1.glass, b2.glass, b3.glass, b4.glass, b5.glass, b6.glass, b7.glass,
|
||||
panel-pane.glass,
|
||||
];
|
||||
}
|
||||
|
||||
131
ui/signin.slint
131
ui/signin.slint
@@ -66,19 +66,6 @@ export component ConnectScreen inherits Rectangle {
|
||||
font-size: 26 * Tv.u;
|
||||
color: Tv.text;
|
||||
}
|
||||
Rectangle { height: 10 * Tv.u; }
|
||||
Text {
|
||||
text: "A SPOTIFY APPBÓL";
|
||||
font-size: 20 * Tv.u;
|
||||
font-weight: 700;
|
||||
letter-spacing: 3 * Tv.u;
|
||||
color: #1ed760;
|
||||
}
|
||||
Body {
|
||||
text: "Ha a telefon ugyanazon a Wi-Fin van: indíts el egy számot, koppints az eszközök ikonjára, és válaszd: „" + root.device + "”.";
|
||||
font-size: 26 * Tv.u;
|
||||
color: Tv.text;
|
||||
}
|
||||
Rectangle { }
|
||||
HorizontalLayout {
|
||||
spacing: 16 * Tv.u;
|
||||
@@ -242,3 +229,121 @@ export component MessageScreen inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The Soloist API key: a QR code to a page on this TV where the phone pastes
|
||||
// the key (src/keyserver.rs). OK types it on the TV, Back: later.
|
||||
export component KeyScreen inherits Rectangle {
|
||||
in property <float> alpha: 1;
|
||||
in property <image> qr;
|
||||
in property <string> url;
|
||||
|
||||
pane := GlassPane {
|
||||
x: (root.width - self.width) / 2;
|
||||
y: (root.height - self.height) / 2 - 20 * Tv.u;
|
||||
width: 1640 * Tv.u;
|
||||
height: 760 * Tv.u;
|
||||
radius: 56 * Tv.u;
|
||||
frost: 3.6;
|
||||
tint: Tv.smoke.with-alpha(0.46);
|
||||
glow: #1ed760;
|
||||
alpha: root.alpha;
|
||||
|
||||
VerticalLayout {
|
||||
x: 80 * Tv.u;
|
||||
y: 72 * Tv.u;
|
||||
width: 860 * Tv.u;
|
||||
height: parent.height - 144 * Tv.u;
|
||||
spacing: 18 * Tv.u;
|
||||
opacity: root.alpha;
|
||||
HorizontalLayout {
|
||||
spacing: 24 * Tv.u;
|
||||
alignment: start;
|
||||
Rectangle {
|
||||
width: 80 * Tv.u;
|
||||
height: 80 * Tv.u;
|
||||
border-radius: self.width / 2;
|
||||
background: #1ed760;
|
||||
SpIcon {
|
||||
name: "audio";
|
||||
size: 44 * Tv.u;
|
||||
ink: #121317;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
Title { text: "Még egy lépés: a lejátszó"; }
|
||||
Caption { text: "A Spotify Soloist saját kulccsal indul"; }
|
||||
}
|
||||
}
|
||||
Rectangle { height: 14 * Tv.u; }
|
||||
Body {
|
||||
text: "A zenét a Spotify saját TV-s lejátszója, a Soloist játssza. Ehhez kell egy kulcs a Spotify-fiókodból (Premium).";
|
||||
font-size: 26 * Tv.u;
|
||||
color: Tv.text;
|
||||
}
|
||||
Text {
|
||||
text: "1. A TELEFONON";
|
||||
font-size: 20 * Tv.u;
|
||||
font-weight: 700;
|
||||
letter-spacing: 3 * Tv.u;
|
||||
color: #1ed760;
|
||||
}
|
||||
Body {
|
||||
text: "Nyisd meg: developer.spotify.com/dashboard/soloist, és hozz létre egy kulcsot.";
|
||||
font-size: 26 * Tv.u;
|
||||
color: Tv.text;
|
||||
}
|
||||
Text {
|
||||
text: "2. QR-KÓDDAL A TV-RE";
|
||||
font-size: 20 * Tv.u;
|
||||
font-weight: 700;
|
||||
letter-spacing: 3 * Tv.u;
|
||||
color: #1ed760;
|
||||
}
|
||||
Body {
|
||||
text: "Olvasd be a kódot, és illeszd be a kulcsot. A telefon ugyanazon a Wi-Fin legyen, mint a TV.";
|
||||
font-size: 26 * Tv.u;
|
||||
color: Tv.text;
|
||||
}
|
||||
Rectangle { }
|
||||
Caption { text: "OK: beírás a TV-n · Vissza: később (a Beállításokban is megadhatod)"; }
|
||||
}
|
||||
|
||||
qr-box := Rectangle {
|
||||
x: parent.width - self.width - 96 * Tv.u;
|
||||
y: 80 * Tv.u;
|
||||
width: 440 * Tv.u;
|
||||
height: 440 * Tv.u;
|
||||
border-radius: 28 * Tv.u;
|
||||
background: #ffffff;
|
||||
opacity: root.alpha;
|
||||
clip: true;
|
||||
if root.qr.width > 0: Image {
|
||||
x: 20 * Tv.u;
|
||||
y: 20 * Tv.u;
|
||||
width: parent.width - 40 * Tv.u;
|
||||
height: parent.height - 40 * Tv.u;
|
||||
source: root.qr;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
if root.qr.width == 0: Text {
|
||||
text: "Nincs hálózat";
|
||||
color: #121317;
|
||||
font-size: 26 * Tv.u;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
x: qr-box.x;
|
||||
y: qr-box.y + qr-box.height + 28 * Tv.u;
|
||||
width: qr-box.width;
|
||||
horizontal-alignment: center;
|
||||
text: root.url;
|
||||
font-size: 26 * Tv.u;
|
||||
font-weight: 600;
|
||||
color: Tv.text-secondary;
|
||||
opacity: root.alpha;
|
||||
}
|
||||
}
|
||||
|
||||
out property <[GlassRect]> glass: [pane.glass];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user