mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 11:33:25 +00:00
feat: Implement poster rendering options with ASCII, Viu, and RichPixels support
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user