61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
"""Subtitle repository interfaces (abstract)."""
|
|
from abc import ABC, abstractmethod
|
|
from typing import List, Optional
|
|
|
|
from ..shared.value_objects import ImdbId
|
|
from .entities import Subtitle
|
|
from .value_objects import Language
|
|
|
|
|
|
class SubtitleRepository(ABC):
|
|
"""
|
|
Abstract repository for subtitle persistence.
|
|
|
|
This defines the interface that infrastructure implementations must follow.
|
|
"""
|
|
|
|
@abstractmethod
|
|
def save(self, subtitle: Subtitle) -> None:
|
|
"""
|
|
Save a subtitle to the repository.
|
|
|
|
Args:
|
|
subtitle: Subtitle entity to save
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_media(
|
|
self,
|
|
media_imdb_id: ImdbId,
|
|
language: Optional[Language] = None,
|
|
season: Optional[int] = None,
|
|
episode: Optional[int] = None
|
|
) -> List[Subtitle]:
|
|
"""
|
|
Find subtitles for a media item.
|
|
|
|
Args:
|
|
media_imdb_id: IMDb ID of the media
|
|
language: Optional language filter
|
|
season: Optional season number (for TV shows)
|
|
episode: Optional episode number (for TV shows)
|
|
|
|
Returns:
|
|
List of matching subtitles
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete(self, subtitle: Subtitle) -> bool:
|
|
"""
|
|
Delete a subtitle from the repository.
|
|
|
|
Args:
|
|
subtitle: Subtitle to delete
|
|
|
|
Returns:
|
|
True if deleted, False if not found
|
|
"""
|
|
pass
|