feat: Add batch download for entire anime seasons

Add ability to download all episodes of a season with one click.

Backend changes:
- New POST /api/anime/download-season endpoint
- Retrieves all episodes and creates download tasks for each
- Returns list of task IDs and total episode count

Frontend changes:
- Add "Toute la saison" button next to episode selector
- Button shown immediately when episodes are loaded
- Confirmation dialog before starting batch download
- Success message showing number of episodes queued

Features:
- Respects max_parallel limit (default: 3 concurrent downloads)
- Proper episode naming (e.g., "Hells Paradise - Episode 01.mp4")
- Works with all anime providers (Anime-Sama, Anime-Ultime, etc.)

Example usage:
- Click "Toute la saison" button on any anime card
- Confirm the dialog
- All episodes are queued and download automatically

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
root
2026-01-23 08:40:33 +00:00
parent c977306020
commit 40977438ff
2 changed files with 65 additions and 9 deletions
+30
View File
@@ -259,6 +259,36 @@ async def download_anime_episode(
return {"task_id": task.id, "task": task}
@app.post("/api/anime/download-season")
async def download_anime_season(
url: str,
background_tasks: BackgroundTasks,
lang: str = "vostfr"
):
"""Download all episodes of an anime season"""
from app.downloaders import get_downloader
downloader = get_downloader(url)
episodes = await downloader.get_episodes(url, lang)
if not episodes:
raise HTTPException(status_code=404, detail="No episodes found")
# Create download tasks for all episodes
task_ids = []
for episode in episodes:
request = DownloadRequest(url=episode['url'])
task = download_manager.create_task(request)
task_ids.append(task.id)
background_tasks.add_task(download_manager.start_download, task.id)
return {
"message": f"Started downloading {len(task_ids)} episodes",
"task_ids": task_ids,
"total_episodes": len(episodes)
}
# Video Streaming endpoints
@app.get("/video/{task_id}")
async def stream_video(task_id: str, request: Request):