Compare commits

..
4 Commits
Author SHA1 Message Date
stilobiqueandClaude Opus 5.5 d0d019ac1e Release 0.1.1
CI / Release Gitea (push) Successful in 13s
CI / Vérifications et paquet (push) Successful in 1m56s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 23:48:39 +01:00
stilobiqueandClaude Opus 5.5 4f6c8a254e Update CLAUDE.md, stop tracking machine-specific QtCreator config
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 23:47:09 +01:00
stilobique b1ca2a7cff Refactoring: move all apps inside a sub folder
CI / Release Gitea (push) Successful in 32s
CI / Vérifications et paquet (push) Successful in 47s
2026-11-08 14:28:28 +01:00
stilobique 33e4fe0c4e Refactoring, create a src folders with the python toolchain 2026-11-08 14:22:51 +01:00
50 changed files with 286 additions and 290 deletions

No files matched your search

+10 -5
View File
@@ -1,5 +1,5 @@
# Vérifications à chaque push / pull request, et release Gitea avec le paquet FreeStore # Vérifications à chaque push / pull request, et release Gitea avec le paquet FreeStore
# sur un tag « vX.Y.Z » (qui doit correspondre à « version » dans manifest.json). # sur un tag « vX.Y.Z » (qui doit correspondre à « version » dans app/manifest.json).
# Le téléversement sur la console FreeFactory reste manuel (pas d'API connue). # Le téléversement sur la console FreeFactory reste manuel (pas d'API connue).
name: CI name: CI
@@ -21,15 +21,20 @@ jobs:
SUDO=$(command -v sudo || true) SUDO=$(command -v sudo || true)
$SUDO apt-get update -qq $SUDO apt-get update -qq
DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y -qq --no-install-recommends \ DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y -qq --no-install-recommends \
python3 git ca-certificates qmlscene qtdeclarative5-dev-tools \ curl git ca-certificates qmlscene qtdeclarative5-dev-tools \
qml-module-qtquick2 qml-module-qtquick-window2 qml-module-qtmultimedia qml-module-qtquick2 qml-module-qtquick-window2 qml-module-qtmultimedia
git clone --depth 1 https://github.com/fbx/libfbxqml.git ../libfbxqml git clone --depth 1 https://github.com/fbx/libfbxqml.git ../libfbxqml
- name: uv (outils Python du dépôt)
run: |
curl -LsSf https://astral.sh/uv/0.12.9/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Manifest, syntaxe QML/JS et paquet FreeStore - name: Manifest, syntaxe QML/JS et paquet FreeStore
run: python3 tools/package.py run: uv run --locked freebox-jellyfin package
- name: Chargement en HTTP, comme sur la box - name: Chargement en HTTP, comme sur la box
run: tools/check-load.sh run: uv run --locked freebox-jellyfin check
- name: Paquet en artefact - name: Paquet en artefact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@@ -56,7 +61,7 @@ jobs:
env: env:
TAG: ${{ gitea.ref_name }} TAG: ${{ gitea.ref_name }}
run: | run: |
VERSION=$(python3 -c "import json; print(json.load(open('manifest.json'))['version'])") VERSION=$(python3 -c "import json; print(json.load(open('app/manifest.json'))['version'])")
if [ "$TAG" != "v$VERSION" ]; then if [ "$TAG" != "v$VERSION" ]; then
echo "Le tag $TAG ne correspond pas à la version du manifest (v$VERSION)." echo "Le tag $TAG ne correspond pas à la version du manifest (v$VERSION)."
exit 1 exit 1
+6 -3
View File
@@ -71,12 +71,15 @@ Thumbs.db
*.exe *.exe
# Log de tools/deploy.py # Log de freebox-jellyfin deploy
deploy.log deploy.log
# Paquets FreeStore (tools/package.py) # Paquets FreeStore (freebox-jellyfin package)
dist/ dist/
# Environnement Python local (Rider) # Environnement Python local (Rider)
.venv/ .venv/
.idea/** .idea/**
# Cible de déploiement QtCreator, propre à chaque machine
app/Jellyfin.fbxproject.user
+1
View File
@@ -0,0 +1 @@
3.14
+3 -3
View File
@@ -14,11 +14,11 @@
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="DEBUG_JUST_MY_CODE" value="false" /> <option name="DEBUG_JUST_MY_CODE" value="false" />
<option name="RUN_TOOL" value="" /> <option name="RUN_TOOL" value="" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tools/deploy.py" /> <option name="SCRIPT_NAME" value="freebox_jellyfin" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="deploy" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="true" />
<option name="REDIRECT_INPUT" value="false" /> <option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
+19 -12
View File
@@ -6,30 +6,37 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
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. 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.
## Layout
- `app/` — the application itself, the only directory served to / packaged for the Player (`manifest.json`, `Jellyfin.qml`, `icon.png`, `Components/`, `Core/`, `Shared/`, `Views/`, plus the QtCreator project `Jellyfin.fbxproject`). Paths in the Architecture section are relative to `app/`.
- `src/freebox_jellyfin/` — Python dev tooling; `tools/preview.qml` — desktop preview wrapper; `dist/`, `deploy.log` — generated at the repo root.
## Build / run ## Build / run
There is no build system or test suite. There is no build system and no test suite: `freebox-jellyfin check` is the only automated guard; beyond that, verify on the box with `deploy`.
**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`. **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=`). - 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. - Dev tooling is the Python package `freebox_jellyfin` (`src/freebox_jellyfin/`, uv project, Python 3.14, stdlib only): `uv sync`, then `uv run freebox-jellyfin <preview|check|package|deploy>` (also `python -m freebox_jellyfin`).
- `QT_QPA_PLATFORM=offscreen tools/run-local.sh` — headless run, useful to catch QML warnings. - `uv run freebox-jellyfin preview` — 1280×720 window via `tools/preview.qml`; `--fullscreen` runs `app/Jellyfin.qml` as the box would.
- `QT_QPA_PLATFORM=offscreen uv run freebox-jellyfin preview` — headless run, useful to catch QML warnings.
- HTTPS on the PC works with the system `qmlscene` (Qt 5.15 + OpenSSL 3). PyQt5 wheels from pip bundle a Qt built for OpenSSL 1.x and cannot do TLS here. - HTTPS on the PC works with the system `qmlscene` (Qt 5.15 + OpenSSL 3). PyQt5 wheels from pip bundle a Qt built for OpenSSL 1.x and cannot do TLS here.
- Lint: `qmllint Jellyfin.qml Components/*.qml Core/*.qml Shared/*.qml Views/*.qml` - Lint: `cd app && qmllint Jellyfin.qml Components/*.qml Core/*.qml Shared/*.qml Views/*.qml`
- `tools/check-load.sh` — serves the repo over HTTP and loads it with `qmlscene` (offscreen, software renderer) like the box does; fails on any Qt warning not coming from libfbxqml. Run it after touching imports, `qmldir` files or singletons. - `uv run freebox-jellyfin check` — serves `app/` over HTTP and loads it with `qmlscene` (offscreen, software renderer) like the box does; fails on any Qt warning not coming from libfbxqml. This reproduces the box's HTTP loading mode, which behaves differently from local files (see constraints below): run it after touching imports, `qmldir` files or singletons.
- **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. - 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.
**CI** (`.gitea/workflows/ci.yml`, Gitea Actions on the `ubuntu-latest` runner image): on every push/PR, `tools/package.py` (manifest + qmllint + archive) and `tools/check-load.sh`, package uploaded as artifact (`upload-artifact@v3`/`download-artifact@v3`: v4 only works on recent Gitea versions). On tag `vX.Y.Z` matching `manifest.json` `version`, creates a Gitea release with the package attached (API calls with the job's `GITHUB_TOKEN`). Verified locally by replaying the `check` job's steps in a clean `ubuntu:24.04` container; the release job has not run yet. **CI** (`.gitea/workflows/ci.yml`, Gitea Actions on the `ubuntu-latest` runner image): installs uv (pinned 0.12.9, which fetches Python 3.14) and on every push/PR runs `uv run --locked freebox-jellyfin package` (manifest + qmllint + archive) and `… check`; package uploaded as artifact (`upload-artifact@v3`/`download-artifact@v3`: v4 only works on recent Gitea versions). On tag `vX.Y.Z` matching `manifest.json` `version`, creates a Gitea release with the package attached (API calls with the job's `GITHUB_TOKEN`).
**FreeStore package**: `tools/package.py` → `dist/<identifier>.tar.gz` (gitignored). Replicates the QtCreator plugin's "Make FreeStore Package": same file selection as `Jellyfin.fbxproject` (QML/JS/images/fonts/`qmldir`/`manifest.json`, excluding `tools/` and hidden dirs), manifest checks (identifier `\w+(\.\w+)+`, `version` x.y.z equal to `Session.clientVersion`, entry-point files present), `qmllint` on all sources, ustar tar with directory entries, gzipped. Upload is manual on the FreeFactory console (http://factory.free.fr), followed by Free's review. **Releasing**: bump `version` in `app/manifest.json` **and** `clientVersion` in `app/Core/Session.qml` (`package` refuses to build if they differ), then push a `vX.Y.Z` tag.
**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. `--server <host>` and `--user name[:password]` (both repeatable) serve a virtual `dev-config.json` next to the app; at startup `Session.loadDevConfig()` adds each listed server and stores users in `Session.devUsers`, which `UserSelectView` merges with public users (one-click sign-in when a password is given; never log passwords) (only when the app is loaded over HTTP; 404 otherwise, ignored) — the workaround for the lack of persistence in dev mode. 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: **FreeStore package**: `freebox-jellyfin package` → `dist/<identifier>-<version>.tar.gz` (gitignored). Replicates the QtCreator plugin's "Make FreeStore Package": same file selection as `Jellyfin.fbxproject` (QML/JS/images/fonts/`qmldir`/`manifest.json` under `app/`, hidden dirs excluded; archive paths relative to `app/`), manifest checks (identifier `\w+(\.\w+)+`, `version` x.y.z equal to `Session.clientVersion`, entry-point files present), `qmllint` on all sources, ustar tar with directory entries, gzipped. Upload is manual on the FreeFactory console (http://factory.free.fr), followed by Free's review.
**Deploying a test build to the Freebox**: `freebox-jellyfin deploy` (`src/freebox_jellyfin/deploy.py`; Player must be in developer mode). It discovers the Player via SSDP (`fbx:devel`) or takes `--box <IP>`, serves `app/` over HTTP, calls JSON-RPC `debug_qml_app` on `http://<box>/pub/devel`, and streams the app's stdout/stderr until it exits. `--server <host>` and `--user name[:password]` (both repeatable) serve a virtual `dev-config.json` next to the app; at startup `Session.loadDevConfig()` adds each listed server and stores users in `Session.devUsers`, which `UserSelectView` merges with public users (one-click sign-in when a password is given; never log passwords) (only when the app is loaded over HTTP; 404 otherwise, ignored) — the workaround for the lack of persistence in dev mode. Output is also written to `deploy.log` (repo root, gitignored, overwritten each run) — read it to diagnose on-box failures. This is the only way to see the app's `console.log`: an app installed from the FreeStore sends no logs anywhere (server-side, only the Jellyfin dashboard's activity and server logs are available). 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:
- SDK setup: https://dev.freebox.fr/sdk/player.html (Windows: https://github.com/fbx/freebox-qtcreator-plugin/issues/8) - 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). - Open `app/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/`qmldir` 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 `app/` plus `manifest.json` — new files are picked up automatically.
## Architecture ## Architecture
@@ -46,7 +53,7 @@ There is no build system or test suite.
- Target is QtQuick 2.5 (Qt 5.5 era): **ES5 JavaScript only** (`var`, `function`; no `let`/`const`/arrow functions) and no QtQuick.Controls. - 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. - 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.
- The box's virtual keyboard lacks `:` (and likely `/`): never require typing a URL scheme or `host:port`. Server entry takes host + optional numeric port; `Session.serverCandidates()` derives the URLs to probe (https, http:8096, https:8920, http). - The box's virtual keyboard lacks `:` (and likely `/`): never require typing a URL scheme or `host:port`. Server entry takes host + optional numeric port; `Session.serverCandidates()` derives the URLs to probe (https, http:8096, https:8920, http).
- **No persistent storage when launched via `tools/deploy.py`** (dev mode, app not installed), even with a Freebox profile open (`profileId=1`): `Settings` saves fail with `profiles.application_data_set` "internal json-rpc error", and `QtQuick.LocalStorage` exists but cannot create `/var/lib/databases/fbxqmltv/Databases`. Expected to work once installed as a FreeStore package (unverified). Code must keep working with nothing persisted. - **No persistent storage when launched via `freebox-jellyfin deploy`** (dev mode, app not installed), even with a Freebox profile open (`profileId=1`): `Settings` saves fail with `profiles.application_data_set` "internal json-rpc error", and `QtQuick.LocalStorage` exists but cannot create `/var/lib/databases/fbxqmltv/Databases`. Expected to work once installed as a FreeStore package (unverified). Code must keep working with nothing persisted.
- The box's native `fbx.application` `Application` differs from libfbxqml's: e.g. it has `profileId` but no `identifier`. Don't rely on libfbxqml-only properties; guard with `typeof`. - The box's native `fbx.application` `Application` differs from libfbxqml's: e.g. it has `profileId` but no `identifier`. Don't rely on libfbxqml-only properties; guard with `typeof`.
- In bindings, guard `page.session`/`page.navigator` against null: they are injected after bindings are first evaluated. - 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): - **HTTP loading rules** (the box fetches files over HTTP, so directories can't be listed):
-141
View File
@@ -1,141 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.3.0, 2024-08-12T17:50:51. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{82daaaf9-c426-482c-8459-9906e026a767}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Freebox (192.168.0.20)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Freebox (192.168.0.20)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{2fffcf57-628c-4672-8f03-a48ccdb2ddbd}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">-1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">-1</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">0</value>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{sourceDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+4 -4
View File
@@ -10,8 +10,8 @@ QtObject {
id: session id: session
readonly property string clientName: "Jellyfin Freebox" readonly property string clientName: "Jellyfin Freebox"
// Doit rester égale à « version » dans manifest.json (vérifié par tools/package.py). // Doit rester égale à « version » dans manifest.json (vérifié par freebox-jellyfin package).
readonly property string clientVersion: "0.1.0" readonly property string clientVersion: "0.1.1"
readonly property string deviceName: "Freebox Player" readonly property string deviceName: "Freebox Player"
// Serveurs enregistrés : { name, address, id } // Serveurs enregistrés : { name, address, id }
@@ -20,7 +20,7 @@ QtObject {
property var currentServer: null // { name, address, id } property var currentServer: null // { name, address, id }
property var currentUser: null // { name, id } property var currentUser: null // { name, id }
property string accessToken: "" property string accessToken: ""
// Comptes de test fournis par tools/deploy.py --user : { name, password? } // Comptes de test fournis par freebox-jellyfin deploy --user : { name, password? }
property var devUsers: [] property var devUsers: []
// ---------------------------------------------------------------- Serveurs // ---------------------------------------------------------------- Serveurs
@@ -75,7 +75,7 @@ QtObject {
}); });
} }
// Test sur la box : tools/deploy.py --server <adresse> --user <nom[:mdp]> sert // Test sur la box : freebox-jellyfin deploy --server <adresse> --user <nom[:mdp]> sert
// dev-config.json à côté de l'app ; chaque serveur listé est ajouté et les comptes // dev-config.json à côté de l'app ; chaque serveur listé est ajouté et les comptes
// sont proposés sur « Qui regarde ? ». Absent (404) hors test : rien ne se passe. // sont proposés sur « Qui regarde ? ». Absent (404) hors test : rien ne se passe.
function loadDevConfig(url) { function loadDevConfig(url) {
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -5,7 +5,7 @@ import "../Shared/Remote.js" as Remote
// Écran 3 : choix de l'utilisateur parmi les comptes publics du serveur. // Écran 3 : choix de l'utilisateur parmi les comptes publics du serveur.
// Si le serveur masque ses comptes, seule la carte « Ajouter un compte » est proposée, // Si le serveur masque ses comptes, seule la carte « Ajouter un compte » est proposée,
// plus les comptes de test éventuels (tools/deploy.py --user). // plus les comptes de test éventuels (freebox-jellyfin deploy --user).
Page { Page {
id: page id: page
View File
File renamed without changes.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "Jellyfin", "name": "Jellyfin",
"identifier": "com.stilobique.jellyfin", "identifier": "com.stilobique.jellyfin",
"version": "0.1.0", "version": "0.1.1",
"description": "Jellyfin for Freebox", "description": "Jellyfin for Freebox",
"icon": "icon.png", "icon": "icon.png",
"capabilities": { "capabilities": {
+17
View File
@@ -0,0 +1,17 @@
[project]
name = "freebox-jellyfin"
version = "0.1.0"
description = "Outils de développement du client Jellyfin pour Freebox Player (aperçu, vérification, paquet FreeStore, déploiement)"
readme = "readme.md"
authors = [
{ name = "stilobique", email = "contact@aurelien-vaillant.net" }
]
requires-python = ">=3.14"
dependencies = []
[project.scripts]
freebox-jellyfin = "freebox_jellyfin:main"
[build-system]
requires = ["uv_build>=0.12.9,<0.13.0"]
build-backend = "uv_build"
+23 -12
View File
@@ -7,48 +7,59 @@
Cette application permet d'utiliser jellyfin sur la freebox. Cette application permet d'utiliser jellyfin sur la freebox.
# Configurer un environement de travail L'application (QML envoyé au Player) est dans `app/` ; le reste du dépôt est l'outillage de développement.
# Configurer un environment de travail
[Documentation pour le SDK de la freebox](https://dev.freebox.fr/sdk/player.html). [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). Pour Windows, [voir ce billet sur Github](https://github.com/fbx/freebox-qtcreator-plugin/issues/8).
Les outils (aperçu, vérification, paquet, déploiement) sont regroupés dans le module Python `freebox_jellyfin` (`src/`), géré avec [uv](https://docs.astral.sh/uv/) :
```bash
uv sync # crée .venv (Python 3.14) et installe la commande freebox-jellyfin
uv run freebox-jellyfin # liste les commandes
```
## Aperçu sur PC (Linux) ## Aperçu sur PC (Linux)
Sans Freebox, l'application tourne avec `qmlscene` (Qt 5) et la bibliothèque [libfbxqml](https://github.com/fbx/libfbxqml) : Sans Freebox, l'application tourne avec `qmlscene` (Qt 5) et la bibliothèque [libfbxqml](https://github.com/fbx/libfbxqml) :
```bash ```bash
sudo apt install qmlscene qml-module-qtmultimedia qtdeclarative5-dev-tools sudo apt install qmlscene qml-module-qtmultimedia qtdeclarative5-dev-tools
git clone https://github.com/fbx/libfbxqml.git ../libfbxqml git clone https://github.com/fbx/libfbxqml.git ../libfbxqml
tools/run-local.sh # fenêtre 1280x720 uv run freebox-jellyfin preview # fenêtre 1280x720
tools/run-local.sh --fullscreen # plein écran, comme sur la box uv run freebox-jellyfin preview --fullscreen # plein écran, comme sur la box
uv run freebox-jellyfin check # chargement en HTTP comme le Player, échoue sur tout avertissement Qt
``` ```
## Tester sur la Freebox ## Tester sur la Freebox
Activer le mode développeur du Player (menu Réglages, avec la télécommande), puis : Activer le mode développeur du Player (menu Réglages, avec la télécommande), puis :
```bash ```bash
tools/deploy.py # trouve le Player sur le réseau et lance l'app uv run freebox-jellyfin deploy # trouve le Player sur le réseau et lance l'app
tools/deploy.py --box 192.168.0.21 # ou en donnant son adresse uv run freebox-jellyfin deploy --box 192.168.0.21 # ou en donnant son adresse
tools/deploy.py --server media.example.com # l'app ajoute ce serveur au démarrage uv run freebox-jellyfin deploy --server media.example.com # l'app ajoute ce serveur au démarrage
tools/deploy.py --server media.example.com --user alice:motdepasse --user bob uv run freebox-jellyfin deploy --server media.example.com --user alice:motdepasse bob
``` ```
En mode développement, la box n'enregistre aucune donnée de l'application. Pour éviter de tout ressaisir à chaque test : En mode développement, la box n'enregistre aucune donnée de l'application. Pour éviter de tout ressaisir à chaque test :
- `--server <adresse>` : le serveur est ajouté automatiquement à la liste ; - `--server <adresse>` : le serveur est ajouté automatiquement à la liste ;
- `--user <nom>[:<mot de passe>]` (répétable) : le compte apparaît sur « Qui regarde ? », même si le serveur masque ses comptes. Avec un mot de passe, la connexion se fait en un clic ; sans, l'écran de connexion s'ouvre avec le nom pré-rempli. Le mot de passe n'apparaît pas dans les logs, mais il transite en clair sur le réseau local. - `--user <nom>[:<mot de passe>]` (répétable) : le compte apparaît sur « Qui regarde ? », même si le serveur masque ses comptes. Avec un mot de passe, la connexion se fait en un clic ; sans, l'écran de connexion s'ouvre avec le nom pré-rempli. Le mot de passe n'apparaît pas dans les logs, mais il transite en clair sur le réseau local.
Le script sert les fichiers du projet au Player et affiche les logs de l'application. Il doit rester ouvert pendant le test (Ctrl+C pour arrêter). La commande sert les fichiers du projet au Player et affiche les logs de l'application. Il doit rester ouvert pendant le test (Ctrl+C pour arrêter).
## Publier sur le FreeStore ## Publier sur le FreeStore
```bash ```bash
tools/package.py # crée dist/com.stilobique.jellyfin-<version>.tar.gz uv run freebox-jellyfin package # crée dist/com.stilobique.jellyfin-<version>.tar.gz
``` ```
Pour une nouvelle version, modifier `version` dans `manifest.json` **et** `clientVersion` dans `Core/Session.qml` (le script refuse de créer le paquet si elles diffèrent). Pour une nouvelle version, modifier `version` dans `app/manifest.json` **et** `clientVersion` dans `app/Core/Session.qml` (la commande refuse de créer le paquet si elles diffèrent).
Le script reproduit « Make FreeStore Package » du plugin QtCreator : il vérifie `manifest.json` et la syntaxe QML/JS (`qmllint`), puis crée l'archive à téléverser sur la console [FreeFactory](http://factory.free.fr) (compte développeur requis, validation par Free avant publication). La commande reproduit « Make FreeStore Package » du plugin QtCreator : elle vérifie `app/manifest.json` et la syntaxe QML/JS (`qmllint`), puis crée l'archive à téléverser sur la console [FreeFactory](http://factory.free.fr) (compte développeur requis, validation par Free avant publication).
## Intégration continue ## Intégration continue
Le workflow Gitea Actions `.gitea/workflows/ci.yml` : Le workflow Gitea Actions `.gitea/workflows/ci.yml` :
- à chaque push / pull request : vérifie le manifest et la syntaxe QML/JS, charge l'application en HTTP comme le Player (`tools/check-load.sh`) et publie le paquet en artefact ; - à chaque push / pull request : vérifie le manifest et la syntaxe QML/JS, charge l'application en HTTP comme le Player (`freebox-jellyfin check`) et publie le paquet en artefact ;
- sur un tag `vX.Y.Z` (égal à la version du manifest) : crée une release Gitea avec le paquet FreeStore en pièce jointe. - sur un tag `vX.Y.Z` (égal à la version du manifest) : crée une release Gitea avec le paquet FreeStore en pièce jointe.
```bash ```bash
+29
View File
@@ -0,0 +1,29 @@
"""Outils de développement du client Jellyfin pour Freebox Player.
freebox-jellyfin preview [--fullscreen] aperçu sur le PC (qmlscene + libfbxqml)
freebox-jellyfin check chargement en HTTP comme sur la box (CI)
freebox-jellyfin package paquet FreeStore dans dist/
freebox-jellyfin deploy [--box IP] … lancement sur un Player en mode développeur
"""
import sys
COMMANDS = ("preview", "check", "package", "deploy")
def main(argv=None):
argv = sys.argv[1:] if argv is None else argv
if not argv or argv[0] not in COMMANDS:
print(__doc__.strip())
print("\nAide d'une commande : freebox-jellyfin <commande> --help")
return 0 if argv and argv[0] in ("-h", "--help") else 2
command, rest = argv[0], argv[1:]
# Imports à la demande : chaque commande ne charge que son module.
if command == "preview":
from .preview import main as run
elif command == "check":
from .check_load import main as run
elif command == "package":
from .package import main as run
else:
from .deploy import main as run
return run(rest)
+5
View File
@@ -0,0 +1,5 @@
import sys
from . import main
sys.exit(main())
+75
View File
@@ -0,0 +1,75 @@
"""Charge l'application comme le Freebox Player (fichiers servis en HTTP) et échoue si Qt
signale une erreur ou un avertissement venant de l'app.
En HTTP, Qt ne peut pas lister les dossiers : c'est là qu'apparaissent les « X is not a type »
(qmldir manquant) ou « Cyclic dependency » (singletons), invisibles en lançant depuis le disque.
"""
import argparse
import functools
import http.server
import os
import subprocess
import sys
import tempfile
import threading
from .project import APP_DIR, libfbxqml, qmlscene
# Messages attendus hors de la box : Settings de libfbxqml (pas d'objet App sur PC).
EXPECTED = ("/libfbxqml/", "qml: Setting", "qml: Getting settings failed")
class _Quiet(http.server.SimpleHTTPRequestHandler):
def log_message(self, *args):
pass
class _Server(http.server.ThreadingHTTPServer):
def handle_error(self, request, client_address):
pass # qmlscene qui s'arrête en plein téléchargement (BrokenPipe) : sans intérêt
def problems(output):
"""Lignes de sortie de qmlscene qui ne sont pas attendues."""
return [line for line in output.splitlines()
if line.strip() and not any(marker in line for marker in EXPECTED)]
def run(duration):
lib, scene = libfbxqml(), qmlscene()
server = _Server(
("127.0.0.1", 0), functools.partial(_Quiet, directory=str(APP_DIR)))
threading.Thread(target=server.serve_forever, daemon=True).start()
url = "http://127.0.0.1:%d/Jellyfin.qml" % server.server_address[1]
print("Chargement de %s pendant %g s…" % (url, duration), flush=True)
try:
with tempfile.TemporaryDirectory() as runtime:
os.chmod(runtime, 0o700)
# Rendu logiciel : la CI (conteneur) n'a pas d'OpenGL.
env = dict(os.environ, XDG_RUNTIME_DIR=runtime,
QT_QPA_PLATFORM="offscreen", QT_QUICK_BACKEND="software")
try:
result = subprocess.run([scene, "-I", str(lib), url], env=env, timeout=duration,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
output = result.stdout
except subprocess.TimeoutExpired as expired: # cas normal : l'app reste ouverte
output = expired.stdout or ""
if isinstance(output, bytes):
output = output.decode(errors="replace")
finally:
server.shutdown()
unexpected = problems(output)
if unexpected:
print("Échec : messages inattendus au chargement :", file=sys.stderr)
print("\n".join(unexpected), file=sys.stderr)
return 1
print("OK : chargement sans erreur.")
return 0
def main(argv=None):
parser = argparse.ArgumentParser(prog="freebox-jellyfin check", description=__doc__.splitlines()[0])
parser.add_argument("--duration", type=float, default=6, help="durée du chargement en secondes (défaut : 6)")
args = parser.parse_args(argv)
return run(args.duration)
@@ -1,13 +1,12 @@
#!/usr/bin/env python3
"""Lance l'application sur un Freebox Player en mode développeur. """Lance l'application sur un Freebox Player en mode développeur.
Reproduit le « Run » du plugin QtCreator Freebox (github.com/fbx/freebox-qtcreator-plugin) : Reproduit le « Run » du plugin QtCreator Freebox (github.com/fbx/freebox-qtcreator-plugin) :
1. trouve le Player sur le réseau local (SSDP, type « fbx:devel ») ou utilise --box ; 1. trouve le Player sur le réseau local (SSDP, type « fbx:devel ») ou utilise --box ;
2. sert le dossier du projet en HTTP (le Player y télécharge manifest.json et les QML) ; 2. sert le dossier app/ en HTTP (le Player y télécharge manifest.json et les QML) ;
3. appelle la méthode JSON-RPC « debug_qml_app » sur http://<box>/pub/devel ; 3. appelle la méthode JSON-RPC « debug_qml_app » sur http://<box>/pub/devel ;
4. affiche stdout/stderr de l'application jusqu'à sa fermeture (ou Ctrl+C). 4. affiche stdout/stderr de l'application jusqu'à sa fermeture (ou Ctrl+C).
Usage : tools/deploy.py [--box 192.168.0.21] [--server media.example.com] [--user nom[:mdp]] [--entry main] [--verbose] [--log deploy.log] Usage : freebox-jellyfin deploy [--box 192.168.0.21] [--server media.example.com] [--user nom[:mdp]] [--entry main] [--verbose] [--log deploy.log]
--server : l'app ajoute ce serveur au démarrage (utile car la box n'enregistre rien en mode développement). --server : l'app ajoute ce serveur au démarrage (utile car la box n'enregistre rien en mode développement).
--user nom[:mot_de_passe] : compte proposé sur « Qui regarde ? » (le mot de passe transite en clair sur le réseau local). --user nom[:mot_de_passe] : compte proposé sur « Qui regarde ? » (le mot de passe transite en clair sur le réseau local).
La sortie est aussi écrite dans deploy.log (racine du projet), écrasé à chaque lancement. La sortie est aussi écrite dans deploy.log (racine du projet), écrasé à chaque lancement.
@@ -24,7 +23,9 @@ import threading
import time import time
import urllib.request import urllib.request
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) from .project import APP_DIR, REPO_DIR
APP_DIR, REPO_DIR = str(APP_DIR), str(REPO_DIR)
SSDP_ADDR = ("239.255.255.250", 1900) SSDP_ADDR = ("239.255.255.250", 1900)
SSDP_TYPE = "fbx:devel" SSDP_TYPE = "fbx:devel"
@@ -86,7 +87,7 @@ class QuietHandler(http.server.SimpleHTTPRequestHandler):
def serve_project(bind_ip, verbose, dev_config=None): def serve_project(bind_ip, verbose, dev_config=None):
QuietHandler.verbose = verbose QuietHandler.verbose = verbose
QuietHandler.dev_config = dev_config QuietHandler.dev_config = dev_config
handler = functools.partial(QuietHandler, directory=PROJECT_DIR) handler = functools.partial(QuietHandler, directory=APP_DIR)
server = http.server.ThreadingHTTPServer((bind_ip, 0), handler) server = http.server.ThreadingHTTPServer((bind_ip, 0), handler)
threading.Thread(target=server.serve_forever, daemon=True).start() threading.Thread(target=server.serve_forever, daemon=True).start()
return server return server
@@ -146,8 +147,8 @@ class Tee:
self.log.flush() self.log.flush()
def main(): def main(argv=None):
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) parser = argparse.ArgumentParser(prog="freebox-jellyfin deploy", description=__doc__.splitlines()[0])
parser.add_argument("--box", help="adresse IP du Player (sinon découverte SSDP)") parser.add_argument("--box", help="adresse IP du Player (sinon découverte SSDP)")
parser.add_argument("--entry", default="main", help="entry point du manifest.json (défaut : main)") parser.add_argument("--entry", default="main", help="entry point du manifest.json (défaut : main)")
parser.add_argument("--verbose", action="store_true", help="affiche les fichiers téléchargés par le Player") parser.add_argument("--verbose", action="store_true", help="affiche les fichiers téléchargés par le Player")
@@ -157,13 +158,13 @@ def main():
parser.add_argument("--user", action="extend", nargs="+", default=[], metavar="NOM[:MOT_DE_PASSE]", parser.add_argument("--user", action="extend", nargs="+", default=[], metavar="NOM[:MOT_DE_PASSE]",
help="compte(s) affiché(s) sur l'écran « Qui regarde ? » ; avec mot de passe, " help="compte(s) affiché(s) sur l'écran « Qui regarde ? » ; avec mot de passe, "
"connexion en un clic (ex. --user alice:mdp bob, ou --user répété)") "connexion en un clic (ex. --user alice:mdp bob, ou --user répété)")
parser.add_argument("--log", default=os.path.join(PROJECT_DIR, "deploy.log"), parser.add_argument("--log", default=os.path.join(REPO_DIR, "deploy.log"),
help="fichier de log, écrasé à chaque lancement (défaut : deploy.log ; vide pour désactiver)") help="fichier de log, écrasé à chaque lancement (défaut : deploy.log ; vide pour désactiver)")
args = parser.parse_args() args = parser.parse_args(argv)
if args.log: if args.log:
log = open(args.log, "w", encoding="utf-8") log = open(args.log, "w", encoding="utf-8")
log.write("# deploy.py %s\n" % time.strftime("%Y-%m-%d %H:%M:%S")) log.write("# freebox-jellyfin deploy %s\n" % time.strftime("%Y-%m-%d %H:%M:%S"))
sys.stdout = Tee(sys.stdout, log) sys.stdout = Tee(sys.stdout, log)
sys.stderr = Tee(sys.stderr, log) sys.stderr = Tee(sys.stderr, log)
@@ -188,7 +189,7 @@ def main():
server = serve_project(me, args.verbose, dev_config) server = serve_project(me, args.verbose, dev_config)
port = server.server_address[1] port = server.server_address[1]
manifest_url = "http://%s:%d/manifest.json" % (me, port) manifest_url = "http://%s:%d/manifest.json" % (me, port)
print("Projet servi sur %s" % manifest_url) print("Application servie sur %s" % manifest_url)
if args.server: if args.server:
print("Serveurs de test proposés à l'app : %s" % ", ".join(args.server)) print("Serveurs de test proposés à l'app : %s" % ", ".join(args.server))
if users: # les mots de passe ne sont jamais affichés if users: # les mots de passe ne sont jamais affichés
@@ -211,6 +212,3 @@ def main():
finally: finally:
server.shutdown() server.shutdown()
if __name__ == "__main__":
main()
@@ -1,16 +1,15 @@
#!/usr/bin/env python3
"""Fabrique le paquet FreeStore (.tar.gz) à téléverser sur la console FreeFactory. """Fabrique le paquet FreeStore (.tar.gz) à téléverser sur la console FreeFactory.
Reproduit « Outils > Freebox SDK > Make FreeStore Package » du plugin QtCreator Freebox Reproduit « Outils > Freebox SDK > Make FreeStore Package » du plugin QtCreator Freebox
(github.com/fbx/freebox-qtcreator-plugin, src/freestorepackager.cc) : (github.com/fbx/freebox-qtcreator-plugin, src/freestorepackager.cc) :
- fichiers inclus comme dans Jellyfin.fbxproject : QML, JS, images, polices, qmldir et - fichiers inclus comme dans Jellyfin.fbxproject : QML, JS, images, polices, qmldir et
manifest.json (tools/ est exclu : l'aperçu PC n'a rien à faire sur la box) ; manifest.json, pris dans app/ uniquement (l'outillage PC n'a rien à faire sur la box) ;
- vérifications : manifest.json (identifiant, version identique à Session.clientVersion, - vérifications : manifest.json (identifiant, version identique à Session.clientVersion,
points d'entrée existants), JSON valides, points d'entrée existants), JSON valides,
syntaxe QML/JS (qmllint, s'il est installé) ; syntaxe QML/JS (qmllint, s'il est installé) ;
- archive tar (format ustar, avec les entrées de dossiers) compressée en gzip. - archive tar (format ustar, avec les entrées de dossiers) compressée en gzip.
Usage : tools/package.py [--output dist/paquet.tar.gz] Usage : freebox-jellyfin package [--output dist/paquet.tar.gz]
""" """
import argparse import argparse
import io import io
@@ -23,22 +22,21 @@ import sys
import tarfile import tarfile
import time import time
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) from .project import APP_DIR, REPO_DIR
APP_DIR, REPO_DIR = str(APP_DIR), str(REPO_DIR)
# Types de fichiers repris de Jellyfin.fbxproject (QmlFiles, JavaScriptFiles, ImageFiles, Files). # Types de fichiers repris de Jellyfin.fbxproject (QmlFiles, JavaScriptFiles, ImageFiles, Files).
EXTENSIONS = {".qml", ".js", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".bmp", ".webp", EXTENSIONS = {".qml", ".js", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".bmp", ".webp",
".ttf", ".otf", ".woff"} ".ttf", ".otf", ".woff"}
NAMES = {"qmldir", "manifest.json"} NAMES = {"qmldir", "manifest.json"}
EXCLUDED_DIRS = {"tools", "dist"}
def collect_files(): def collect_files():
files = [] files = []
for root, dirs, names in os.walk(PROJECT_DIR): for root, dirs, names in os.walk(APP_DIR):
rel_root = os.path.relpath(root, PROJECT_DIR) rel_root = os.path.relpath(root, APP_DIR)
# Dossiers cachés (.git, .idea…) et dossiers d'outillage exclus. dirs[:] = sorted(d for d in dirs if not d.startswith(".")) # dossiers cachés exclus
dirs[:] = sorted(d for d in dirs if not d.startswith(".")
and not (rel_root == "." and d in EXCLUDED_DIRS))
for name in sorted(names): for name in sorted(names):
if name in NAMES or os.path.splitext(name)[1].lower() in EXTENSIONS: if name in NAMES or os.path.splitext(name)[1].lower() in EXTENSIONS:
files.append(os.path.normpath(os.path.join(rel_root, name))) files.append(os.path.normpath(os.path.join(rel_root, name)))
@@ -47,7 +45,7 @@ def collect_files():
def check_manifest(files): def check_manifest(files):
"""Mêmes règles que fileformat/manifest.cc du plugin. Renvoie le manifest.""" """Mêmes règles que fileformat/manifest.cc du plugin. Renvoie le manifest."""
path = os.path.join(PROJECT_DIR, "manifest.json") path = os.path.join(APP_DIR, "manifest.json")
if not os.path.exists(path): if not os.path.exists(path):
raise ValueError("manifest.json manquant") raise ValueError("manifest.json manquant")
manifest = json.load(open(path, encoding="utf-8")) manifest = json.load(open(path, encoding="utf-8"))
@@ -75,7 +73,7 @@ def check_manifest(files):
if not isinstance(version, str) or not re.fullmatch(r"\d+\.\d+\.\d+", version): if not isinstance(version, str) or not re.fullmatch(r"\d+\.\d+\.\d+", version):
raise ValueError("manifest.json : « version » absente ou invalide (forme attendue : 1.2.3)") raise ValueError("manifest.json : « version » absente ou invalide (forme attendue : 1.2.3)")
# La version envoyée à Jellyfin (Session.clientVersion) doit rester la même. # La version envoyée à Jellyfin (Session.clientVersion) doit rester la même.
session = open(os.path.join(PROJECT_DIR, "Core", "Session.qml"), encoding="utf-8").read() session = open(os.path.join(APP_DIR, "Core", "Session.qml"), encoding="utf-8").read()
client = re.search(r'clientVersion:\s*"([^"]*)"', session) client = re.search(r'clientVersion:\s*"([^"]*)"', session)
if not client or client.group(1) != version: if not client or client.group(1) != version:
raise ValueError("version du manifest (%s) différente de Session.clientVersion (%s)" raise ValueError("version du manifest (%s) différente de Session.clientVersion (%s)"
@@ -89,12 +87,12 @@ def check_manifest(files):
def check_sources(files): def check_sources(files):
for name in files: for name in files:
if name.endswith(".json"): if name.endswith(".json"):
json.load(open(os.path.join(PROJECT_DIR, name), encoding="utf-8")) json.load(open(os.path.join(APP_DIR, name), encoding="utf-8"))
qmllint = shutil.which("qmllint") qmllint = shutil.which("qmllint")
if not qmllint: if not qmllint:
print("Attention : qmllint introuvable, syntaxe QML/JS non vérifiée.") print("Attention : qmllint introuvable, syntaxe QML/JS non vérifiée.")
return return
sources = [os.path.join(PROJECT_DIR, f) for f in files if f.endswith((".qml", ".js"))] sources = [os.path.join(APP_DIR, f) for f in files if f.endswith((".qml", ".js"))]
result = subprocess.run([qmllint] + sources, capture_output=True, text=True) result = subprocess.run([qmllint] + sources, capture_output=True, text=True)
if result.returncode != 0: if result.returncode != 0:
raise ValueError("erreurs de syntaxe QML/JS :\n" + (result.stdout + result.stderr).strip()) raise ValueError("erreurs de syntaxe QML/JS :\n" + (result.stdout + result.stderr).strip())
@@ -122,14 +120,14 @@ def build_archive(files, output):
if directory not in seen_dirs: if directory not in seen_dirs:
seen_dirs.add(directory) seen_dirs.add(directory)
archive.addfile(info(directory, True)) archive.addfile(info(directory, True))
data = open(os.path.join(PROJECT_DIR, name), "rb").read() data = open(os.path.join(APP_DIR, name), "rb").read()
archive.addfile(info(name.replace(os.sep, "/"), False, len(data)), io.BytesIO(data)) archive.addfile(info(name.replace(os.sep, "/"), False, len(data)), io.BytesIO(data))
def main(): def main(argv=None):
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) parser = argparse.ArgumentParser(prog="freebox-jellyfin package", description=__doc__.splitlines()[0])
parser.add_argument("--output", help="archive à créer (défaut : dist/<identifier>-<version>.tar.gz)") parser.add_argument("--output", help="archive à créer (défaut : dist/<identifier>-<version>.tar.gz)")
args = parser.parse_args() args = parser.parse_args(argv)
files = collect_files() files = collect_files()
try: try:
@@ -139,12 +137,9 @@ def main():
sys.exit("Paquet non créé : %s" % error) sys.exit("Paquet non créé : %s" % error)
output = args.output or os.path.join( output = args.output or os.path.join(
PROJECT_DIR, "dist", "%s-%s.tar.gz" % (manifest["identifier"], manifest["version"])) REPO_DIR, "dist", "%s-%s.tar.gz" % (manifest["identifier"], manifest["version"]))
build_archive(files, output) build_archive(files, output)
print("Paquet créé : %s — version %s (%d fichiers, %.1f Ko)" % ( print("Paquet créé : %s — version %s (%d fichiers, %.1f Ko)" % (
os.path.relpath(output, os.getcwd()), manifest["version"], len(files), os.path.getsize(output) / 1024)) os.path.relpath(output, os.getcwd()), manifest["version"], len(files), os.path.getsize(output) / 1024))
print("À téléverser sur la console FreeFactory (http://factory.free.fr).") print("À téléverser sur la console FreeFactory (http://factory.free.fr).")
if __name__ == "__main__":
main()
+15
View File
@@ -0,0 +1,15 @@
"""Lance l'application sur le PC avec qmlscene (Qt 5) et libfbxqml."""
import argparse
import os
from .project import APP_DIR, REPO_DIR, libfbxqml, qmlscene
def main(argv=None):
parser = argparse.ArgumentParser(prog="freebox-jellyfin preview", description=__doc__)
parser.add_argument("--fullscreen", action="store_true",
help="lance Jellyfin.qml en plein écran, comme sur la box (sinon fenêtre 1280x720)")
args = parser.parse_args(argv)
lib, scene = libfbxqml(), qmlscene()
qml = APP_DIR / "Jellyfin.qml" if args.fullscreen else REPO_DIR / "tools" / "preview.qml"
os.execv(scene, [scene, "-I", str(lib), str(qml)])
+38
View File
@@ -0,0 +1,38 @@
"""Emplacements partagés par les commandes : dépôt, application QML, libfbxqml et qmlscene.
REPO_DIR : racine du dépôt (outils, dist/, deploy.log) ;
APP_DIR : REPO_DIR/app, seul dossier envoyé au Freebox Player (manifest.json, QML, images).
"""
import os
import shutil
import sys
from pathlib import Path
def _find_root() -> Path:
"""Dossier contenant app/manifest.json : depuis le dossier courant, sinon depuis ce module."""
for start in (Path.cwd(), Path(__file__).resolve().parent):
for folder in (start, *start.parents):
if (folder / "app" / "manifest.json").is_file() and (folder / "pyproject.toml").is_file():
return folder
sys.exit("Projet introuvable : lancez la commande depuis le dépôt Jellyfin-Freebox.")
REPO_DIR = _find_root()
APP_DIR = REPO_DIR / "app"
def libfbxqml() -> Path:
"""libfbxqml (module fbx.application en QML pur) : ../libfbxqml, ou $LIBFBXQML."""
path = Path(os.environ.get("LIBFBXQML", REPO_DIR.parent / "libfbxqml"))
if not (path / "fbx").is_dir():
sys.exit("libfbxqml introuvable : git clone https://github.com/fbx/libfbxqml.git %s" % path)
return path
def qmlscene() -> str:
"""qmlscene de Qt 5 : $QMLSCENE, le PATH, ou l'emplacement Debian/Ubuntu."""
path = os.environ.get("QMLSCENE") or shutil.which("qmlscene") or "/usr/lib/qt5/bin/qmlscene"
if not os.path.exists(path) and not shutil.which(path):
sys.exit("qmlscene introuvable : sudo apt install qmlscene")
return path
-53
View File
@@ -1,53 +0,0 @@
#!/usr/bin/env bash
# Charge l'application comme le fait le Freebox Player (fichiers servis en HTTP) et échoue
# si Qt signale une erreur ou un avertissement venant de l'app.
# En HTTP, Qt ne peut pas lister les dossiers : c'est là qu'apparaissent les « X is not a type »
# (qmldir manquant) ou « Cyclic dependency » (singletons), invisibles en lançant depuis le disque.
#
# Usage : tools/check-load.sh (LIBFBXQML=… pour un autre emplacement de libfbxqml)
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
LIBFBXQML="${LIBFBXQML:-$ROOT/../libfbxqml}"
QMLSCENE="${QMLSCENE:-$(command -v qmlscene || echo /usr/lib/qt5/bin/qmlscene)}"
DURATION="${DURATION:-6}"
if [ ! -d "$LIBFBXQML/fbx" ]; then
echo "libfbxqml introuvable : git clone https://github.com/fbx/libfbxqml.git \"$LIBFBXQML\"" >&2
exit 2
fi
WORK="$(mktemp -d)"
trap 'kill "$SERVER_PID" 2>/dev/null || true; rm -rf "$WORK"' EXIT
# Serveur HTTP sur un port libre (choisi par le système).
python3 -I - "$ROOT" > "$WORK/port" <<'EOF' &
import functools, http.server, sys
class Quiet(http.server.SimpleHTTPRequestHandler):
def log_message(self, *args):
pass
server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), functools.partial(Quiet, directory=sys.argv[1]))
print(server.server_address[1], flush=True)
server.serve_forever()
EOF
SERVER_PID=$!
for _ in $(seq 50); do [ -s "$WORK/port" ] && break; sleep 0.1; done
PORT="$(cat "$WORK/port")"
echo "Chargement de http://127.0.0.1:$PORT/Jellyfin.qml pendant ${DURATION} s…"
# Rendu logiciel : la CI (conteneur) n'a pas d'OpenGL.
mkdir -p "$WORK/runtime" && chmod 700 "$WORK/runtime"
XDG_RUNTIME_DIR="$WORK/runtime" QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \
timeout "$DURATION" "$QMLSCENE" -I "$LIBFBXQML" \
"http://127.0.0.1:$PORT/Jellyfin.qml" > "$WORK/output" 2>&1 || true
# Messages attendus hors de la box : Settings de libfbxqml (pas d'objet App sur PC).
grep -v -e "/libfbxqml/" -e "^qml: Setting" -e "^qml: Getting settings failed" -e "^\s*$" \
"$WORK/output" > "$WORK/problems" || true
if [ -s "$WORK/problems" ]; then
echo "Échec : messages inattendus au chargement :" >&2
cat "$WORK/problems" >&2
exit 1
fi
echo "OK : chargement sans erreur."
+2 -2
View File
@@ -1,13 +1,13 @@
import QtQuick 2.5 import QtQuick 2.5
import QtQuick.Window 2.2 import QtQuick.Window 2.2
// Aperçu sur PC : charge Jellyfin.qml puis repasse la fenêtre en 1280x720 // Aperçu sur PC : charge app/Jellyfin.qml puis repasse la fenêtre en 1280x720
// (fbx.application.Application force le plein écran au démarrage). // (fbx.application.Application force le plein écran au démarrage).
QtObject { QtObject {
property var app: null property var app: null
Component.onCompleted: { Component.onCompleted: {
var component = Qt.createComponent("../Jellyfin.qml"); var component = Qt.createComponent("../app/Jellyfin.qml");
if (component.status === Component.Error) { if (component.status === Component.Error) {
console.error(component.errorString()); console.error(component.errorString());
Qt.quit(); Qt.quit();
-17
View File
@@ -1,17 +0,0 @@
#!/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"
Generated
+8
View File
@@ -0,0 +1,8 @@
version = 1
revision = 3
requires-python = ">=3.14"
[[package]]
name = "freebox-jellyfin"
version = "0.1.0"
source = { editable = "." }