Files
MediaManager-maxdorninger-1/media_manager/indexer/indexers/generic.py
Maximilian Dorninger a39e0d204a Ruff enable type annotations rule (#362)
This PR enables the ruff rule for return type annotations (ANN), and
adds the ty package for type checking.
2026-01-06 17:07:19 +01:00

49 lines
1.9 KiB
Python

from abc import ABC, abstractmethod
from media_manager.indexer.schemas import IndexerQueryResult
from media_manager.movies.schemas import Movie
from media_manager.tv.schemas import Show
class GenericIndexer(ABC):
name: str
def __init__(self, name: str) -> None:
self.name = name
@abstractmethod
def search(self, query: str, is_tv: bool) -> list[IndexerQueryResult]:
"""
Sends a search request to the Indexer and returns the results.
:param query: A string representing the search query.
:param is_tv: A boolean indicating whether the search is for TV shows (True) or movies (False).
:return: A list of IndexerQueryResult objects representing the search results.
"""
raise NotImplementedError()
@abstractmethod
def search_season(
self, query: str, show: Show, season_number: int
) -> list[IndexerQueryResult]:
"""
Sends a search request to the Indexer for a specific season and returns the results.
:param query: A string representing the search query, used as a fallback for indexers that don't support TMDB/IMDB ID-based search.
:param show: The show to search for.
:param season_number: The season number to search for.
:return: A list of IndexerQueryResult objects representing the search results.
"""
raise NotImplementedError()
@abstractmethod
def search_movie(self, query: str, movie: Movie) -> list[IndexerQueryResult]:
"""
Sends a search request to the Indexer for a specific movie and returns the results.
:param movie: The movie to search for.
:param query: A string representing the search query, used as a fallback for indexers that don't support TMDB/IMDB ID-based search.
:return: A list of IndexerQueryResult objects representing the search results.
"""
raise NotImplementedError()