Convert effects to new single-file format
- dog: Convert to whole-video API with PEP 723 metadata - identity: Add as frame-by-frame effect Both now use @-tag docstrings for AI-readable metadata. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,27 @@
|
||||
# /// script
|
||||
# requires-python = ">=3.10"
|
||||
# dependencies = ["requests"]
|
||||
# ///
|
||||
"""
|
||||
Dog effect - returns dog.mkv regardless of input.
|
||||
@effect dog
|
||||
@version 1.0.0
|
||||
@author @giles@artdag.rose-ash.com
|
||||
@temporal true
|
||||
|
||||
This is a constant effect that fetches from an immutable URL.
|
||||
@description
|
||||
Returns dog.mkv regardless of input. This is a constant effect that
|
||||
fetches from an immutable URL and verifies the content hash.
|
||||
Demonstrates a whole-video effect that ignores its input.
|
||||
|
||||
@example
|
||||
(fx dog)
|
||||
"""
|
||||
|
||||
import hashlib
|
||||
import logging
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import requests
|
||||
|
||||
@@ -28,12 +41,13 @@ def file_hash(path: Path) -> str:
|
||||
return hasher.hexdigest()
|
||||
|
||||
|
||||
def effect_dog(input_path: Path, output_path: Path, config: Dict[str, Any]) -> Path:
|
||||
def process(input_paths: List[Path], output_path: Path, params: Dict[str, Any], ctx) -> Path:
|
||||
"""
|
||||
Dog effect - ignores input, returns dog.mkv.
|
||||
Whole-video API: ignores input, returns dog.mkv.
|
||||
|
||||
Downloads from immutable URL and verifies hash.
|
||||
"""
|
||||
output_path = Path(output_path)
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Output with correct extension
|
||||
@@ -74,11 +88,6 @@ def effect_dog(input_path: Path, output_path: Path, config: Dict[str, Any]) -> P
|
||||
|
||||
# Copy to output
|
||||
shutil.copy2(cached_file, actual_output)
|
||||
logger.debug(f"EFFECT dog: {input_path.name} -> {actual_output} (input ignored)")
|
||||
logger.debug(f"EFFECT dog: -> {actual_output} (input ignored)")
|
||||
|
||||
return actual_output
|
||||
|
||||
|
||||
# Export for registration
|
||||
effect = effect_dog
|
||||
name = "dog"
|
||||
|
||||
Reference in New Issue
Block a user