Compare commits

...
4 Commits
Author SHA1 Message Date
HibiKier ccfb9403c8 Update update_info.json 2021-12-01 16:21:58 +08:00
HibiKier 66fa194c7f Update data_source.py 2021-12-01 16:21:29 +08:00
HibiKier 65d8fae9ca Update http_utils.py 2021-12-01 15:20:32 +08:00
HibiKier 58acb14859 Update requirements.txt 2021-12-01 14:53:45 +08:00
4 changed files with 85 additions and 93 deletions
+35 -32
View File
@@ -128,21 +128,32 @@ def _file_handle(latest_version: str) -> str:
shutil.rmtree(backup_dir) shutil.rmtree(backup_dir)
tf = None tf = None
error = '' error = ''
try: # try:
backup_dir.mkdir(exist_ok=True, parents=True) backup_dir.mkdir(exist_ok=True, parents=True)
logger.info("开始解压真寻文件压缩包....") logger.info("开始解压真寻文件压缩包....")
tf = tarfile.open(zhenxun_latest_tar_gz) tf = tarfile.open(zhenxun_latest_tar_gz)
tf.extractall(temp_dir) tf.extractall(temp_dir)
logger.info("解压真寻文件压缩包完成....") logger.info("解压真寻文件压缩包完成....")
zhenxun_latest_file = Path(temp_dir) / os.listdir(temp_dir)[0] zhenxun_latest_file = Path(temp_dir) / os.listdir(temp_dir)[0]
update_info_file = Path(zhenxun_latest_file) / "update_info.json" update_info_file = Path(zhenxun_latest_file) / "update_info.json"
update_info = json.load(open(update_info_file, "r", encoding="utf8")) update_info = json.load(open(update_info_file, "r", encoding="utf8"))
update_file = update_info["update_file"] update_file = update_info["update_file"]
add_file = update_info["add_file"] add_file = update_info["add_file"]
delete_file = update_info["delete_file"] delete_file = update_info["delete_file"]
config_file = Path() / "configs" / "config.py" config_file = Path() / "configs" / "config.py"
config_path_file = Path() / "configs" / "config_path.py" config_path_file = Path() / "configs" / "path_config.py"
for file in delete_file + update_file: for file in [config_file.name]:
tmp = ""
new_file = Path(zhenxun_latest_file) / "configs" / file
old_file = Path() / "configs" / file
new_lines = open(new_file, "r", encoding="utf8").readlines()
old_lines = open(old_file, "r", encoding="utf8").readlines()
for nl in new_lines:
tmp += check_old_lines(old_lines, nl)
with open(old_file, "w", encoding="utf8") as f:
f.write(tmp)
for file in delete_file + update_file:
if file != "configs":
file = Path() / file file = Path() / file
backup_file = Path(backup_dir) / file backup_file = Path(backup_dir) / file
if file.exists(): if file.exists():
@@ -157,23 +168,15 @@ def _file_handle(latest_version: str) -> str:
with open(backup_file, "w", encoding="utf8") as wf: with open(backup_file, "w", encoding="utf8") as wf:
wf.write(data) wf.write(data)
logger.info(f"已备份文件:{file}") logger.info(f"已备份文件:{file}")
for file in add_file + update_file: for file in add_file + update_file:
new_file = Path(zhenxun_latest_file) / file new_file = Path(zhenxun_latest_file) / file
old_file = Path() / file old_file = Path() / file
if old_file not in [config_file, config_path_file]: if old_file not in [config_file, config_path_file] and file != "configs":
if not old_file.exists() and new_file.exists(): if not old_file.exists() and new_file.exists():
os.rename(new_file.absolute(), old_file.absolute()) os.rename(new_file.absolute(), old_file.absolute())
logger.info(f"已更新文件:{file}") logger.info(f"已更新文件:{file}")
else: # except Exception as e:
tmp = "" # error = f'{type(e)}:{e}'
new_lines = open(new_file, "r", encoding="utf8").readlines()
old_lines = open(old_file, "r", encoding="utf8").readlines()
for nl in new_lines:
tmp += check_old_lines(old_lines, nl)
with open(file, "w", encoding="utf8") as f:
f.write(tmp)
except Exception as e:
error = f'{type(e)}:{e}'
if tf: if tf:
tf.close() tf.close()
if temp_dir.exists(): if temp_dir.exists():
+47 -58
View File
@@ -1,86 +1,75 @@
appdirs==1.4.4 aiofiles==0.8.0
aiofiles==0.6.0
aiohttp==3.7.4.post0 aiohttp==3.7.4.post0
APScheduler==3.7.0 APScheduler==3.8.1
async-timeout==3.0.1 async-timeout==3.0.1
asyncpg==0.22.0 asyncpg==0.25.0
attrs==20.3.0 attrs==21.2.0
backports.zoneinfo==0.2.1
beautifulsoup4==4.9.3 beautifulsoup4==4.9.3
bilibili-api==5.1.1 bilibili-api==5.1.1
bleach==3.3.0 certifi==2021.10.8
certifi==2020.12.5
chardet==4.0.0 chardet==4.0.0
click==7.1.2 click==7.1.2
colorama==0.4.4 colorama==0.4.4
cssutils==2.2.0 cycler==0.11.0
cycler==0.10.0
docutils==0.17.1
fastapi==0.63.0 fastapi==0.63.0
feedparser==6.0.2 feedparser==6.0.8
fonttools==4.28.2
gino==1.0.1 gino==1.0.1
greenlet==1.0.0 greenlet==1.0.0
h11==0.12.0 h11==0.12.0
httpcore==0.12.3 httpcore==0.12.3
httptools==0.1.2
httpx==0.17.1 httpx==0.17.1
idna==2.10 idna==3.3
ImageHash==4.2.0 ImageHash==4.2.1
importlib-metadata==4.0.1
jieba==0.42.1 jieba==0.42.1
keyring==23.0.1 kiwisolver==1.3.2
kiwisolver==1.3.1
loguru==0.5.3 loguru==0.5.3
lxml==4.6.3 lxml==4.6.4
matplotlib==3.4.1 matplotlib==3.5.0
multidict==5.1.0 multidict==5.2.0
nest-asyncio==1.5.1
nonebot-adapter-cqhttp==2.0.0a12 nonebot-adapter-cqhttp==2.0.0a12
nonebot-plugin-apscheduler==0.1.2 nonebot-plugin-apscheduler==0.1.2
nonebot2==2.0.0a13.post1 nonebot2==2.0.0a13.post1
numpy==1.20.2 numpy==1.21.4
opencv-python==4.5.1.48 opencv-python==4.5.1.48
packaging==20.9 packaging==21.3
pandas==1.2.3
Pillow==8.2.0 Pillow==8.2.0
pkginfo==1.7.0
psutil==5.8.0
pydantic==1.8.1
pyee==8.1.0
Pygments==2.9.0
pygtrie==2.4.2
pyparsing==2.4.7
pypinyin==0.41.0
python-dateutil==2.8.1
python-dotenv==0.17.0
pytz==2021.1
PyWavelets==1.1.1
pywin32-ctypes==0.2.0
PyYAML==5.4.1
playwright==1.10.0 playwright==1.10.0
readme-renderer==29.0 psutil==5.8.0
requests==2.25.1 pydantic==1.8.2
requests-toolbelt==0.9.1 pyee==8.2.2
rfc3986==1.4.0 pygtrie==2.4.2
scapy==2.4.5 pyparsing==3.0.6
scipy==1.6.2 pypinyin==0.41.0
python-dateutil==2.8.2
python-dotenv==0.19.2
pytz==2021.3
pytz-deprecation-shim==0.1.0.post0
PyWavelets==1.2.0
PyYAML==5.4.1
retrying==1.3.3
rfc3986==1.5.0
ruamel.yaml==0.17.17
ruamel.yaml.clib==0.2.6
scipy==1.7.3
setuptools-scm==6.3.2
sgmllib3k==1.0.0 sgmllib3k==1.0.0
six==1.15.0 six==1.16.0
sniffio==1.2.0 sniffio==1.2.0
soupsieve==2.2.1 soupsieve==2.3.1
SQLAlchemy==1.3.24 SQLAlchemy==1.3.24
starlette==0.13.6 starlette==0.13.6
tomlkit==0.7.0 tomli==1.2.2
tqdm==4.60.0 tomlkit==0.7.2
twine==3.4.1 typing_extensions==4.0.1
typing-extensions==3.7.4.3 tzdata==2021.5
tzlocal==2.1 tzlocal==4.1
ujson==4.0.2 ujson==4.3.0
urllib3==1.26.4 urllib3==1.26.7
uvicorn==0.13.4 uvicorn==0.13.4
uvloop==0.16.0
watchgod==0.7 watchgod==0.7
webencodings==0.5.1
websockets==8.1 websockets==8.1
win32-setctime==1.0.3 yarl==1.7.2
yarl==1.6.3
zipp==3.4.1
ruamel.yaml==0.17.16
retrying==1.3.3
+2 -2
View File
@@ -5,8 +5,8 @@
"basic_plugins", "basic_plugins",
"utils", "utils",
"services", "services",
"configs" "configs/utils"
], ],
"add_file": [], "add_file": [],
"delete_file": [] "delete_file": []
} }
+1 -1
View File
@@ -18,7 +18,7 @@ import httpx
class AsyncHttpx: class AsyncHttpx:
proxy = {"http://": get_local_proxy()} proxy = {"http://": get_local_proxy(), "https://": get_local_proxy()}
@classmethod @classmethod
@retry(stop_max_attempt_number=3) @retry(stop_max_attempt_number=3)