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:
@@ -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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user