This commit is contained in:
jxxghp
2023-07-10 23:34:38 +08:00
parent ed4fc0845f
commit bfddd98ae2
4 changed files with 32 additions and 5 deletions

View File

@ -82,11 +82,16 @@ def schedule(_: schemas.TokenPayload = Depends(verify_token)) -> Any:
continue
if not StringUtils.is_chinese(job.name):
continue
next_run = TimerUtils.time_difference(job.next_run_time)
if not next_run:
status = "已停止"
else:
status = "等待" if job.pending else "运行中"
schedulers.append(schemas.ScheduleInfo(
id=job.id,
name=job.name,
status="等待" if job.pending else "运行中",
next_run=TimerUtils.time_difference(job.next_run_time) or "已停止"
status=status,
next_run=next_run
))
return schedulers

View File

@ -45,8 +45,8 @@ class SearchChain(ChainBase):
results = self.process(mediainfo=mediainfo)
# 保存眲结果
self.systemconfig.set(SystemConfigKey.SearchResults,
pickle.dumps(results or []))
return results or []
pickle.dumps(results))
return results
def search_by_title(self, title: str) -> List[TorrentInfo]:
"""
@ -84,7 +84,7 @@ class SearchChain(ChainBase):
def process(self, mediainfo: MediaInfo,
keyword: str = None,
no_exists: Dict[int, Dict[int, NotExistMediaInfo]] = None) -> Optional[List[Context]]:
no_exists: Dict[int, Dict[int, NotExistMediaInfo]] = None) -> List[Context]:
"""
根据媒体信息搜索种子资源精确匹配应用过滤规则同时根据no_exists过滤本地已存在的资源
:param mediainfo: 媒体信息

View File

@ -42,6 +42,8 @@ class TimerUtils:
@staticmethod
def time_difference(input_datetime: datetime) -> str:
if not input_datetime:
return ""
current_datetime = datetime.datetime.now(datetime.timezone.utc).astimezone()
time_difference = input_datetime - current_datetime