Skip to content

Commit

Permalink
feat: add search_imdbid in subscribe api
Browse files Browse the repository at this point in the history
  • Loading branch information
WangEdward committed Feb 23, 2024
1 parent d28f3ed commit b8553e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions app/api/endpoints/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ def create_subscribe(
username=current_user.name,
best_version=subscribe_in.best_version,
save_path=subscribe_in.save_path,
search_imdbid=subscribe_in.search_imdbid,
exist_ok=True)
return schemas.Response(success=True if sid else False, message=message, data={
"id": sid
})
return schemas.Response(
success=bool(sid), message=message, data={"id": sid}
)


@router.put("/", summary="更新订阅", response_model=schemas.Response)
Expand Down
3 changes: 2 additions & 1 deletion app/chain/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ def search(self, sid: int = None, state: str = 'N', manual: bool = False):
no_exists=no_exists,
sites=sites,
priority_rule=priority_rule,
filter_rule=filter_rule)
filter_rule=filter_rule,
area="imdbid" if subscribe.search_imdbid else "title")
if not contexts:
logger.warn(f'订阅 {subscribe.keyword or subscribe.name} 未搜索到资源')
self.finish_subscribe_or_not(subscribe=subscribe, meta=meta,
Expand Down

0 comments on commit b8553e2

Please sign in to comment.