feat: Implement poster rendering options with ASCII, Viu, and RichPixels support

This commit is contained in:
sha
2026-01-04 18:35:30 +00:00
parent 9b353a7e7e
commit 442bde73e5
17 changed files with 416 additions and 135 deletions
+43
View File
@@ -0,0 +1,43 @@
"""Base class for poster renderers."""
from abc import ABC, abstractmethod
import os
class PosterRenderer(ABC):
"""Abstract base class for poster rendering implementations."""
@abstractmethod
def render(self, image_path: str, width: int = 40) -> str:
"""Render a poster image to a string.
Args:
image_path: Path to the poster image file
width: Desired width in characters
Returns:
Rendered poster as a string
"""
pass
def validate_image(self, image_path: str) -> tuple[bool, str]:
"""Validate that image file exists.
Args:
image_path: Path to validate
Returns:
Tuple of (is_valid, error_message)
"""
if not os.path.exists(image_path):
return False, f"Image file not found: {image_path}"
return True, ""
@abstractmethod
def is_available(self) -> tuple[bool, str]:
"""Check if this renderer is available on the system.
Returns:
Tuple of (is_available, message)
"""
pass