This commit is contained in:
2021-11-21 21:38:36 +03:00
parent 967b95593b
commit 04c85439a6
3 changed files with 6 additions and 6 deletions

View File

@@ -3,5 +3,5 @@ from typing import Protocol
class BaseDownloader(Protocol):
@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]:
...

View File

@@ -192,6 +192,6 @@ class FLDownloader(BaseDownloader):
return tasks[0].result()
@classmethod
async def download(cls, book_id: int, file_type: str, source_id: int) -> tuple[bytes, str]:
downloader = cls(book_id, file_type, source_id)
async def download(cls, remote_id: int, file_type: str, source_id: int) -> tuple[bytes, str]:
downloader = cls(remote_id, file_type, source_id)
return await downloader._download()

View File

@@ -12,11 +12,11 @@ router = APIRouter(
)
@router.get("/download/{source_id}/{book_id}/{file_type}")
async def download(source_id: int, book_id: int, file_type: str):
@router.get("/download/{source_id}/{remote_id}/{file_type}")
async def download(source_id: int, remote_id: int, file_type: str):
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(
content,