kaledonya clips: a Discord-friendly clip site on top of Zipline
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
e6f8905377
34 files changed
+2917
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from app.remux import remux_to_mp4
|
||||
|
||||
needs_ffmpeg = pytest.mark.skipif(shutil.which("ffmpeg") is None, reason="ffmpeg not installed")
|
||||
|
||||
|
||||
def make_mkv(path):
|
||||
subprocess.run(
|
||||
["ffmpeg", "-v", "error", "-y",
|
||||
"-f", "lavfi", "-i", "testsrc=size=320x240:rate=30",
|
||||
"-f", "lavfi", "-i", "sine=frequency=440",
|
||||
"-t", "1", "-c:v", "libx264", "-c:a", "aac", str(path)],
|
||||
check=True,
|
||||
)
|
||||
|
||||
|
||||
@needs_ffmpeg
|
||||
def test_remux_good_mkv(tmp_path):
|
||||
src, dst = tmp_path / "in.mkv", tmp_path / "out.mp4"
|
||||
make_mkv(src)
|
||||
assert remux_to_mp4(src, dst) is True
|
||||
assert dst.read_bytes()[4:8] == b"ftyp"
|
||||
|
||||
|
||||
def test_remux_garbage_returns_false(tmp_path):
|
||||
src, dst = tmp_path / "in.mkv", tmp_path / "out.mp4"
|
||||
src.write_bytes(b"not a video at all")
|
||||
assert remux_to_mp4(src, dst) is False
|
||||
assert not dst.exists()
|
||||
|
||||
|
||||
def test_remux_missing_ffmpeg_returns_false(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("PATH", "")
|
||||
src, dst = tmp_path / "in.mkv", tmp_path / "out.mp4"
|
||||
src.write_bytes(b"x")
|
||||
assert remux_to_mp4(src, dst) is False
|
||||
Reference in new issue
Block a user