mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 15:05:37 +01:00
Fix
This commit is contained in:
@@ -3,5 +3,5 @@ from typing import Protocol
|
|||||||
|
|
||||||
class BaseDownloader(Protocol):
|
class BaseDownloader(Protocol):
|
||||||
@classmethod
|
@classmethod
|
||||||
async def download(cls, book_id: int, file_type: str, source_id: int) -> tuple[bytes, str]:
|
async def download(cls, remote_id: int, file_type: str, source_id: int) -> tuple[bytes, str]:
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -192,6 +192,6 @@ class FLDownloader(BaseDownloader):
|
|||||||
return tasks[0].result()
|
return tasks[0].result()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def download(cls, book_id: int, file_type: str, source_id: int) -> tuple[bytes, str]:
|
async def download(cls, remote_id: int, file_type: str, source_id: int) -> tuple[bytes, str]:
|
||||||
downloader = cls(book_id, file_type, source_id)
|
downloader = cls(remote_id, file_type, source_id)
|
||||||
return await downloader._download()
|
return await downloader._download()
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ router = APIRouter(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/download/{source_id}/{book_id}/{file_type}")
|
@router.get("/download/{source_id}/{remote_id}/{file_type}")
|
||||||
async def download(source_id: int, book_id: int, file_type: str):
|
async def download(source_id: int, remote_id: int, file_type: str):
|
||||||
downloader = await DownloadersManager.get_downloader(source_id)
|
downloader = await DownloadersManager.get_downloader(source_id)
|
||||||
|
|
||||||
content, filename = await downloader.download(book_id, file_type, source_id)
|
content, filename = await downloader.download(remote_id, file_type, source_id)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
content,
|
content,
|
||||||
|
|||||||
Reference in New Issue
Block a user