mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-17 15:43:28 +02:00
This PR enables the ruff rule for return type annotations (ANN), and adds the ty package for type checking.
49 lines
1.9 KiB
Python
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()
|