Spaces:
Running
Running
| """Abstract base class for content publishers.""" | |
| from __future__ import annotations | |
| from abc import ABC, abstractmethod | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| class PublishResult: | |
| """Result of a publish operation.""" | |
| success: bool | |
| platform: str | |
| post_url: str | None = None | |
| error_message: str | None = None | |
| class Publisher(ABC): | |
| """Abstract interface for publishing to content platforms. | |
| Implementations can use direct API calls or browser automation (Playwright). | |
| """ | |
| def platform_name(self) -> str: | |
| """Platform identifier (e.g., 'fanvue').""" | |
| async def publish( | |
| self, | |
| *, | |
| image_path: Path, | |
| caption: str, | |
| content_rating: str = "sfw", | |
| is_teaser: bool = False, | |
| tags: list[str] | None = None, | |
| ) -> PublishResult: | |
| """Publish a single image to the platform.""" | |
| async def is_authenticated(self) -> bool: | |
| """Check if we have valid credentials for the platform.""" | |