Archived
更新
This commit is contained in:
12 files changed
+14
-173
No files matched your search
@@ -114,8 +114,6 @@ def main() -> Response or str:
|
||||
if theme == 'ls':
|
||||
return ErrorProcess().get_theme_list()
|
||||
if name and name != 'null':
|
||||
if not length:
|
||||
length = 7
|
||||
if not theme:
|
||||
theme = 'lewd'
|
||||
build_page_result = build_page(name, length, theme) # 开始处理整体页面
|
||||
@@ -131,6 +129,7 @@ def main() -> Response or str:
|
||||
elif build_page_result[1] == 'BadTheme': # 输入的主题错误
|
||||
return ErrorProcess().error_theme(theme)
|
||||
else: # 长度过长无法计数重置数据库内的已有数据
|
||||
logger.critical(f'用户: {name} 数据已被重置')
|
||||
return build_page_result[1]
|
||||
else:
|
||||
return ErrorProcess().arg_not_be_full()
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import sys
|
||||
|
||||
|
||||
print(sys.argv)
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/16
|
||||
# @File Name: connectdb.py
|
||||
|
||||
|
||||
import sqlite3
|
||||
|
||||
|
||||
def exec(cmd):
|
||||
try:
|
||||
conn = sqlite3.connect('../../db/count.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute(cmd)
|
||||
return cursor.fetchall()
|
||||
finally:
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
while True:
|
||||
cmd = input('>>>')
|
||||
print(exec(cmd))
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import base64
|
||||
from PIL import Image
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
|
||||
conn = sqlite3.connect('../../db/.db')
|
||||
cursor = conn.cursor()
|
||||
|
||||
file_list = os.listdir('../assets/themes/')
|
||||
for i in file_list:
|
||||
img = Image.open(f'../assets/themes/{i}/0.gif')
|
||||
w = img.width
|
||||
h = img.height
|
||||
img.close()
|
||||
for n in range(0, 10):
|
||||
with open(f'../assets/themes/{i}/{n}.gif', 'rb') as f:
|
||||
base64_data = base64.b64encode(f.read())
|
||||
base64_code = f'data:image/gif;base64,' + base64_data.decode('utf-8')
|
||||
|
||||
try:
|
||||
cursor.execute('insert into %(name)s values(?, ?, ?, ?)' % {'name': i}, (n, base64_code, w, h))
|
||||
conn.commit()
|
||||
except Exception:
|
||||
cursor.execute('create table %(name)s (k text, v text, w integer, h integer)' % {'name': i})
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/16
|
||||
# @File Name: findrootdir.py
|
||||
|
||||
|
||||
import os
|
||||
|
||||
|
||||
class Checkout:
|
||||
def __init__(self, path: str):
|
||||
self.path = path.split('/')[:-1]
|
||||
|
||||
def checkout_path(self, path: str):
|
||||
if os.path.exists(f'{path}/utils'):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def run(self):
|
||||
for i in range(len(self.path)):
|
||||
current_path = '/'.join('/'.join(self.path).split('/')[:-i])
|
||||
if self.checkout_path(current_path):
|
||||
return current_path
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/11
|
||||
# @File Name: get_all_theme.py
|
||||
|
||||
|
||||
import random
|
||||
import base64
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect('../../db/style.db')
|
||||
cursor = conn.cursor()
|
||||
|
||||
|
||||
def get_all_theme():
|
||||
cursor.execute('select * from sqlite_master where type="table"')
|
||||
table_list = cursor.fetchall()
|
||||
table_name_list = []
|
||||
for i in table_list:
|
||||
table_name_list.append(i[1])
|
||||
|
||||
for n in table_name_list:
|
||||
cursor.execute('select * from %(name)s' % {'name': n})
|
||||
for i in cursor.fetchall():
|
||||
img_data = base64.b64decode(i[1].replace('data:image/gif;base64,', ''))
|
||||
with open(str(random.randint(0, 9999)) + '.gif', 'wb') as fp:
|
||||
fp.write(img_data)
|
||||
# if i[1] == '':
|
||||
# print(n)
|
||||
|
||||
|
||||
get_all_theme()
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/12
|
||||
# @File Name: img2base64.py
|
||||
|
||||
|
||||
import base64
|
||||
|
||||
print(base64.b64encode(open('example.png', 'rb').read()).decode('utf-8'))
|
||||
@@ -13,8 +13,12 @@ if __name__ == '__main__':
|
||||
while True:
|
||||
yes_or_no = input('该操作会将数据库初始化输入y继续:')
|
||||
if yes_or_no == 'y':
|
||||
os.remove('../../db/data.db')
|
||||
conn = sqlite3.connect('../../db/data.db')
|
||||
try:
|
||||
os.remove('../../db/count.db')
|
||||
except PermissionError:
|
||||
print('有其他程序正在使用此数据库无法删除')
|
||||
sys.exit(-1)
|
||||
conn = sqlite3.connect('../../db/count.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('create table ReqCount (name text primary key, times integer )')
|
||||
sys.exit(0)
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/18
|
||||
# @File Name: read_db.py
|
||||
|
||||
|
||||
# import sqlite3
|
||||
#
|
||||
#
|
||||
# conn = sqlite3.connect('../../db/style.db')
|
||||
# cursor = conn.cursor()
|
||||
# cursor.execute('drop table dollstuffing')
|
||||
|
||||
|
||||
import requests
|
||||
import threading
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
saved = ['gelbooru', 'moebooru', 'g', 'cripple', 'blacked', 'rule34', 'steambanner', 'lefty', 'crewbooru', 'sthg',
|
||||
'rfck', 'lisu', 'tv', 'lewd', 'amibooru', 'blankatlas', 'mmballbusting', 'sss', 'legolamb', 'goldengator',
|
||||
'r6gdrawfriends', 'vivi', 'twifanartsfw', 'hololive', 'vglobby', 'jaypee', 'melanin', 'orb', 'min', 'mjg',
|
||||
'cloppers', 'townofgravityfalls', 'brown', 'enacdoa', 'daifuku', 'osc', 'girlsfeet', 'hybreedsgeneral', 'sr',
|
||||
'mono', 'riskofrain', 'neovb', 'ffsr']
|
||||
|
||||
|
||||
def req(name):
|
||||
print(name)
|
||||
resp = requests.get(f'http://127.0.0.1:5000/get?name=sdsa&theme={name}')
|
||||
soup = BeautifulSoup(resp.text, 'html.parser').findAll('image')
|
||||
for i in soup:
|
||||
with open(f'{name}.txt', 'w') as fp:
|
||||
fp.write(f'{i}\n')
|
||||
|
||||
|
||||
for i in saved:
|
||||
a = threading.Thread(target=req, args=(i,))
|
||||
a.start()
|
||||
a.join()
|
||||
@@ -0,0 +1,4 @@
|
||||
# ²âÊÔhttpÇëÇó
|
||||
GET http://localhost:5000/get?name=HTTPtest
|
||||
Accept: application/json
|
||||
|
||||
BIN
Binary file not shown.
@@ -111,3 +111,6 @@ def fetch_style_data(style: str) -> list[dict[str, Any]]:
|
||||
finally:
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
|
||||
__all__ = ['fetch_table', 'fetch_data', 'fetch_style_data', 'update_data', 'insert_data']
|
||||
Reference in New Issue
Block a user