Task 1.4: Update provider classes to use key as primary identifier

- Enhanced download() method docstring in aniworld_provider.py
- Enhanced Download() method docstring in enhanced_provider.py
- Clarified that 'key' is the series unique identifier from provider
- Clarified that 'serie_folder'/'serieFolder' is filesystem folder name (metadata only)
- Added comprehensive Args, Returns, and Raises sections to docstrings
- Fixed PEP 8 line length issue in logging statement
- Verified existing code already uses 'key' for identification and logging
- All 34 provider-related tests pass successfully
- No functional changes required, documentation improvements only
This commit is contained in:
2025-11-23 17:51:32 +01:00
parent 920a5b0eaf
commit aeb1ebe7a2
4 changed files with 63 additions and 12 deletions

View File

@@ -13,10 +13,7 @@ import uuid
from typing import Callable, Iterable, Iterator, Optional
from src.core.entities.series import Serie
from src.core.exceptions.Exceptions import (
MatchNotFoundError,
NoKeyFoundException,
)
from src.core.exceptions.Exceptions import MatchNotFoundError, NoKeyFoundException
from src.core.interfaces.callbacks import (
CallbackManager,
CompletionContext,

View File

@@ -208,8 +208,26 @@ class AniworldLoader(Loader):
language: str = "German Dub",
progress_callback=None
) -> bool:
"""Download episode to specified directory."""
logging.info(f"Starting download for S{season:02}E{episode:03} ({key}) in {language}")
"""Download episode to specified directory.
Args:
base_directory: Base download directory path
serie_folder: Filesystem folder name (metadata only, used for
file path construction)
season: Season number
episode: Episode number
key: Series unique identifier from provider (used for
identification and API calls)
language: Audio language preference (default: German Dub)
progress_callback: Optional callback for download progress
Returns:
bool: True if download succeeded, False otherwise
"""
logging.info(
f"Starting download for S{season:02}E{episode:03} "
f"({key}) in {language}"
)
sanitized_anime_title = ''.join(
char for char in self.get_title(key)
if char not in self.INVALID_PATH_CHARS

View File

@@ -349,7 +349,27 @@ class EnhancedAniWorldLoader(Loader):
language: str = "German Dub",
progress_callback: Optional[Callable] = None,
) -> bool:
"""Download episode with comprehensive error handling."""
"""Download episode with comprehensive error handling.
Args:
baseDirectory: Base download directory path
serieFolder: Filesystem folder name (metadata only, used for
file path construction)
season: Season number (0 for movies)
episode: Episode number
key: Series unique identifier from provider (used for
identification and API calls)
language: Audio language preference (default: German Dub)
progress_callback: Optional callback for download progress
updates
Returns:
bool: True if download succeeded, False otherwise
Raises:
DownloadError: If download fails after all retry attempts
ValueError: If required parameters are missing or invalid
"""
self.download_stats["total_downloads"] += 1
try: