diff --git a/app/api/endpoints/download.py b/app/api/endpoints/download.py index ee130595..ef555fd5 100644 --- a/app/api/endpoints/download.py +++ b/app/api/endpoints/download.py @@ -45,7 +45,7 @@ def add_downloading( media_info=mediainfo, torrent_info=torrentinfo ) - did = DownloadChain().download_single(context=context, username=current_user.name) + did = DownloadChain().download_single(context=context, userid=current_user.name, username=current_user.name) return schemas.Response(success=True if did else False, data={ "download_id": did }) diff --git a/app/chain/download.py b/app/chain/download.py index b08b899d..b427c5db 100644 --- a/app/chain/download.py +++ b/app/chain/download.py @@ -408,8 +408,8 @@ class DownloadChain(ChainBase): # 如果是电影,直接下载 for context in contexts: if context.media_info.type == MediaType.MOVIE: - if self.download_single(context, save_path=save_path, - channel=channel, userid=userid, username=username): + if self.download_single(context, save_path=save_path, channel=channel, + userid=userid, username=username): # 下载成功 downloaded_list.append(context) @@ -482,8 +482,9 @@ class DownloadChain(ChainBase): ) else: # 下载 - download_id = self.download_single(context, save_path=save_path, - channel=channel, userid=userid, username=username) + download_id = self.download_single(context, + save_path=save_path, channel=channel, + userid=userid, username=username) if download_id: # 下载成功 @@ -545,8 +546,9 @@ class DownloadChain(ChainBase): # 为需要集的子集则下载 if torrent_episodes.issubset(set(need_episodes)): # 下载 - download_id = self.download_single(context, save_path=save_path, - channel=channel, userid=userid, username=username) + download_id = self.download_single(context, + save_path=save_path, channel=channel, + userid=userid, username=username) if download_id: # 下载成功 downloaded_list.append(context) diff --git a/app/chain/subscribe.py b/app/chain/subscribe.py index 2aa5b8ff..c0efc600 100644 --- a/app/chain/subscribe.py +++ b/app/chain/subscribe.py @@ -323,6 +323,7 @@ class SubscribeChain(ChainBase): downloads, lefts = self.downloadchain.batch_download( contexts=matched_contexts, no_exists=no_exists, + userid=subscribe.username, username=subscribe.username, save_path=subscribe.save_path ) @@ -708,6 +709,7 @@ class SubscribeChain(ChainBase): logger.info(f'{mediainfo.title_year} 匹配完成,共匹配到{len(_match_context)}个资源') downloads, lefts = self.downloadchain.batch_download(contexts=_match_context, no_exists=no_exists, + userid=subscribe.username, username=subscribe.username, save_path=subscribe.save_path) # 判断是否要完成订阅