当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
25 Star 60 Fork 34

fffonion / xeHentai
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
xeH 1.36 KB
一键复制 编辑 Web IDE 原始数据 按行查看 历史
fffonion 提交于 2020-07-22 19:04 . 2.023: auto update
#!/usr/bin/env python
import os
import sys
import json
import zipfile
from threading import Thread
import xeHentai.const as const
SRC_UPDATE_FILE = const.SRC_UPDATE_FILE
if const.PY3K:
from importlib import reload
def load_update():
if os.path.exists(SRC_UPDATE_FILE):
try:
need_remove = False
update_id = ""
with zipfile.ZipFile(SRC_UPDATE_FILE, 'r') as z:
try:
r = json.loads(z.read("info.json"))
except:
need_remove = True
else:
if 'v' not in r and r['v'] != SRC_UPDATE_VERSION:
# ignoring legacy file
need_remove = True
else:
update_id = r["update_id"]
if need_remove:
os.remove(SRC_UPDATE_FILE)
return
v = const.__version__
sys.path.insert(0, SRC_UPDATE_FILE)
import xeHentai
reload(xeHentai)
xeHentai.const.VERSION_UPDATE = update_id
xeHentai.const.VERSION_UPDATE_LOADER = v
except:
if sys.path[0] == SRC_UPDATE_FILE:
sys.path.pop(0)
os.remove(SRC_UPDATE_FILE)
if __name__ == "__main__":
load_update()
from xeHentai import cli, i18n
cli.start()
Python
1
https://gitee.com/fffonion/xehentai.git
git@gitee.com:fffonion/xehentai.git
fffonion
xehentai
xeHentai
master

搜索帮助

14c37bed 8189591 565d56ea 8189591