fix download api add save_path

This commit is contained in:
jxxghp
2024-09-23 17:52:06 +08:00
parent 9cfc27392d
commit 4bf7e05a3d

View File

@@ -29,6 +29,7 @@ def download(
media_in: schemas.MediaInfo,
torrent_in: schemas.TorrentInfo,
downloader: str = None,
save_path: str = None,
current_user: User = Depends(get_current_active_user)) -> Any:
"""
添加下载任务(含媒体信息)
@@ -47,7 +48,8 @@ def download(
media_info=mediainfo,
torrent_info=torrentinfo
)
did = DownloadChain().download_single(context=context, username=current_user.name, downloader=downloader)
did = DownloadChain().download_single(context=context, username=current_user.name,
downloader=downloader, save_path=save_path)
if not did:
return schemas.Response(success=False, message="任务添加失败")
return schemas.Response(success=True, data={
@@ -59,6 +61,7 @@ def download(
def add(
torrent_in: schemas.TorrentInfo,
downloader: str = None,
save_path: str = None,
current_user: User = Depends(get_current_active_user)) -> Any:
"""
添加下载任务(不含媒体信息)
@@ -78,7 +81,8 @@ def add(
media_info=mediainfo,
torrent_info=torrentinfo
)
did = DownloadChain().download_single(context=context, username=current_user.name, downloader=downloader)
did = DownloadChain().download_single(context=context, username=current_user.name,
downloader=downloader, save_path=save_path)
if not did:
return schemas.Response(success=False, message="任务添加失败")
return schemas.Response(success=True, data={