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
+106 -22

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.
+2
View File
@@ -45,6 +45,8 @@ Item {
}
text: root.name
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
maximumLineCount: 2
elide: Text.ElideRight
color: root.highlighted ? Theme.text : Theme.textMuted
font.pixelSize: Theme.fontBody
+30 -2
View File
@@ -11,14 +11,42 @@ Page {
subtitle: page.session && page.session.currentServer
? "Connecté à " + page.session.currentServer.name + "."
: ""
initialFocus: logoutButton
initialFocus: backButton
// La pile a été réinitialisée à la connexion : on reconstruit Serveurs > Utilisateurs
// pour revenir au choix de l'utilisateur.
function goBack() {
page.navigator.reset("ServerSelect");
page.navigator.push("UserSelect");
}
// La touche Retour de la télécommande fait la même chose que le bouton
// (sinon, à la racine de la pile, elle fermerait l'application).
Keys.onPressed: {
if (Remote.isBack(event.key)) {
event.accepted = true;
page.goBack();
}
}
Row {
spacing: Theme.spacingM
FocusButton {
id: backButton
text: "Retour"
KeyNavigation.right: logoutButton
onClicked: page.goBack()
}
FocusButton {
id: logoutButton
text: "Se déconnecter"
KeyNavigation.left: backButton
onClicked: {
page.session.logout();
page.navigator.reset("UserSelect");
page.goBack();
}
}
}
}
+1 -1
View File
@@ -97,6 +97,6 @@ Page {
}
text: "Changer de serveur"
KeyNavigation.up: userList
onClicked: page.navigator.pop()
onClicked: page.navigator.reset("ServerSelect")
}
}
+10
View File
@@ -10,3 +10,13 @@ Cette application permet d'utiliser jellyfin sur la freebox.
# Configurer un environement de travail
[Documentation pour le SDK de la freebox](https://dev.freebox.fr/sdk/player.html).
Pour Windows, [voir ce billet sur Github](https://github.com/fbx/freebox-qtcreator-plugin/issues/8).
## Aperçu sur PC (Linux)
Sans Freebox, l'application tourne avec `qmlscene` (Qt 5) et la bibliothèque [libfbxqml](https://github.com/fbx/libfbxqml) :
```bash
sudo apt install qmlscene qml-module-qtmultimedia qtdeclarative5-dev-tools
git clone https://github.com/fbx/libfbxqml.git ../libfbxqml
tools/run-local.sh # fenêtre 1280x720
tools/run-local.sh --fullscreen # plein écran, comme sur la box
```
+23
View File
@@ -0,0 +1,23 @@
import QtQuick 2.5
import QtQuick.Window 2.2
// Aperçu sur PC : charge Jellyfin.qml puis repasse la fenêtre en 1280x720
// (fbx.application.Application force le plein écran au démarrage).
QtObject {
property var app: null
Component.onCompleted: {
var component = Qt.createComponent("../Jellyfin.qml");
if (component.status === Component.Error) {
console.error(component.errorString());
Qt.quit();
return;
}
app = component.createObject(null);
app.visibility = Window.Windowed;
app.width = 1280;
app.height = 720;
app.color = "black";
app.title = "Jellyfin (aperçu)";
}
}
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Lance l'application sur le PC avec qmlscene (Qt 5) et libfbxqml.
# Usage : tools/run-local.sh [--fullscreen]
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
LIBFBXQML="${LIBFBXQML:-$ROOT/../libfbxqml}"
QMLSCENE="${QMLSCENE:-$(command -v qmlscene || echo /usr/lib/qt5/bin/qmlscene)}"
if [ ! -d "$LIBFBXQML/fbx" ]; then
echo "libfbxqml introuvable : git clone https://github.com/fbx/libfbxqml.git \"$LIBFBXQML\"" >&2
exit 1
fi
if [ "${1:-}" = "--fullscreen" ]; then
exec "$QMLSCENE" -I "$LIBFBXQML" "$ROOT/Jellyfin.qml"
fi
exec "$QMLSCENE" -I "$LIBFBXQML" "$ROOT/tools/preview.qml"