build: bundle playback and YouTube dependencies
Build pinned LGPL playback libraries and package standalone YouTube helpers inside the signed native app. Keep the CLI inside the app and relocate private library links for installation without runtime Homebrew dependencies. Record adaptive fixture completion in its EXIT trap: cancellation can exit with status 143 before the TERM trap writes its marker, while native pause and quality preservation remain correct.
This commit is contained in:
@@ -5,7 +5,6 @@ import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
@@ -16,19 +15,19 @@ def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("binary", type=Path)
|
||||
parser.add_argument("fixtures", type=Path)
|
||||
parser.add_argument("app", type=Path)
|
||||
args = parser.parse_args()
|
||||
extractor = shutil.which("yt-dlp")
|
||||
if extractor is None:
|
||||
extractor = next((str(path) for path in (Path("/opt/homebrew/bin/yt-dlp"), Path("/usr/local/bin/yt-dlp"))
|
||||
if os.access(path, os.X_OK)), None)
|
||||
if extractor is None:
|
||||
print("SKIP native adaptive playback: yt-dlp is not installed; controlled-clock policy checks still run")
|
||||
return 0
|
||||
macOS = args.app.resolve() / "Contents/MacOS"
|
||||
extractor = str(macOS / "yt-dlp")
|
||||
runtime = macOS / "deno"
|
||||
if not os.access(extractor, os.X_OK) or not os.access(runtime, os.X_OK):
|
||||
parser.error("Missing bundled YouTube helpers; build the app first")
|
||||
required = ("quality-1080.mp4", "quality-720.mp4")
|
||||
if any(not (args.fixtures / name).is_file() for name in required):
|
||||
parser.error("Missing real quality playback fixtures")
|
||||
with StreamingServer(args.fixtures) as server, tempfile.TemporaryDirectory(prefix="terebi-quality-check-") as directory:
|
||||
root = Path(directory)
|
||||
(root / "deno").symlink_to(runtime)
|
||||
formats = []
|
||||
for height, width in ((720, 1280), (1080, 1920)):
|
||||
path = "/media/quality-720.mp4" if height == 720 else "/stall/quality-low/quality-1080.mp4?after_seconds=2"
|
||||
@@ -53,11 +52,10 @@ def main():
|
||||
+ ' if [[ -f "$control/gate-1080" ]]; then\n'
|
||||
+ " " + shlex.quote(extractor) + " --load-info-json " + shlex.quote(str(metadata))
|
||||
+ ' "${args[@]:0:${#args[@]}-2}" > "$control/output-1080.json"\n'
|
||||
+ ' trap \': > "$control/finished-1080"; exit 0\' TERM\n'
|
||||
+ ' trap \': > "$control/finished-1080"\' EXIT\n'
|
||||
+ ' : > "$control/entered-1080"\n'
|
||||
+ ' while [[ ! -f "$control/release-1080" ]]; do sleep 0.01; done\n'
|
||||
+ ' cat "$control/output-1080.json" || true\n'
|
||||
+ ' : > "$control/finished-1080"\n'
|
||||
+ ' exit 0\n'
|
||||
+ ' fi\n'
|
||||
+ 'fi\nexec ' + shlex.quote(extractor)
|
||||
|
||||
Reference in New Issue
Block a user