Skip to content

Commit

Permalink
fix nettest
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Jul 18, 2023
1 parent 09e986f commit 6fe21f9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
- `&`表示与,``表示或,`!`表示非,`>`表示优先级层级
- 符合任一层级规则的资源将被标识选中,匹配成功的层级做为该资源的优先级,排越前面优先级超高
- 不符合过滤规则所有层级规则的资源将不会被选中
Expand Down
15 changes: 12 additions & 3 deletions app/api/endpoints/system.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import json
import time
from datetime import datetime
from typing import Union

from fastapi import APIRouter, HTTPException, Depends
Expand Down Expand Up @@ -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="网络连接失败!")
5 changes: 5 additions & 0 deletions app/modules/filter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6fe21f9

Please sign in to comment.