Shenrui-Ma/video-regen-recipes / templates/character-short/bit-by-bit-heartache
bit-by-bit-heartache
Verified用角色参考图在本机制作 Heartache 连续动作配乐短片.
tests/test_media_preflight.py
View on GitHub"""CPU-only checks of the FFmpeg selected by this process's PATH."""
import importlib
import json
import os
from pathlib import Path
import shutil
import subprocess
import sys
import tempfile
import unittest
from unittest.mock import patch
RUNTIME = Path(__file__).resolve().parents[1] / 'scripts/runtime'
sys.path.insert(0, str(RUNTIME))
class MediaPreflightTests(unittest.TestCase):
@unittest.skipUnless(os.name == 'posix', 'executable PATH fixture needs POSIX')
def test_path_encoder_failure_is_actionable_not_a_capability_listing(self):
media = importlib.import_module('media')
with tempfile.TemporaryDirectory() as tmp:
tool = Path(tmp) / 'ffmpeg'
log = Path(tmp) / 'arguments.json'
tool.write_text('#!' + sys.executable + '\nimport json, sys\n'
+ 'open(' + repr(str(log)) + ', "w").write(json.dumps(sys.argv[1:]))\n'
+ 'print("AAC encoder is experimental", file=sys.stderr)\nsys.exit(1)\n')
tool.chmod(0o755)
with patch.dict(os.environ, {'PATH': tmp + os.pathsep + os.environ['PATH']}):
with self.assertRaisesRegex(ValueError, 'FFMPEG_AAC_PREFLIGHT_FAILED.*experimental.*PATH'):
media.preflight_media()
args = json.loads(log.read_text())
self.assertIn('aac', args)
self.assertNotIn('-encoders', args)
self.assertNotIn('-strict', args)
self.assertFalse(Path(args[-1]).parent.exists(), 'preflight temporary files leaked')
@unittest.skipUnless(shutil.which('ffmpeg') and shutil.which('ffprobe'), 'ffmpeg needed')
def test_real_aac_encode_probe_and_decode(self):
media = importlib.import_module('media')
self.assertTrue(hasattr(media, 'preflight_media'), 'actual AAC preflight missing')
receipt = media.preflight_media()
self.assertEqual(receipt['codec_name'], 'aac')
self.assertEqual(receipt['sample_rate'], '44100')
self.assertEqual(receipt['channels'], 2)
self.assertTrue(receipt['full_decode'])
self.assertFalse(receipt['inference'])
if __name__ == '__main__':
unittest.main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |