Add tool to test locally

This commit is contained in:
stilobique committed 2026-11-08 10:38:26 +01:00
1 parent 49d8524597
commit e99e5bf6b4
7 files changed
+111 -27

No files matched your search

+23 -19
View File
@@ -4,33 +4,37 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project
A Jellyfin client for the Freebox Player (Revolution), written in pure QML (no C++, no JS files yet). The app runs inside the Freebox's QML runtime via the `fbx.application` module, so it cannot be run with a stock `qmlscene` — `import fbx.application 1.0` only resolves on the box or through the Freebox SDK.
A Jellyfin client for the Freebox Player (Revolution), written in pure QML (no C++). The app runs inside the Freebox's QML runtime via the `fbx.application` module, so it cannot be run with a stock `qmlscene` — `import fbx.application 1.0` only resolves on the box or through the Freebox SDK. The UI follows the Jellyfin Android TV app's flow and conventions. UI text is in French.
## Build / run
There is no build system, linter, or test suite. Development uses the Freebox SDK's QtCreator plugin:
There is no build system or test suite.
**Local preview on the PC** (no Freebox needed): `fbx.application` from [libfbxqml](https://github.com/fbx/libfbxqml) is pure QML (a fullscreen `Window` scaled to a 720p virtual height), so the app runs with Qt 5's `qmlscene`.
- Prerequisites: `sudo apt install qmlscene qml-module-qtmultimedia qtdeclarative5-dev-tools`, and libfbxqml cloned next to the repo (`../libfbxqml`, override with `LIBFBXQML=`).
- `tools/run-local.sh` — 1280×720 window via `tools/preview.qml`; `tools/run-local.sh --fullscreen` runs `Jellyfin.qml` as the box would.
- `QT_QPA_PLATFORM=offscreen tools/run-local.sh` — headless run, useful to catch QML warnings.
- Lint: `qmllint Jellyfin.qml Components/*.qml Core/*.qml Views/*.qml`
- The desktop has Qt 5.15 while the box targets QtQuick 2.5: code that runs locally can still use APIs too new for the box.
**Deploying to the Freebox** uses the Freebox SDK's QtCreator plugin:
- SDK setup: https://dev.freebox.fr/sdk/player.html (Windows: https://github.com/fbx/freebox-qtcreator-plugin/issues/8)
- Open `Jellyfin.fbxproject` in QtCreator with the Freebox plugin; the run target deploys to a Freebox Player on the LAN (configured in `Jellyfin.fbxproject.user`, which is machine-specific).
- `Jellyfin.fbxproject` packages every QML/JS/image/font file under the repo root plus `manifest.json` — new files are picked up automatically.
- `Jellyfin.fbxproject` packages every QML/JS/image/font/`qmldir` file under the repo root plus `manifest.json` — new files are picked up automatically.
## Structure
## Architecture
- `manifest.json` — app identity (`com.stilobique.jellyfin`), icon, required capabilities (`net_wan`), and entry point. Add capabilities here if new platform features are used.
- `Jellyfin.qml` — root `Application`: a `Row` split 1/3 (logo panel) and 2/3 (login panel). Owns initial focus.
- `Views/` — imported as `import "Views" as View` and used as `View.Logo`, `View.Login`. Paths to assets inside views are relative to the view file (e.g. `../icon.png`).
- `Jellyfin.qml` — root `Application`: logo panel (1/3) + `Navigator` (2/3), owns the single `Session` instance.
- `Core/Navigator.qml` — screen stack on a `Loader`. `push("Name")` loads `Views/NameView.qml`; also `replace`, `pop`, `reset`. Every view gets `navigator` and `session` injected, plus any props passed to `push`. Remote Back/Escape pops; at the root it propagates (exits app). After loading, focus goes to the view's `initialFocus`.
- `Core/Session.qml` — servers (`ListModel`), `currentServer`, `currentUser`. Network calls are **mocked** via `_simulate()`; each has a `TODO API` comment naming the Jellyfin endpoint. Async functions use `callback(error, result)` — keep that shape when wiring the real API. Views call `session.cancel()` on destruction.
- `Components/` — reusable widgets, exposed through `Components/qmldir` (every new component must be listed there). `Theme` (colors, spacing, fonts) and `Remote` (`isAccept`/`isBack` key mapping) are singletons; files inside `Components/` need `import "."` to see them.
- `Views/` — one screen per file, each rooted in `Page` (title/subtitle header + content area). Current flow: `ServerSelect` → `ServerAdd` → `UserSelect` → `Login` (password or Quick Connect) → `Home` (placeholder).
## Platform constraints
- Target is QtQuick 2.5 (old Qt). Stick to APIs available in that version.
- Input is a TV remote: navigation is driven by `Keys.onPressed` with `Qt.Key_Up`/`Qt.Key_Down` etc. and explicit focus handling, not mouse/touch.
## Current state (WIP)
Remote-key navigation on the login form is in progress (`Views/Login.qml`). Known issues to be aware of when touching it:
- `Jellyfin.qml` calls `columnLogin.updateSelection()`, but `columnLogin` is an id inside `Login.qml`; QML ids are file-scoped, so this needs an `id` on the `View.Login {}` instance instead.
- `updateSelection()` references `repeater`, but the `Repeater` has no `id`, and it sets `.color` on a `Row` (which has no `color` property).
- `Keys.onPressed` is attached to the `Repeater` rather than the focused `Column`, so it will not receive key events.
Comments in the code and README are partly in French.
- Target is QtQuick 2.5 (Qt 5.5 era): **ES5 JavaScript only** (`var`, `function`; no `let`/`const`/arrow functions) and no QtQuick.Controls.
- Input is a TV remote: navigation uses `KeyNavigation` + explicit focus. On a `ListView`, set `KeyNavigation.priority: KeyNavigation.AfterItem` so the list handles arrows itself and only hands off at its ends.
- In bindings, guard `page.session`/`page.navigator` against null: they are injected after bindings are first evaluated.
- Don't disable (`enabled: false`) a focused control during loading — it loses focus and the remote stops responding; guard with a `busy` flag instead.