Merge pull request #1234 from thsrite/main

This commit is contained in:
jxxghp
2023-12-14 06:28:50 +08:00
committed by GitHub
5 changed files with 41 additions and 3 deletions

View File

@ -82,6 +82,7 @@ def create_subscribe(
doubanid=subscribe_in.doubanid,
username=current_user.name,
best_version=subscribe_in.best_version,
save_path=subscribe_in.save_path,
exist_ok=True)
return schemas.Response(success=True if sid else False, message=message, data={
"id": sid

View File

@ -320,7 +320,8 @@ class SubscribeChain(ChainBase):
downloads, lefts = self.downloadchain.batch_download(
contexts=matched_contexts,
no_exists=no_exists,
username=subscribe.username
username=subscribe.username,
save_path=subscribe.save_path
)
# 判断是否应完成订阅
@ -674,8 +675,10 @@ 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,
username=subscribe.username)
downloads, lefts = self.downloadchain.batch_download(contexts=_match_context,
no_exists=no_exists,
username=subscribe.username,
save_path=subscribe.save_path)
# 判断是否要完成订阅
self.finish_subscribe_or_not(subscribe=subscribe, meta=meta, mediainfo=mediainfo,
downloads=downloads, lefts=lefts)

View File

@ -65,6 +65,8 @@ class Subscribe(Base):
best_version = Column(Integer, default=0)
# 当前优先级
current_priority = Column(Integer)
# 保存路径
save_path = Column(String)
@staticmethod
@db_query

View File

@ -57,6 +57,8 @@ class Subscribe(BaseModel):
best_version: Optional[int] = 0
# 当前优先级
current_priority: Optional[int] = None
# 保存路径
save_path: Optional[str] = None
class Config:
orm_mode = True