chore: phase 5 wrap-up (platform-v2 5.99)
- THIRD_PARTY_NOTICES.md in the backend image: FFmpeg (GPL v3, via imageio-ffmpeg) - video.requeue_missing(): videos whose still frame is gone (a partial restore) are prepared again when the backend starts (+1 test, backend 542 passed) - pack README: data/media belongs in every site backup with pos.db - stack.mjs: the test video is unique per run (the stack keeps its data between runs) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Third-party software shipped in the backend image
|
||||
|
||||
Xenia POS's own code is not covered by this file. It lists separate programs that are shipped
|
||||
inside the backend image and run by it as separate processes.
|
||||
|
||||
## FFmpeg
|
||||
|
||||
- **What it does here:** makes the still frame and the screen-friendly version of uploaded
|
||||
videos (`services/video.py`, plan step 5.4e). The backend starts it as a separate program and
|
||||
reads its output; nothing of FFmpeg is linked into Xenia's code.
|
||||
- **Where it comes from:** the `imageio-ffmpeg` Python package, version pinned in
|
||||
`requirements.txt` (0.8.1). The package carries one static FFmpeg build per platform
|
||||
(Linux x86-64 / ARM64: FFmpeg 9.0.2 built by the imageio project from the BtbN FFmpeg-Builds
|
||||
scripts; Windows: the gyan.dev "essentials" build). Inside the image the program is at
|
||||
`/usr/local/lib/python3.12/site-packages/imageio_ffmpeg/binaries/`.
|
||||
- **Licence:** FFmpeg is free software under the **GNU General Public License, version 3 or
|
||||
later** (built with `--enable-gpl --enable-version3`, no non-free parts). It includes x264
|
||||
(GPL v2 or later) and other libraries under the GPL / LGPL. The full licence text:
|
||||
<https://www.gnu.org/licenses/gpl-3.0.txt>. `ffmpeg -L` prints the licence of the build.
|
||||
- **Source code:** FFmpeg: <https://ffmpeg.org/download.html> (git tag `n9.0.2`). Build scripts:
|
||||
<https://github.com/BtbN/FFmpeg-Builds> and <https://github.com/imageio/imageio-ffmpeg>.
|
||||
On request we provide the exact corresponding source of the FFmpeg build shipped with any
|
||||
Xenia POS release, for at least three years after that release.
|
||||
- **The package around it** (`imageio-ffmpeg`): BSD 2-Clause licence,
|
||||
Copyright (c) 2019-2025, imageio.
|
||||
@@ -281,6 +281,25 @@ def _loop() -> None:
|
||||
_wake.clear()
|
||||
|
||||
|
||||
def requeue_missing(db=None) -> int:
|
||||
"""Videos marked done whose still frame is missing (a restore without all of data/media):
|
||||
made again. → how many."""
|
||||
from database import SessionLocal
|
||||
from models.media import Media
|
||||
own = db is None
|
||||
db = db or SessionLocal()
|
||||
try:
|
||||
n = 0
|
||||
for m in db.query(Media).filter(Media.kind == "video", Media.processing == "done"):
|
||||
if store.original_path(m.sha256) and not os.path.exists(store.variant_path(m.sha256, "thumb")):
|
||||
m.processing, n = "waiting", n + 1
|
||||
db.commit()
|
||||
return n
|
||||
finally:
|
||||
if own:
|
||||
db.close()
|
||||
|
||||
|
||||
def start_worker() -> None:
|
||||
"""main.py: one background thread. With no tool, waiting videos are just played as uploaded."""
|
||||
if not available():
|
||||
@@ -295,6 +314,7 @@ def start_worker() -> None:
|
||||
db.close()
|
||||
logger.warning("video versions: no ffmpeg on this server; videos play as uploaded")
|
||||
return
|
||||
requeue_missing()
|
||||
threading.Thread(target=_loop, daemon=True, name="video-versions").start()
|
||||
logger.info("video versions: worker started (%s)", ffmpeg())
|
||||
|
||||
|
||||
@@ -154,3 +154,15 @@ def test_a_mov_is_taken_as_a_video(client, owner_h, media_dir):
|
||||
m = up(client, owner_h, data, name="IMG_1.MOV", ctype="video/quicktime").json()
|
||||
assert (m["kind"], m["content_type"], m["duration_ms"]) == ("video", "video/quicktime", 12500)
|
||||
assert m["urls"]["original"].endswith("/original")
|
||||
|
||||
|
||||
@needs_tool
|
||||
def test_after_a_partial_restore_a_video_is_prepared_again(client, db, owner_h, media_dir, tmp_path):
|
||||
m = up(client, owner_h, tv_video(tmp_path), name="ready.mp4", ctype="video/mp4").json()
|
||||
video.process_next(db)
|
||||
folder = os.path.join(str(media_dir), m["sha256"][:2], m["sha256"])
|
||||
for n in ("thumb.webp", "card.webp", "full.webp"):
|
||||
os.remove(os.path.join(folder, n))
|
||||
assert video.requeue_missing(db) == 1 and video.process_next(db) is True
|
||||
assert set(client.get(f"/api/media/{m['id']}", headers=owner_h).json()["urls"]) == {"original", "thumb", "card", "full"}
|
||||
assert video.requeue_missing(db) == 0
|
||||
|
||||
Reference in New Issue
Block a user