Refactoring: move all apps inside a sub folder
CI / Release Gitea (push) Successful in 32s
CI / Vérifications et paquet (push) Successful in 47s

This commit is contained in:
stilobique committed 2026-11-08 14:28:28 +01:00
1 parent 33e4fe0c4e
commit b1ca2a7cff
41 files changed
+54 -45

No files matched your search

+2 -2
View File
@@ -13,7 +13,7 @@ import sys
import tempfile
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).
EXPECTED = ("/libfbxqml/", "qml: Setting", "qml: Getting settings failed")
@@ -38,7 +38,7 @@ def problems(output):
def run(duration):
lib, scene = libfbxqml(), qmlscene()
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()
url = "http://127.0.0.1:%d/Jellyfin.qml" % server.server_address[1]
print("Chargement de %s pendant %g s…" % (url, duration), flush=True)
+6 -6
View File
@@ -2,7 +2,7 @@
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 ;
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 ;
4. affiche stdout/stderr de l'application jusqu'à sa fermeture (ou Ctrl+C).
@@ -23,9 +23,9 @@ import threading
import time
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_TYPE = "fbx:devel"
@@ -87,7 +87,7 @@ class QuietHandler(http.server.SimpleHTTPRequestHandler):
def serve_project(bind_ip, verbose, dev_config=None):
QuietHandler.verbose = verbose
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)
threading.Thread(target=server.serve_forever, daemon=True).start()
return server
@@ -158,7 +158,7 @@ def main(argv=None):
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, "
"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)")
args = parser.parse_args(argv)
@@ -189,7 +189,7 @@ def main(argv=None):
server = serve_project(me, args.verbose, dev_config)
port = server.server_address[1]
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:
print("Serveurs de test proposés à l'app : %s" % ", ".join(args.server))
if users: # les mots de passe ne sont jamais affichés
+12 -15
View File
@@ -3,7 +3,7 @@
Reproduit « Outils > Freebox SDK > Make FreeStore Package » du plugin QtCreator Freebox
(github.com/fbx/freebox-qtcreator-plugin, src/freestorepackager.cc) :
- 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,
points d'entrée existants), JSON valides,
syntaxe QML/JS (qmllint, s'il est installé) ;
@@ -22,24 +22,21 @@ import sys
import tarfile
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).
EXTENSIONS = {".qml", ".js", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".bmp", ".webp",
".ttf", ".otf", ".woff"}
NAMES = {"qmldir", "manifest.json"}
EXCLUDED_DIRS = {"tools", "dist", "src"}
def collect_files():
files = []
for root, dirs, names in os.walk(PROJECT_DIR):
rel_root = os.path.relpath(root, PROJECT_DIR)
# Dossiers cachés (.git, .idea…) et dossiers d'outillage exclus.
dirs[:] = sorted(d for d in dirs if not d.startswith(".")
and not (rel_root == "." and d in EXCLUDED_DIRS))
for root, dirs, names in os.walk(APP_DIR):
rel_root = os.path.relpath(root, APP_DIR)
dirs[:] = sorted(d for d in dirs if not d.startswith(".")) # dossiers cachés exclus
for name in sorted(names):
if name in NAMES or os.path.splitext(name)[1].lower() in EXTENSIONS:
files.append(os.path.normpath(os.path.join(rel_root, name)))
@@ -48,7 +45,7 @@ def collect_files():
def check_manifest(files):
"""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):
raise ValueError("manifest.json manquant")
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):
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.
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)
if not client or client.group(1) != version:
raise ValueError("version du manifest (%s) différente de Session.clientVersion (%s)"
@@ -90,12 +87,12 @@ def check_manifest(files):
def check_sources(files):
for name in files:
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")
if not qmllint:
print("Attention : qmllint introuvable, syntaxe QML/JS non vérifiée.")
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)
if result.returncode != 0:
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:
seen_dirs.add(directory)
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))
@@ -140,7 +137,7 @@ def main(argv=None):
sys.exit("Paquet non créé : %s" % error)
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)
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))
+2 -2
View File
@@ -2,7 +2,7 @@
import argparse
import os
from .project import PROJECT_DIR, libfbxqml, qmlscene
from .project import APP_DIR, REPO_DIR, libfbxqml, qmlscene
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)")
args = parser.parse_args(argv)
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)])
+10 -5
View File
@@ -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 shutil
import sys
@@ -6,20 +10,21 @@ from pathlib import 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 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
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:
"""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():
sys.exit("libfbxqml introuvable : git clone https://github.com/fbx/libfbxqml.git %s" % path)
return path