Refactoring: move all apps inside a sub folder
This commit is contained in:
1 parent
33e4fe0c4e
commit
b1ca2a7cff
41 files changed
+54
-45
No files matched your search
@@ -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
|
||||||
|
|
||||||
@@ -61,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,6 +6,11 @@ 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 or test suite.
|
||||||
@@ -13,24 +18,24 @@ 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`.
|
**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=`).
|
||||||
- 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`). `project.py` locates the repo root (dir with `manifest.json` + `Jellyfin.qml`, from cwd then from the module), libfbxqml and qmlscene. `tools/` now only holds `preview.qml`.
|
- 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`). `project.py` locates `REPO_DIR` (dir with `pyproject.toml` + `app/manifest.json`, from cwd then from the module) and `APP_DIR` (`app/`), libfbxqml and qmlscene. `tools/` now only holds `preview.qml`.
|
||||||
- `uv run freebox-jellyfin preview` — 1280×720 window via `tools/preview.qml`; `--fullscreen` runs `Jellyfin.qml` as the box would.
|
- `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.
|
- `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`
|
||||||
- `uv run freebox-jellyfin check` — 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. 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.
|
- **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 app` 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): 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`). 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`). Verified locally by replaying the `check` job's steps in a clean `ubuntu:24.04` container; the release job has not run yet.
|
||||||
|
|
||||||
**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`, excluding `tools/`, `src/`, `dist/` 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.
|
**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 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:
|
**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. 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
|
||||||
|
|
||||||
|
|||||||
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.
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.
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.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
File renamed without changes.
@@ -7,6 +7,8 @@
|
|||||||
Cette application permet d'utiliser jellyfin sur la freebox.
|
Cette application permet d'utiliser jellyfin sur la freebox.
|
||||||
|
|
||||||
|
|
||||||
|
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
|
# 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).
|
||||||
@@ -51,9 +53,9 @@ La commande sert les fichiers du projet au Player et affiche les logs de l'appli
|
|||||||
uv run freebox-jellyfin package # 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` (la commande 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).
|
||||||
|
|
||||||
La commande 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` :
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from .project import PROJECT_DIR, libfbxqml, qmlscene
|
from .project import APP_DIR, libfbxqml, qmlscene
|
||||||
|
|
||||||
# Messages attendus hors de la box : Settings de libfbxqml (pas d'objet App sur PC).
|
# Messages attendus hors de la box : Settings de libfbxqml (pas d'objet App sur PC).
|
||||||
EXPECTED = ("/libfbxqml/", "qml: Setting", "qml: Getting settings failed")
|
EXPECTED = ("/libfbxqml/", "qml: Setting", "qml: Getting settings failed")
|
||||||
@@ -38,7 +38,7 @@ def problems(output):
|
|||||||
def run(duration):
|
def run(duration):
|
||||||
lib, scene = libfbxqml(), qmlscene()
|
lib, scene = libfbxqml(), qmlscene()
|
||||||
server = _Server(
|
server = _Server(
|
||||||
("127.0.0.1", 0), functools.partial(_Quiet, directory=str(PROJECT_DIR)))
|
("127.0.0.1", 0), functools.partial(_Quiet, directory=str(APP_DIR)))
|
||||||
threading.Thread(target=server.serve_forever, daemon=True).start()
|
threading.Thread(target=server.serve_forever, daemon=True).start()
|
||||||
url = "http://127.0.0.1:%d/Jellyfin.qml" % server.server_address[1]
|
url = "http://127.0.0.1:%d/Jellyfin.qml" % server.server_address[1]
|
||||||
print("Chargement de %s pendant %g s…" % (url, duration), flush=True)
|
print("Chargement de %s pendant %g s…" % (url, duration), flush=True)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
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).
|
||||||
|
|
||||||
@@ -23,9 +23,9 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
from .project import PROJECT_DIR
|
from .project import APP_DIR, REPO_DIR
|
||||||
|
|
||||||
PROJECT_DIR = str(PROJECT_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"
|
||||||
|
|
||||||
@@ -87,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
|
||||||
@@ -158,7 +158,7 @@ def main(argv=None):
|
|||||||
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(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ def main(argv=None):
|
|||||||
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
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
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/ et src/ sont exclus : l'outillage 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é) ;
|
||||||
@@ -22,24 +22,21 @@ import sys
|
|||||||
import tarfile
|
import tarfile
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from .project import PROJECT_DIR
|
from .project import APP_DIR, REPO_DIR
|
||||||
|
|
||||||
PROJECT_DIR = str(PROJECT_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", "src"}
|
|
||||||
|
|
||||||
|
|
||||||
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)))
|
||||||
@@ -48,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"))
|
||||||
@@ -76,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)"
|
||||||
@@ -90,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())
|
||||||
@@ -123,7 +120,7 @@ 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))
|
||||||
|
|
||||||
|
|
||||||
@@ -140,7 +137,7 @@ def main(argv=None):
|
|||||||
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))
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from .project import PROJECT_DIR, libfbxqml, qmlscene
|
from .project import APP_DIR, REPO_DIR, libfbxqml, qmlscene
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
@@ -11,5 +11,5 @@ def main(argv=None):
|
|||||||
help="lance Jellyfin.qml en plein écran, comme sur la box (sinon fenêtre 1280x720)")
|
help="lance Jellyfin.qml en plein écran, comme sur la box (sinon fenêtre 1280x720)")
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
lib, scene = libfbxqml(), qmlscene()
|
lib, scene = libfbxqml(), qmlscene()
|
||||||
qml = PROJECT_DIR / ("Jellyfin.qml" if args.fullscreen else "tools/preview.qml")
|
qml = APP_DIR / "Jellyfin.qml" if args.fullscreen else REPO_DIR / "tools" / "preview.qml"
|
||||||
os.execv(scene, [scene, "-I", str(lib), str(qml)])
|
os.execv(scene, [scene, "-I", str(lib), str(qml)])
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
"""Emplacements partagés par les commandes : racine du projet QML, libfbxqml et qmlscene."""
|
"""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 os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@@ -6,20 +10,21 @@ from pathlib import Path
|
|||||||
|
|
||||||
|
|
||||||
def _find_root() -> Path:
|
def _find_root() -> Path:
|
||||||
"""Dossier contenant manifest.json : depuis le dossier courant, sinon depuis ce module."""
|
"""Dossier contenant app/manifest.json : depuis le dossier courant, sinon depuis ce module."""
|
||||||
for start in (Path.cwd(), Path(__file__).resolve().parent):
|
for start in (Path.cwd(), Path(__file__).resolve().parent):
|
||||||
for folder in (start, *start.parents):
|
for folder in (start, *start.parents):
|
||||||
if (folder / "manifest.json").is_file() and (folder / "Jellyfin.qml").is_file():
|
if (folder / "app" / "manifest.json").is_file() and (folder / "pyproject.toml").is_file():
|
||||||
return folder
|
return folder
|
||||||
sys.exit("Projet introuvable : lancez la commande depuis le dépôt Jellyfin-Freebox.")
|
sys.exit("Projet introuvable : lancez la commande depuis le dépôt Jellyfin-Freebox.")
|
||||||
|
|
||||||
|
|
||||||
PROJECT_DIR = _find_root()
|
REPO_DIR = _find_root()
|
||||||
|
APP_DIR = REPO_DIR / "app"
|
||||||
|
|
||||||
|
|
||||||
def libfbxqml() -> Path:
|
def libfbxqml() -> Path:
|
||||||
"""libfbxqml (module fbx.application en QML pur) : ../libfbxqml, ou $LIBFBXQML."""
|
"""libfbxqml (module fbx.application en QML pur) : ../libfbxqml, ou $LIBFBXQML."""
|
||||||
path = Path(os.environ.get("LIBFBXQML", PROJECT_DIR.parent / "libfbxqml"))
|
path = Path(os.environ.get("LIBFBXQML", REPO_DIR.parent / "libfbxqml"))
|
||||||
if not (path / "fbx").is_dir():
|
if not (path / "fbx").is_dir():
|
||||||
sys.exit("libfbxqml introuvable : git clone https://github.com/fbx/libfbxqml.git %s" % path)
|
sys.exit("libfbxqml introuvable : git clone https://github.com/fbx/libfbxqml.git %s" % path)
|
||||||
return path
|
return path
|
||||||
|
|||||||
+2
-2
@@ -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();
|
||||||
|
|||||||
Reference in new issue
Block a user