Archived
增加更多主题选择并修复了bug
This commit is contained in:
353 files changed
+1359
-1185
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/5
|
||||
# @File Name: __init__.py.py
|
||||
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/5
|
||||
# @File Name: __init__.py.py
|
||||
|
||||
+65
-76
@@ -1,76 +1,65 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/3
|
||||
# @File Name: b64img.py
|
||||
|
||||
|
||||
import sqlite3
|
||||
|
||||
|
||||
def re_sort_number_image(origin_number: str, theme: str) -> list:
|
||||
"""
|
||||
返回一个排列好的svg base64代码列表
|
||||
:param theme:
|
||||
:param origin_number:
|
||||
:return:
|
||||
"""
|
||||
print(theme)
|
||||
if theme == 't1':
|
||||
cursor.execute('select * from theme1')
|
||||
elif theme == 't2':
|
||||
cursor.execute('select * from theme2')
|
||||
elif theme == 'gelbooru':
|
||||
cursor.execute('select * from gelbooru')
|
||||
elif theme == 'gelbooru-h':
|
||||
cursor.execute('select * from gelbooruh')
|
||||
elif theme == 'moebooru':
|
||||
cursor.execute('select * from moebooru')
|
||||
elif theme == 'moebooru-h':
|
||||
cursor.execute('select * from moebooruh')
|
||||
elif theme == 'rule34':
|
||||
cursor.execute('select * from rule34')
|
||||
else:
|
||||
cursor.execute('select * from rule34')
|
||||
data = cursor.fetchall()
|
||||
temp_dict = {}
|
||||
for k, v in data:
|
||||
temp_dict.setdefault(k, []).append(v)
|
||||
for i, c in zip(temp_dict.keys(), temp_dict.values()):
|
||||
temp_dict[i] = c[0]
|
||||
|
||||
final_b64_img_code = []
|
||||
if origin_number != '0000000000':
|
||||
for i in origin_number:
|
||||
if i == '0':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '1':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '2':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '3':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '4':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '5':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '6':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '7':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '8':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
elif i == '9':
|
||||
final_b64_img_code.append(temp_dict.get(str(i)))
|
||||
|
||||
return final_b64_img_code
|
||||
else:
|
||||
for i in range(10):
|
||||
final_b64_img_code.append(temp_dict.get(str(0)))
|
||||
return final_b64_img_code
|
||||
|
||||
|
||||
if __name__ != '__main__':
|
||||
conn = sqlite3.connect('./bin/assets/theme.db')
|
||||
cursor = conn.cursor()
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/3
|
||||
# @File Name: b64img.py
|
||||
|
||||
|
||||
import sqlite3
|
||||
|
||||
|
||||
def re_sort_number_image(origin_number: str, theme: str) -> list:
|
||||
"""
|
||||
返回一个排列好的svg base64代码列表
|
||||
:param theme:
|
||||
:param origin_number:
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
cursor.execute('select * from %(theme_db)s' % {'theme_db': theme} )
|
||||
except sqlite3.OperationalError:
|
||||
return False
|
||||
width_list = []
|
||||
height_list = []
|
||||
b_64_list = []
|
||||
data = cursor.fetchall()
|
||||
for i in data:
|
||||
width_list.append(i[2])
|
||||
height_list.append(i[3])
|
||||
b_64_list.append(i[1])
|
||||
|
||||
final_b64_img_code = []
|
||||
if origin_number != '0000000000':
|
||||
for i in origin_number:
|
||||
if i == '0':
|
||||
final_b64_img_code.append(b_64_list[0])
|
||||
elif i == '1':
|
||||
final_b64_img_code.append(b_64_list[1])
|
||||
elif i == '2':
|
||||
final_b64_img_code.append(b_64_list[2])
|
||||
elif i == '3':
|
||||
final_b64_img_code.append(b_64_list[3])
|
||||
elif i == '4':
|
||||
final_b64_img_code.append(b_64_list[4])
|
||||
elif i == '5':
|
||||
final_b64_img_code.append(b_64_list[5])
|
||||
elif i == '6':
|
||||
final_b64_img_code.append(b_64_list[6])
|
||||
elif i == '7':
|
||||
final_b64_img_code.append(b_64_list[7])
|
||||
elif i == '8':
|
||||
final_b64_img_code.append(b_64_list[8])
|
||||
elif i == '9':
|
||||
final_b64_img_code.append(b_64_list[9])
|
||||
|
||||
return final_b64_img_code, width_list[0], height_list[0]
|
||||
else:
|
||||
for i in range(10):
|
||||
final_b64_img_code.append(b_64_list[0])
|
||||
return final_b64_img_code, width_list[0], height_list[0]
|
||||
|
||||
|
||||
if __name__ != '__main__':
|
||||
conn = sqlite3.connect('./bin/assets/theme.db', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
+123
-76
@@ -1,76 +1,123 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/5
|
||||
# @File Name: render_.py
|
||||
|
||||
|
||||
from flask import render_template
|
||||
|
||||
|
||||
def render_temp_(length: int, name: str, image_list: list, theme: str) -> str:
|
||||
"""
|
||||
代码很烂写到隐蔽的地方就看不见了
|
||||
:param theme:
|
||||
:param length:
|
||||
:param name:
|
||||
:param image_list:
|
||||
:return:
|
||||
"""
|
||||
if 'gelbooru' in theme:
|
||||
file_name = f'index{length}-spec.html'
|
||||
else:
|
||||
file_name = f'index{length}.html'
|
||||
|
||||
# 自己写的都看不下去了
|
||||
if length == 7:
|
||||
return render_template(file_name,
|
||||
title=name,
|
||||
svg_img_0=f'{image_list[0]}',
|
||||
svg_img_1=f'{image_list[1]}',
|
||||
svg_img_2=f'{image_list[2]}',
|
||||
svg_img_3=f'{image_list[3]}',
|
||||
svg_img_4=f'{image_list[4]}',
|
||||
svg_img_5=f'{image_list[5]}',
|
||||
svg_img_6=f'{image_list[6]}'
|
||||
)
|
||||
elif length == 8:
|
||||
return render_template(file_name,
|
||||
title=name,
|
||||
svg_img_0=f'{image_list[0]}',
|
||||
svg_img_1=f'{image_list[1]}',
|
||||
svg_img_2=f'{image_list[2]}',
|
||||
svg_img_3=f'{image_list[3]}',
|
||||
svg_img_4=f'{image_list[4]}',
|
||||
svg_img_5=f'{image_list[5]}',
|
||||
svg_img_6=f'{image_list[6]}',
|
||||
svg_img_7=f'{image_list[7]}'
|
||||
)
|
||||
elif length == 9:
|
||||
return render_template(file_name,
|
||||
title=name,
|
||||
svg_img_0=f'{image_list[0]}',
|
||||
svg_img_1=f'{image_list[1]}',
|
||||
svg_img_2=f'{image_list[2]}',
|
||||
svg_img_3=f'{image_list[3]}',
|
||||
svg_img_4=f'{image_list[4]}',
|
||||
svg_img_5=f'{image_list[5]}',
|
||||
svg_img_6=f'{image_list[6]}',
|
||||
svg_img_7=f'{image_list[7]}',
|
||||
svg_img_8=f'{image_list[8]}',
|
||||
)
|
||||
elif length == 10:
|
||||
return render_template(file_name,
|
||||
title=name,
|
||||
svg_img_0=f'{image_list[0]}',
|
||||
svg_img_1=f'{image_list[1]}',
|
||||
svg_img_2=f'{image_list[2]}',
|
||||
svg_img_3=f'{image_list[3]}',
|
||||
svg_img_4=f'{image_list[4]}',
|
||||
svg_img_5=f'{image_list[5]}',
|
||||
svg_img_6=f'{image_list[6]}',
|
||||
svg_img_7=f'{image_list[7]}',
|
||||
svg_img_8=f'{image_list[8]}',
|
||||
svg_img_9=f'{image_list[9]}'
|
||||
)
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/5
|
||||
# @File Name: render_.py
|
||||
|
||||
|
||||
from flask import render_template
|
||||
|
||||
|
||||
def render_temp_(length: int, name: str, image_list: list, width: int, height: int) -> str:
|
||||
"""
|
||||
代码很烂写到隐蔽的地方就看不见了
|
||||
:param height:
|
||||
:param width:
|
||||
:param length:
|
||||
:param name:
|
||||
:param image_list:
|
||||
:return:
|
||||
"""
|
||||
position_list = []
|
||||
for i in range(0, length):
|
||||
position_list.append(i * width)
|
||||
file_name = f'index{length}.html'
|
||||
|
||||
# 自己写的都看不下去了
|
||||
if length == 7:
|
||||
return render_template(file_name,
|
||||
title=name,
|
||||
g_width=length * width,
|
||||
width=width,
|
||||
height=height,
|
||||
x_position_0=position_list[0],
|
||||
x_position_1=position_list[1],
|
||||
x_position_2=position_list[2],
|
||||
x_position_3=position_list[3],
|
||||
x_position_4=position_list[4],
|
||||
x_position_5=position_list[5],
|
||||
x_position_6=position_list[6],
|
||||
svg_img_0=f'{image_list[0]}',
|
||||
svg_img_1=f'{image_list[1]}',
|
||||
svg_img_2=f'{image_list[2]}',
|
||||
svg_img_3=f'{image_list[3]}',
|
||||
svg_img_4=f'{image_list[4]}',
|
||||
svg_img_5=f'{image_list[5]}',
|
||||
svg_img_6=f'{image_list[6]}'
|
||||
)
|
||||
elif length == 8:
|
||||
return render_template(file_name,
|
||||
title=name,
|
||||
g_width=length * width,
|
||||
width=width,
|
||||
height=height,
|
||||
x_position_0=position_list[0],
|
||||
x_position_1=position_list[1],
|
||||
x_position_2=position_list[2],
|
||||
x_position_3=position_list[3],
|
||||
x_position_4=position_list[4],
|
||||
x_position_5=position_list[5],
|
||||
x_position_6=position_list[6],
|
||||
x_position_7=position_list[7],
|
||||
svg_img_0=f'{image_list[0]}',
|
||||
svg_img_1=f'{image_list[1]}',
|
||||
svg_img_2=f'{image_list[2]}',
|
||||
svg_img_3=f'{image_list[3]}',
|
||||
svg_img_4=f'{image_list[4]}',
|
||||
svg_img_5=f'{image_list[5]}',
|
||||
svg_img_6=f'{image_list[6]}',
|
||||
svg_img_7=f'{image_list[7]}'
|
||||
)
|
||||
elif length == 9:
|
||||
return render_template(file_name,
|
||||
title=name,
|
||||
g_width=length * width,
|
||||
width=width,
|
||||
height=height,
|
||||
x_position_0=position_list[0],
|
||||
x_position_1=position_list[1],
|
||||
x_position_2=position_list[2],
|
||||
x_position_3=position_list[3],
|
||||
x_position_4=position_list[4],
|
||||
x_position_5=position_list[5],
|
||||
x_position_6=position_list[6],
|
||||
x_position_7=position_list[7],
|
||||
x_position_8=position_list[8],
|
||||
svg_img_0=f'{image_list[0]}',
|
||||
svg_img_1=f'{image_list[1]}',
|
||||
svg_img_2=f'{image_list[2]}',
|
||||
svg_img_3=f'{image_list[3]}',
|
||||
svg_img_4=f'{image_list[4]}',
|
||||
svg_img_5=f'{image_list[5]}',
|
||||
svg_img_6=f'{image_list[6]}',
|
||||
svg_img_7=f'{image_list[7]}',
|
||||
svg_img_8=f'{image_list[8]}',
|
||||
)
|
||||
elif length == 10:
|
||||
return render_template(file_name,
|
||||
title=name,
|
||||
g_width=length * width,
|
||||
width=width,
|
||||
height=height,
|
||||
x_position_0=position_list[0],
|
||||
x_position_1=position_list[1],
|
||||
x_position_2=position_list[2],
|
||||
x_position_3=position_list[3],
|
||||
x_position_4=position_list[4],
|
||||
x_position_5=position_list[5],
|
||||
x_position_6=position_list[6],
|
||||
x_position_7=position_list[7],
|
||||
x_position_8=position_list[8],
|
||||
x_position_9=position_list[9],
|
||||
svg_img_0=f'{image_list[0]}',
|
||||
svg_img_1=f'{image_list[1]}',
|
||||
svg_img_2=f'{image_list[2]}',
|
||||
svg_img_3=f'{image_list[3]}',
|
||||
svg_img_4=f'{image_list[4]}',
|
||||
svg_img_5=f'{image_list[5]}',
|
||||
svg_img_6=f'{image_list[6]}',
|
||||
svg_img_7=f'{image_list[7]}',
|
||||
svg_img_8=f'{image_list[8]}',
|
||||
svg_img_9=f'{image_list[9]}'
|
||||
)
|
||||
Reference in New Issue
Block a user