Files
Jellyfin-Freebox/CLAUDE.md
T

5.1 KiB
Raw Blame History

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project

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, The UI follows the Jellyfin Android TV app's flow and conventions. UI text is in French.

Build / run

There is no build system or test suite.

Local preview on the PC (no Freebox needed): fbx.application from 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 Shared/*.qml Views/*.qml
  • Reproduce the box's loading mode: the Player loads the app over HTTP, which behaves differently from local files (see constraints below). Check with python3 -m http.server 8765 --directory . then QT_QPA_PLATFORM=offscreen qmlscene -I ../libfbxqml http://127.0.0.1:8765/Jellyfin.qml — it must print no warnings.
  • 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 a test build to the Freebox: tools/deploy.py (Python stdlib only; Player must be in developer mode). It discovers the Player via SSDP (fbx:devel) or takes --box <IP>, serves the repo over HTTP, calls JSON-RPC debug_qml_app on http://<box>/pub/devel, and streams the app's stdout/stderr until it exits. Output is also written to deploy.log (repo root, gitignored, overwritten each run) — read it to diagnose on-box failures. The Player fetches files lazily from that HTTP server, so the script must keep running while the app is in use. This replicates the "Run" of the official QtCreator plugin, whose own setup is:

Architecture

  • 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, listed in Components/qmldir.
  • Shared/ — Theme singleton (colors, spacing, fonts; the only type in Shared/qmldir) and Remote.js (.pragma library, isAccept/isBack key mapping, imported as Remote).
  • 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 (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.
  • HTTP loading rules (the box fetches files over HTTP, so directories can't be listed):
    • every imported directory needs a qmldir listing all its types (Core/, Components/, Shared/); a missing one gives "X is not a type" only on the box;
    • a singleton must not live in the same directory as the components that use it, and a directory must hold at most one singleton — otherwise "Cyclic dependency detected". Put helpers in .pragma library JS files instead of new singletons;
    • no import "." self-imports.
  • Don't disable (enabled: false) a focused control during loading — it loses focus and the remote stops responding; guard with a busy flag instead.