removed cancel request

This commit is contained in:
2025-12-30 20:36:02 +01:00
parent 803f35ef39
commit ff9dea0488
5 changed files with 9 additions and 84 deletions

View File

@@ -198,25 +198,7 @@ class SeriesApp:
def scan_status(self, value):
"""Set scan_status event handler."""
self._events.scan_status = value
def request_download_cancel(self) -> None:
"""Request cancellation of any ongoing download.
This method signals the download provider to stop any active
downloads. The actual cancellation happens asynchronously in
the progress hook of the downloader.
"""
logger.info("Requesting download cancellation")
self.loader.request_cancel()
def reset_download_cancel(self) -> None:
"""Reset the download cancellation flag.
Should be called before starting a new download to ensure
it's not immediately cancelled.
"""
self.loader.reset_cancel()
def load_series_from_list(self, series: list) -> None:
"""
Load series into the in-memory list.
@@ -304,8 +286,6 @@ class SeriesApp:
lookups. The 'serie_folder' parameter is only used for
filesystem operations.
"""
# Reset cancel flag before starting new download
self.reset_download_cancel()
logger.info(
"Starting download: %s (key: %s) S%02dE%02d",

View File

@@ -203,31 +203,7 @@ class AniworldLoader(Loader):
is_available = language_code in languages
logging.debug(f"Available languages for S{season:02}E{episode:03}: {languages}, requested: {language_code}, available: {is_available}")
return is_available
def request_cancel(self) -> None:
"""Request cancellation of any ongoing download.
Sets the internal cancellation flag. Downloads will check this
flag periodically and abort if set.
"""
logging.info("Download cancellation requested")
self._cancel_flag.set()
def reset_cancel(self) -> None:
"""Reset the cancellation flag.
Should be called before starting a new download.
"""
self._cancel_flag.clear()
def is_cancelled(self) -> bool:
"""Check if cancellation has been requested.
Returns:
bool: True if cancellation was requested
"""
return self._cancel_flag.is_set()
return is_available
def download(
self,

View File

@@ -4,29 +4,17 @@ from typing import Any, Callable, Dict, List, Optional
class Loader(ABC):
"""Abstract base class for anime data loaders/providers."""
@abstractmethod
def request_cancel(self) -> None:
"""Request cancellation of any ongoing download.
Sets an internal flag that downloads should check periodically
and abort if set. This enables graceful shutdown.
def subscribe_download_progress(self, handler):
"""Subscribe a handler to the download_progress event.
Args:
handler: Callable to be called with progress dict.
"""
@abstractmethod
def reset_cancel(self) -> None:
"""Reset the cancellation flag.
Should be called before starting a new download to ensure
it's not immediately cancelled.
"""
@abstractmethod
def is_cancelled(self) -> bool:
"""Check if cancellation has been requested.
Returns:
bool: True if cancellation was requested
def unsubscribe_download_progress(self, handler):
"""Unsubscribe a handler from the download_progress event.
Args:
handler: Callable previously subscribed.
"""
@abstractmethod