No description
  • Rust 62.2%
  • QML 36.1%
  • C++ 1.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Brian 23ee301835
All checks were successful
Build Flatpak / flatpak (push) Successful in 10m6s
Release 0.3.0
The backend rewrite in Rust is the change, so this is a minor bump. The
metainfo gains a release entry; the interface itself is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 10:46:52 -06:00
.forgejo/workflows Rewrite the backend in Rust 2026-10-03 10:46:30 -06:00
app Rewrite the backend in Rust 2026-10-03 10:46:30 -06:00
core Rewrite the backend in Rust 2026-10-03 10:46:30 -06:00
flatpak Release 0.3.0 2026-10-03 10:46:52 -06:00
.gitignore Rewrite the backend in Rust 2026-10-03 10:46:30 -06:00
Cargo.lock Release 0.3.0 2026-10-03 10:46:52 -06:00
Cargo.toml Release 0.3.0 2026-10-03 10:46:52 -06:00
README.md Rewrite the backend in Rust 2026-10-03 10:46:30 -06:00

abs-htpc — Audiobookshelf client for Home Theater PCs

A 10-foot, couch-friendly client for an Audiobookshelf server. Built for Linux HTPCs and designed to be driven entirely by a remote control or game controller — no keyboard or mouse required (though both work).

  • Fullscreen, large-type UI with bold focus rings for D-pad navigation
  • On-screen keyboard for server/login entry (remote-only friendly)
  • Left-sidebar navigation: Home, Library, Series, Authors
  • Home shelves from the server's personalized API: Continue Listening (in-progress), Next in Series (server-computed next book after you finish one), and Recently Added
  • Cover-art grids, Series (books in order) and Authors browsing, book detail with chapters, now-playing transport
  • Audio playback via mpv (libmpv), with chapter jumps and ±30s skip
  • Listening progress synced back to the server (resume where you left off)
  • Game controller support via SDL2; media keys (Play/Pause/Next/Prev/Stop)

Install

The supported way to run it is the Flatpak, which bundles libmpv and uses the KDE runtime (Qt 6) plus Flathub's QtWebEngine base app:

curl -LO https://git.thenymans.com/api/packages/brian/generic/abs-htpc/latest/com.thenymans.AbsHtpc.flatpak
flatpak install --user ./com.thenymans.AbsHtpc.flatpak
flatpak run com.thenymans.AbsHtpc

See flatpak/README.md for building it yourself and for the auto-updating repository.

Building natively

Needs a Rust toolchain (stable), Qt 6.5+ development files (Core, Gui, Qml, Quick, QuickControls2; plus WebEngineQuick for on-TV SSO), libmpv and, at run time, libSDL2 for controllers (optional: without it controllers are ignored).

cargo build --release
./target/release/abs-htpc

Without QtWebEngine, build with --no-default-features; the on-TV SSO option is then hidden and phone or password sign-in still work.

On first launch you'll get the Connect screen with three options:

  • Log in with your phone (QR): recommended, no typing on the TV. The app shows a QR code; scan it with your phone and sign in on your phone's keyboard, with a password or with SSO. The phone talks to the app over plain HTTP on your LAN, on a fixed port, 8645 (pairing_port in config.json); the app exchanges your login for a token and stores only the token. Your password is never written to disk.

    Firewall: many distros (CachyOS with ufw, for example) drop inbound connections by default, and the phone's page then never loads. Allow the port once: sudo ufw allow 8645/tcp (or, with firewalld, sudo firewall-cmd --permanent --add-port=8645/tcp && sudo firewall-cmd --reload). The QR screen shows this hint if no phone connects within 20 seconds.

    SSO from the phone needs one redirect URI allowed in Audiobookshelf (Settings → Authentication → Allowed Mobile Redirect URIs): http://<htpc-ip>:8645/oidc/callback. If it's missing, the phone page tells you the exact value to add.

  • Sign in with SSO on the TV (e.g. Login with Authentik): shown when the server has OpenID enabled; the label is the server's own button text. The provider's login page opens in a built-in browser: ▲▼ move between fields and buttons, OK presses a button or opens the on-screen keyboard for a text field, Back cancels. No firewall or server changes are needed: it uses the audiobookshelf://oauth redirect that Audiobookshelf allows by default. Your provider must allow ABS's https://<abs>/auth/openid/mobile-redirect redirect URI, which the ABS docs already require for the mobile apps. Each sign-in uses a fresh private browser profile, so the next person isn't signed in as you.

  • Enter details manually — the on-screen keyboard for server URL / username / password (a bare host like abs.example.com automatically gets https://).

Either way, the saved token means subsequent launches skip straight to the profile picker.

Multiple users / profiles

The app keeps a list of accounts, each a real Audiobookshelf login with its own library and listening progress. On launch you get a "Who's listening?" picker:

  • Choose a profile to sign in instantly (its token is stored on this device).
  • + Add user opens the login screen (QR or keyboard) for another account.
  • Delete on a focused profile removes it.
  • From the library, press Back and choose Switch user to return to the picker (or Exit to quit to the desktop).

Notes on Audiobookshelf's design: there's no "impersonate" API, so each person signs in once (their token is then remembered). Listing all server users isn't possible from a regular account — it requires admin — so profiles are the ones you've added here, not an automatic roster of everyone on the server.

Controls

Action Remote / Keyboard Game controller
Move focus Arrow keys D-pad / left stick
Select / OK Enter A
Back Esc B
Play / Pause Space or media key X
Skip −30s / +30s (player) ←/→ on transport LB / RB
Previous / Next chapter media Prev/Next Left / Right trigger
Scrub focus the seek bar, then ←/→ focus seek bar, then ←/→

In the player, Esc/B returns to the previous screen while playback continues; use the ⏹ Stop button to end the session. From the library, Esc/B opens an Exit to desktop? prompt (with Switch user when you have profiles).

Configuration

Config (including the auth token) is stored at:

$XDG_CONFIG_HOME/abs-htpc/config.json   # default: ~/.config/abs-htpc/config.json

The token is written with 0600 permissions but is not encrypted (see Notes). Delete this file to reset / log out.

Development

The app is a Rust backend (via CXX-Qt) under the QML UI. The easiest toolchain is the Flatpak SDK itself; see flatpak/README.md.

cargo test -p abs-core                 # unit tests: API paths, config, timeline, OIDC, pairing
cargo run -p abs-core --example live_check -- https://abs.example.com USER PASS
cargo clippy --workspace --all-targets

live_check exercises the real API surface the app uses against a server (login, browse, a play session with sync/close, mark finished, phone pairing, SSO probe) and prints a redacted report; it writes no config.

UI checks without a screen: build with --features capture and point ABS_HTPC_CAPTURE at a script of wait <ms>, key <Qt key name>, type <text>, shot <file.png> and quit lines; run with QT_QPA_PLATFORM=offscreen. The feature is never part of release builds.

Architecture

core/          abs-core: no Qt, unit-tested
  client.rs      blocking Audiobookshelf API client (ureq)
  endpoints.rs   URL paths and builders
  config.rs      Account + AccountStore: multi-account config (servers, tokens, active)
  timeline.rs    book time <-> (track, local time) mapping, chapters
  oidc.rs        ABS OpenID (SSO) handshake shared by the TV and phone flows
  pairing.rs     QR phone-login LAN HTTP server (tiny_http)
  qr.rs          QR codes as SVG data URLs
app/           abs-htpc: the application
  src/           QObjects exposed to QML as module AbsBackend: Auth, Library
                 (also the book grid's list model), Detail, Player (libmpv),
                 Pairing, Sso, Gamepad (SDL2, loaded at run time); main.rs
  cpp/           small C++ helpers (JSON -> QVariant, synthetic key events,
                 QtWebEngine init, the capture harness)
  qml/           Main.qml instantiates and wires the backend objects; App/Theme
                 singleton; components and views
flatpak/       manifest, desktop file, metainfo, icon

Network calls run on worker threads and report back on the Qt thread. mpv plays a book's files as a playlist; timeline.rs presents it as one continuous timeline. Controller input is translated by an SDL2 thread into synthetic arrow-key events plus transport signals, so the same QML focus handling serves remote and pad.

Notes / roadmap (v1 scope)

  • Auth token is stored in plaintext; OS keyring integration is a future option.
  • Podcasts: the data layer understands episodes, but a dedicated podcast browse UI is not yet built.
  • Out of scope for v1: offline downloads, multi-user switching, casting, LIRC/IR remotes (most IR remotes already present as keyboard input via the OS).