Archived
更新数据库名称
This commit is contained in:
10 files changed
+180
-130
No files matched your search
@@ -59,7 +59,7 @@ class Check:
|
||||
检验本地文件md5是否和远程md5相同
|
||||
:return:
|
||||
"""
|
||||
with open('./bin/assets/theme.db', 'rb') as fp:
|
||||
with open('./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('./bin/assets/theme.db', 'w') as initial_file:
|
||||
with open('./db/style.db', 'w') as initial_file:
|
||||
initial_file.close()
|
||||
with open('./bin/assets/theme.db', 'rb+') as f:
|
||||
with open('./db/style.db', 'rb+') as f:
|
||||
name = 1
|
||||
fileno = f.fileno()
|
||||
while end < filesize - 1:
|
||||
@@ -117,10 +117,10 @@ def single_download(url):
|
||||
session.trust_env = False
|
||||
logger.info(f'正在使用单线程下载中')
|
||||
resp = session.get(url)
|
||||
with open('./bin/assets/theme.db', 'wb') as fp:
|
||||
with open('./db/style.db', 'wb') as fp:
|
||||
fp.write(resp.content)
|
||||
logger.info('下载完成 正在检验文件md5')
|
||||
with open('./bin/assets/theme.db', 'rb') as fp:
|
||||
with open('./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]
|
||||
@@ -136,6 +136,6 @@ def single_download(url):
|
||||
if __name__ != '__main__':
|
||||
if not os.path.exists('./bin/log'):
|
||||
os.mkdir('./bin/log')
|
||||
if not os.path.exists('./bin/assets/theme.db'):
|
||||
if not os.path.exists('./db/style.db'):
|
||||
logger.error('没有检测到本地主题数据库即将开始下载')
|
||||
Check().download()
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
|
||||
import sqlite3
|
||||
from typing import Any
|
||||
from db.db import fetch_table
|
||||
from db.sqlite import fetch_table
|
||||
|
||||
|
||||
def re_sort_number_image(origin_number: str, theme: str) -> tuple[bool, bool, bool, bool] or list[
|
||||
@@ -66,5 +66,5 @@ def re_sort_number_image(origin_number: str, theme: str) -> tuple[bool, bool, bo
|
||||
|
||||
|
||||
if __name__ != '__main__':
|
||||
conn = sqlite3.connect('./bin/assets/theme.db', check_same_thread=False)
|
||||
conn = sqlite3.connect('./db/theme.db', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
from typing import Optional
|
||||
from flask import jsonify
|
||||
from flask import Response
|
||||
from db.db import (update_data, fetch_table)
|
||||
from db.sqlite import (update_data, fetch_table)
|
||||
|
||||
|
||||
class ErrorProcess:
|
||||
@@ -42,7 +42,7 @@ class ErrorProcess:
|
||||
self.msg_template['data'] = table_list
|
||||
return jsonify(self.msg_template)
|
||||
|
||||
def error_length(self, length: int) -> Response:
|
||||
def error_length(self, length: int or str) -> Response:
|
||||
"""
|
||||
数值太长显示此页面
|
||||
:param length:
|
||||
|
||||
Reference in New Issue
Block a user