更新文件站地址

This commit is contained in:
MarkusJoe
2022-03-13 10:52:16 +08:00
parent f01408a77c
commit f003146ccb
6 files changed
+39 -19

No files matched your search

+1
View File
@@ -13,3 +13,4 @@ dist/
*.log *.log
*.log.* *.log.*
*.sql *.sql
*.gif
+1 -1
View File
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright [RTAkland] [name of copyright owner] Copyright [2022] [MarkusJoe]
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
+4 -3
View File
@@ -12,11 +12,12 @@ from flask import request
from flask import make_response from flask import make_response
from flask import render_template from flask import render_template
from gevent import pywsgi from gevent import pywsgi
from bin.utils.error import ErrorProcess
from bin.utils.features import Features
from bin.utils.view import view_template
from bin.utils.logger import logger from bin.utils.logger import logger
from bin.utils.features import Features
from bin.utils.settings import Settings from bin.utils.settings import Settings
from bin.utils.error import ErrorProcess
from bin.utils.view import view_template
conf = Settings() conf = Settings()
+19 -13
View File
@@ -14,19 +14,25 @@ import threading
from bin.utils.logger import logger from bin.utils.logger import logger
class Threaded(threading.Thread): class MultiThreaded(threading.Thread):
def __init__(self, s, e, id_, url, name): def __init__(self,
start_: int,
end_: int,
id_: int,
url: str,
name: str
) -> None:
""" """
初始化类 初始化类
:param s: 开始点 :param start_: 开始点
:param e: 结束点 :param end_: 结束点
:param id_: 线程id :param id_: 线程id
:param url: 文件url :param url: 文件url
:param name: 文件名 :param name: 文件名
""" """
super(Threaded, self).__init__() super(MultiThreaded, self).__init__()
self.start_ = s self.start_ = start_
self.end_ = e self.end_ = end_
self.id = id_ self.id = id_
self.url = url self.url = url
self.name = name self.name = name
@@ -65,7 +71,7 @@ def cost(func):
@cost @cost
def main(url: str, name: str, path: str = '.', workers: int = 4): def main(url: str, name: str, path: str = '.', workers: int = 8):
""" """
主函数 主函数
:param url: :param url:
@@ -90,7 +96,7 @@ def main(url: str, name: str, path: str = '.', workers: int = 4):
end = i * offset end = i * offset
else: else:
end = offset end = offset
threads = Threaded(start, end, i, url, path + name) threads = MultiThreaded(start, end, i, url, path + name)
threads.start() threads.start()
threads.join() threads.join()
start = end + 1 start = end + 1
@@ -112,12 +118,12 @@ if __name__ != '__main__':
if not os.path.exists('./bin/db/data.db'): if not os.path.exists('./bin/db/data.db'):
logger.warning('数据库文件不存在, 即将开始下载') logger.warning('数据库文件不存在, 即将开始下载')
try: try:
main('https://themedatabase.vercel.app/assets', 'data.db', './bin/db/') main('https://filebase.vercel.app/data.db', 'data.db', './bin/db/')
except requests.Timeout: except requests.Timeout:
logger.critical('连接超时, 将使用单线程重新尝试下载') logger.critical('连接超时, 将使用单线程重新尝试下载')
try: try:
download('https://themedatabase.vercel.app/assets') download('https://filebase.vercel.app/data.db')
except requests.Timeout: except requests.Timeout:
logger.critical('连接超时, 请自行前往https://themedatabase.vercel.app/assets下载文件') logger.critical('连接超时, 请自行前往 https://filebase.vercel.app/data.db 下载文件')
logger.critical('将文件命名为data.db后放置在 ./bin/db/ 文件夹内') logger.critical('放置在 ./bin/db/ 文件夹内')
sys.exit(-1) sys.exit(-1)
+1 -1
View File
@@ -11,7 +11,7 @@ from bin.utils.settings import Settings
if __name__ != '__main__': if __name__ != '__main__':
if Settings().type.lower() == 'mysql' and not os.path.exists('./static/origin.sql'): if Settings().type.lower() == 'mysql' and not os.path.exists('./static/origin.sql'):
logger.warning('当前使用的数据库为MySQL请前往 https://themedatabase.vercel.app/source/sql 下载sql文件') logger.warning('当前使用的数据库为MySQL请前往 https://filebase.vercel.app/db.sql 下载sql文件')
logger.warning('并使用 source 命令来导入MySQL数据库') logger.warning('并使用 source 命令来导入MySQL数据库')
logger.warning('此消息只显示一次, 下次启动不显示') logger.warning('此消息只显示一次, 下次启动不显示')
open('./static/origin.sql', 'w').close() open('./static/origin.sql', 'w').close()
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2022/3/13
# @File Name: length_down.py
import requests
print(requests.get('http://127.0.0.1:8000/data.db').headers)