Spaces:
Running
Running
File size: 1,101 Bytes
ed37502 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | """Abstract base class for content publishers."""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass
from pathlib import Path
@dataclass
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).
"""
@property
@abstractmethod
def platform_name(self) -> str:
"""Platform identifier (e.g., 'fanvue')."""
@abstractmethod
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."""
@abstractmethod
async def is_authenticated(self) -> bool:
"""Check if we have valid credentials for the platform."""
|