mirror of
https://github.com/hect0x7/JMComic-Crawler-Python.git
synced 2025-09-26 22:31:30 +08:00
v2.3.1: 优化命令行和JmOption的配置方式,简化使用 (#139)
This commit is contained in:
parent
89deeda02e
commit
e62921c6a7
@ -62,7 +62,6 @@
|
||||
|
||||
如果你发现GitHub Actions显示❌,表明出现了问题,运行失败。
|
||||
|
||||
|
||||
下面是问题的排查步骤:
|
||||
|
||||
1. 检查你在步骤2中填写是否有误。
|
||||
|
@ -4,8 +4,8 @@ import re
|
||||
|
||||
|
||||
def add_output(k, v):
|
||||
print(f'set {k} = {v}')
|
||||
print(os.system(f'echo {k}={v} >> $GITHUB_OUTPUT'))
|
||||
cmd = f'echo {k}="{v}" >> $GITHUB_OUTPUT'
|
||||
print(cmd, os.system(cmd))
|
||||
|
||||
|
||||
msg = sys.argv[1]
|
||||
|
2
setup.py
2
setup.py
@ -47,7 +47,7 @@ setup(
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'jmcomic = jmcomic:main'
|
||||
'jmcomic = jmcomic.cl:main'
|
||||
]
|
||||
}
|
||||
)
|
||||
|
@ -2,8 +2,7 @@
|
||||
# 被依赖方 <--- 使用方
|
||||
# config <--- entity <--- toolkit <--- client <--- option <--- downloader
|
||||
|
||||
__version__ = '2.3.0'
|
||||
__version__ = '2.3.1'
|
||||
|
||||
from .api import *
|
||||
from .jm_plugin import *
|
||||
from .cl import main
|
||||
|
@ -42,14 +42,16 @@ class JmcomicUI:
|
||||
parser.add_argument(
|
||||
'--option',
|
||||
help='path to the option file, you can also specify it by env `JM_OPTION_PATH`',
|
||||
type=str,
|
||||
default=get_env('JM_OPTION_PATH', ''),
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
if len(args.option) != 0:
|
||||
self.option_path = os.path.abspath(args.option)
|
||||
else:
|
||||
option = args.option
|
||||
if len(option) == 0 or option == "''":
|
||||
self.option_path = None
|
||||
else:
|
||||
self.option_path = os.path.abspath(option)
|
||||
|
||||
self.raw_id_list = args.id_list
|
||||
self.parse_raw_id()
|
||||
|
@ -218,6 +218,29 @@ class JmOption:
|
||||
下面是创建对象相关方法
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def default_dict(cls) -> Dict:
|
||||
return JmModuleConfig.option_default_dict()
|
||||
|
||||
@classmethod
|
||||
def default(cls, proxies=None, domain=None) -> 'JmOption':
|
||||
"""
|
||||
使用默认的 JmOption
|
||||
proxies, domain 为常用配置项,为了方便起见直接支持参数配置。
|
||||
其他配置项建议还是使用配置文件
|
||||
@param proxies: clash; 127.0.0.1:7890; v2ray
|
||||
@param domain: 18comic.vip; ["18comic.vip"]
|
||||
"""
|
||||
if proxies is not None or domain is not None:
|
||||
return cls.construct({
|
||||
'client': {
|
||||
'domain': [domain] if isinstance(domain, str) else domain,
|
||||
'postman': {'meta_data': {'proxies': ProxyBuilder.build_by_str(proxies)}},
|
||||
},
|
||||
})
|
||||
|
||||
return cls.construct({})
|
||||
|
||||
@classmethod
|
||||
def construct(cls, dic: Dict, cover_default=True) -> 'JmOption':
|
||||
if cover_default:
|
||||
@ -286,7 +309,10 @@ class JmOption:
|
||||
postman = Postmans.create(data=postman_conf)
|
||||
|
||||
# domain_list
|
||||
domain_list: List[str] = domain_list or self.client.domain
|
||||
if domain_list is None:
|
||||
domain_list = self.client.domain
|
||||
|
||||
domain_list: List[str]
|
||||
if len(domain_list) == 0:
|
||||
domain_list = [JmModuleConfig.domain()]
|
||||
|
||||
@ -303,14 +329,6 @@ class JmOption:
|
||||
|
||||
return client
|
||||
|
||||
@classmethod
|
||||
def default_dict(cls) -> Dict:
|
||||
return JmModuleConfig.option_default_dict()
|
||||
|
||||
@classmethod
|
||||
def default(cls):
|
||||
return cls.construct({})
|
||||
|
||||
@classmethod
|
||||
def merge_default_dict(cls, user_dict, default_dict=None):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user