Merge pull request #609 from WithdewHua/subscribe
This commit is contained in:
commit
4c05e9fb2b
@ -25,7 +25,7 @@ router = APIRouter()
|
|||||||
|
|
||||||
|
|
||||||
@router.get("/env", summary="查询系统环境变量", response_model=schemas.Response)
|
@router.get("/env", summary="查询系统环境变量", response_model=schemas.Response)
|
||||||
def get_setting(_: schemas.TokenPayload = Depends(verify_token)):
|
def get_env_setting(_: schemas.TokenPayload = Depends(verify_token)):
|
||||||
"""
|
"""
|
||||||
查询系统环境变量,包括当前版本号
|
查询系统环境变量,包括当前版本号
|
||||||
"""
|
"""
|
||||||
@ -83,7 +83,7 @@ def set_setting(key: str, value: Union[list, dict, str, int] = None,
|
|||||||
|
|
||||||
|
|
||||||
@router.get("/message", summary="实时消息")
|
@router.get("/message", summary="实时消息")
|
||||||
def get_progress(token: str):
|
def get_message(token: str):
|
||||||
"""
|
"""
|
||||||
实时获取系统消息,返回格式为SSE
|
实时获取系统消息,返回格式为SSE
|
||||||
"""
|
"""
|
||||||
|
@ -285,15 +285,21 @@ class SubscribeChain(ChainBase):
|
|||||||
torrent_meta = context.meta_info
|
torrent_meta = context.meta_info
|
||||||
torrent_info = context.torrent_info
|
torrent_info = context.torrent_info
|
||||||
torrent_mediainfo = context.media_info
|
torrent_mediainfo = context.media_info
|
||||||
|
# 包含与排除规则
|
||||||
|
default_include_exclude = self.systemconfig.get(SystemConfigKey.DefaultIncludeExcludeFilter) or {}
|
||||||
|
include = subscribe.include or default_include_exclude.get("include")
|
||||||
|
exclude = subscribe.exclude or default_include_exclude.get("exclude")
|
||||||
# 包含
|
# 包含
|
||||||
if subscribe.include:
|
if include:
|
||||||
if not re.search(r"%s" % subscribe.include,
|
if not re.search(r"%s" % include,
|
||||||
f"{torrent_info.title} {torrent_info.description}", re.I):
|
f"{torrent_info.title} {torrent_info.description}", re.I):
|
||||||
|
logger.info(f"{torrent_info.title} 不匹配包含规则 {include}")
|
||||||
continue
|
continue
|
||||||
# 排除
|
# 排除
|
||||||
if subscribe.exclude:
|
if exclude:
|
||||||
if re.search(r"%s" % subscribe.exclude,
|
if re.search(r"%s" % exclude,
|
||||||
f"{torrent_info.title} {torrent_info.description}", re.I):
|
f"{torrent_info.title} {torrent_info.description}", re.I):
|
||||||
|
logger.info(f"{torrent_info.title} 匹配排除规则 {exclude}")
|
||||||
continue
|
continue
|
||||||
# 非洗版
|
# 非洗版
|
||||||
if not subscribe.best_version:
|
if not subscribe.best_version:
|
||||||
@ -557,15 +563,21 @@ class SubscribeChain(ChainBase):
|
|||||||
if torrent_meta.episode_list:
|
if torrent_meta.episode_list:
|
||||||
logger.info(f'{subscribe.name} 正在洗版,{torrent_info.title} 不是整季')
|
logger.info(f'{subscribe.name} 正在洗版,{torrent_info.title} 不是整季')
|
||||||
continue
|
continue
|
||||||
|
# 包含与排除规则
|
||||||
|
default_include_exclude = self.systemconfig.get(SystemConfigKey.DefaultIncludeExcludeFilter) or {}
|
||||||
|
include = subscribe.include or default_include_exclude.get("include")
|
||||||
|
exclude = subscribe.exclude or default_include_exclude.get("exclude")
|
||||||
# 包含
|
# 包含
|
||||||
if subscribe.include:
|
if include:
|
||||||
if not re.search(r"%s" % subscribe.include,
|
if not re.search(r"%s" % include,
|
||||||
f"{torrent_info.title} {torrent_info.description}", re.I):
|
f"{torrent_info.title} {torrent_info.description}", re.I):
|
||||||
|
logger.info(f"{torrent_info.title} 不匹配包含规则 {include}")
|
||||||
continue
|
continue
|
||||||
# 排除
|
# 排除
|
||||||
if subscribe.exclude:
|
if exclude:
|
||||||
if re.search(r"%s" % subscribe.exclude,
|
if re.search(r"%s" % exclude,
|
||||||
f"{torrent_info.title} {torrent_info.description}", re.I):
|
f"{torrent_info.title} {torrent_info.description}", re.I):
|
||||||
|
logger.info(f"{torrent_info.title} 匹配排除规则 {exclude}")
|
||||||
continue
|
continue
|
||||||
# 匹配成功
|
# 匹配成功
|
||||||
logger.info(f'{mediainfo.title_year} 匹配成功:{torrent_info.title}')
|
logger.info(f'{mediainfo.title_year} 匹配成功:{torrent_info.title}')
|
||||||
|
@ -64,6 +64,8 @@ class SystemConfigKey(Enum):
|
|||||||
FilterRules = "FilterRules"
|
FilterRules = "FilterRules"
|
||||||
# 洗版规则
|
# 洗版规则
|
||||||
FilterRules2 = "FilterRules2"
|
FilterRules2 = "FilterRules2"
|
||||||
|
# 默认包含与排除规则
|
||||||
|
DefaultIncludeExcludeFilter = "DefaultIncludeExcludeFilter"
|
||||||
# 转移屏蔽词
|
# 转移屏蔽词
|
||||||
TransferExcludeWords = "TransferExcludeWords"
|
TransferExcludeWords = "TransferExcludeWords"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user