fix nettest
This commit is contained in:
parent
09e986fd5f
commit
6fe21f929f
@ -144,7 +144,7 @@ docker pull jxxghp/moviepilot:latest
|
||||
|
||||
`FILTER_RULE` 规则说明:
|
||||
|
||||
- 仅支持使用内置规则进行排列组合,内置规则有:`BLU`、`4K`、`1080P`、`CN`、`H265`、`H264`、`DOLBY`、`HDR`、`REMUX`、`FREE`
|
||||
- 仅支持使用内置规则进行排列组合,内置规则有:`BLU`、`4K`、`1080P`、`CN`、`H265`、`H264`、`DOLBY`、`HDR`、`REMUX`、`WEB-DL`、`FREE`
|
||||
- `&`表示与,`|`表示或,`!`表示非,`>`表示优先级层级
|
||||
- 符合任一层级规则的资源将被标识选中,匹配成功的层级做为该资源的优先级,排越前面优先级超高
|
||||
- 不符合过滤规则所有层级规则的资源将不会被选中
|
||||
|
@ -1,6 +1,7 @@
|
||||
import json
|
||||
import json
|
||||
import time
|
||||
from datetime import datetime
|
||||
from typing import Union
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Depends
|
||||
@ -93,11 +94,19 @@ def nettest(url: str,
|
||||
"""
|
||||
测试网络连通性
|
||||
"""
|
||||
# 记录开始的毫秒数
|
||||
start_time = datetime.now()
|
||||
result = RequestUtils(proxies=settings.PROXY if proxy else None).get_res(url)
|
||||
|
||||
# 计时结束的毫秒数
|
||||
end_time = datetime.now()
|
||||
# 计算相关秒数
|
||||
if result and result.status_code == 200:
|
||||
return schemas.Response(success=True)
|
||||
return schemas.Response(success=True, data={
|
||||
"time": round((end_time - start_time).microseconds / 1000)
|
||||
})
|
||||
elif result:
|
||||
return schemas.Response(success=False, message=f"错误码:{result.status_code}")
|
||||
return schemas.Response(success=False, message=f"错误码:{result.status_code}", data={
|
||||
"time": round((end_time - start_time).microseconds / 1000)
|
||||
})
|
||||
else:
|
||||
return schemas.Response(success=False, message="网络连接失败!")
|
||||
|
@ -61,6 +61,11 @@ class FilterModule(_ModuleBase):
|
||||
"include": [r'REMUX'],
|
||||
"exclude": []
|
||||
},
|
||||
# WEB-DL
|
||||
"WEB-DL": {
|
||||
"include": [r'WEB-?DL|WEB-?RIP'],
|
||||
"exclude": []
|
||||
},
|
||||
# 免费
|
||||
"FREE": {
|
||||
"downloadvolumefactor": 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user