App foundation: Rust core, libmpv player and UI shell (M0 + M1) #10

Merged
Mett-mit-Zwiebel merged 7 commits from feat/app-foundation into main 2026-10-28 19:50:42 +01:00
Mett-mit-Zwiebel commented 2026-10-28 18:47:27 +01:00 (Migrated from github.com)

First working version of Cushion. It covers M0 (Mett-mit-Zwiebel/cushion#1) and the main parts of M1 (Mett-mit-Zwiebel/cushion#2).

What works

  • Sign in to Audiobookshelf 2.26+ with an access and refresh token pair. Tokens are refreshed and rotated automatically and stored in the OS keyring, never on disk. Custom proxy headers are supported.
  • Library: home shelves, a library grid with sorting and infinite scroll, book pages with chapters.
  • Playback (libmpv): multi-file books play as one seamless edl:// timeline. Chapter navigation, ±30 s skips, speed with pitch kept, volume. An EQ is available in the backend (no UI yet).
  • Sync: progress is synced every 15 s and on pause, seek and end. Live updates arrive over the socket, so progress from other devices shows up without a refresh.
  • UI: Spotify-style shell (sidebar, player bar, chapter panel) and a "Now Absorbing" full view based on Absorb's card. Absorb's theme: neutral dark surfaces, accent colour taken from the cover, accent glow, plus dark, OLED and light modes. Keyboard shortcuts.

How it was tested

  • 32 Rust tests, 7 of them against real libmpv:
    • Six run against a real Audiobookshelf server in Docker (scripts/test-server.sh), on both 2.26.0 and 2.37.2. They write the audio to a WAV file and measure the tones in it. That shows there is no gap at file boundaries, 2× keeps the pitch, the EQ changes the output, and M4B chapters work. They also cover token rotation and socket progress events.
    • One plays local files only, with no server needed, so it also runs on Windows.
  • Manual run of the built app on Linux (Xvfb):
    • login, home, library and book pages, play, chapter skip across files, full view
    • progress reaches the server
    • silent resume from GNOME Keyring after a restart
    • a progress update from a simulated second device appears live
  • CI (green on both):
    • Linux: UI type check, Prettier, rustfmt, clippy -D warnings, all tests including the live server, app build.
    • Windows: generates an MSVC import library for shinchiro's libmpv, runs the unit and local player tests (seamless two-file playback with real Windows paths), builds the app.
    • A failing step repeats its error output as an annotation (scripts/ci-run.sh), so failures are readable without downloading logs.

Findings worth knowing (details in PLAN.md §9)

  • Socket client: rust_socketio was replaced by a small Engine.IO v4 client, which avoids pulling in OpenSSL and a second HTTP stack.
  • Locale: libmpv requires LC_NUMERIC=C, which GTK overrides on systems with e.g. a German locale. The app resets it before creating the player.
  • Rate limit: the server rate-limits login and refresh (HTTP 429), and the app reports this clearly.
  • libmpv2 6.0 bug: create_client(Some(name)) hands mpv a freed string, which crashed on Windows. Cushion creates that client without a name.

Not in this PR

  • SQLite cache: M1/M2
  • Search, series and author pages: M2
  • Media keys, tray and mini player: M4
  • Sleep timer, bookmarks and EQ UI: M5
  • Packaging the Windows DLL: M8

https://claude.ai/code/session_019KvpR4Tt9MGgJ3yC3DVqPq


Generated by Claude Code

First working version of Cushion. It covers **M0** (Mett-mit-Zwiebel/cushion#1) and the main parts of **M1** (Mett-mit-Zwiebel/cushion#2). ## What works - **Sign in** to Audiobookshelf 2.26+ with an access and refresh token pair. Tokens are refreshed and rotated automatically and stored in the OS keyring, never on disk. Custom proxy headers are supported. - **Library:** home shelves, a library grid with sorting and infinite scroll, book pages with chapters. - **Playback (libmpv):** multi-file books play as one seamless `edl://` timeline. Chapter navigation, ±30 s skips, speed with pitch kept, volume. An EQ is available in the backend (no UI yet). - **Sync:** progress is synced every 15 s and on pause, seek and end. Live updates arrive over the socket, so progress from other devices shows up without a refresh. - **UI:** Spotify-style shell (sidebar, player bar, chapter panel) and a "Now Absorbing" full view based on Absorb's card. Absorb's theme: neutral dark surfaces, accent colour taken from the cover, accent glow, plus dark, OLED and light modes. Keyboard shortcuts. ## How it was tested - **32 Rust tests**, 7 of them against real libmpv: - Six run against a real Audiobookshelf server in Docker (`scripts/test-server.sh`), on both **2.26.0 and 2.37.2**. They write the audio to a WAV file and measure the tones in it. That shows there is no gap at file boundaries, 2× keeps the pitch, the EQ changes the output, and M4B chapters work. They also cover token rotation and socket progress events. - One plays local files only, with no server needed, so it also runs on Windows. - **Manual run of the built app on Linux (Xvfb):** - login, home, library and book pages, play, chapter skip across files, full view - progress reaches the server - silent resume from GNOME Keyring after a restart - a progress update from a simulated second device appears live - **CI (green on both):** - Linux: UI type check, Prettier, rustfmt, clippy `-D warnings`, all tests including the live server, app build. - Windows: generates an MSVC import library for shinchiro's libmpv, runs the unit and local player tests (seamless two-file playback with real Windows paths), builds the app. - A failing step repeats its error output as an annotation (`scripts/ci-run.sh`), so failures are readable without downloading logs. ## Findings worth knowing (details in PLAN.md §9) - **Socket client:** `rust_socketio` was replaced by a small Engine.IO v4 client, which avoids pulling in OpenSSL and a second HTTP stack. - **Locale:** libmpv requires `LC_NUMERIC=C`, which GTK overrides on systems with e.g. a German locale. The app resets it before creating the player. - **Rate limit:** the server rate-limits login and refresh (HTTP 429), and the app reports this clearly. - **libmpv2 6.0 bug:** `create_client(Some(name))` hands mpv a freed string, which crashed on Windows. Cushion creates that client without a name. ## Not in this PR - SQLite cache: M1/M2 - Search, series and author pages: M2 - Media keys, tray and mini player: M4 - Sleep timer, bookmarks and EQ UI: M5 - Packaging the Windows DLL: M8 https://claude.ai/code/session_019KvpR4Tt9MGgJ3yC3DVqPq --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
No description provided.