修复无法使用的bug

This commit is contained in:
MarkusJoe
2022-02-19 11:48:15 +08:00
parent 8c89f4a024
commit e28e4d52de
5 files changed
+23 -13

No files matched your search

+7 -7
View File
@@ -59,7 +59,7 @@ class Check:
检验本地文件md5是否和远程md5相同
:return:
"""
with open('./db/style.db', 'rb') as fp:
with open('./bin/db/style.db', 'rb') as fp:
data = fp.read()
local_md5 = hashlib.md5(data).hexdigest()
remote_md5 = self.session.get(self.remote_md5).json()['data'][0]
@@ -84,9 +84,9 @@ class Check:
mtd_list = []
start = 0
end = -1
with open('./db/style.db', 'w') as initial_file:
with open('./bin/db/style.db', 'w') as initial_file:
initial_file.close()
with open('./db/style.db', 'rb+') as f:
with open('./bin/db/style.db', 'rb+') as f:
name = 1
fileno = f.fileno()
while end < filesize - 1:
@@ -115,10 +115,10 @@ class Check:
session.trust_env = False
logger.info(f'正在使用单线程下载中')
resp = session.get(self.assets_url)
with open('./db/style.db', 'wb') as fp:
with open('./bin/db/style.db', 'wb') as fp:
fp.write(resp.content)
logger.info('下载完成 正在检验文件md5')
with open('./db/style.db', 'rb') as fp:
with open('./bin/db/style.db', 'rb') as fp:
data = fp.read()
local_md5 = hashlib.md5(data).hexdigest()
remote_md5 = session.get('https://themedatabases.vercel.app/md5').json()['data'][0]
@@ -132,7 +132,7 @@ class Check:
if __name__ != '__main__':
__all__ = ['b64img', 'error', 'logger', 'view']
if not os.path.exists('./db/style.db'):
__all__ = ['error', 'logger', 'view']
if not os.path.exists('./bin/db/style.db'):
logger.error('没有检测到本地主题数据库即将开始下载')
Check().download()