Archived
新建文件夹
This commit is contained in:
11 files changed
+103
-251
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -- coding:utf-8 --
|
||||||
|
# @Author: markushammered@gmail.com
|
||||||
|
# @Development Tool: PyCharm
|
||||||
|
# @Create Time: 2022/2/17
|
||||||
|
# @File Name: __init__.py
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#!/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
|
|
||||||
from typing import Any
|
|
||||||
from db.sqlite import fetch_table
|
|
||||||
|
|
||||||
|
|
||||||
def re_sort_number_image(origin_number: str, theme: str) -> tuple[bool, bool, bool, bool] or list[
|
|
||||||
bool or list[Any] or Any]:
|
|
||||||
"""
|
|
||||||
返回一个排列好的svg base64代码列表
|
|
||||||
:param theme:
|
|
||||||
:param origin_number:
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
|
|
||||||
table_list = fetch_table()
|
|
||||||
if theme not in table_list:
|
|
||||||
return False, False, False, False
|
|
||||||
|
|
||||||
width_list = []
|
|
||||||
height_list = []
|
|
||||||
b_64_list = []
|
|
||||||
cursor.execute('select * from %(name)s' % {'name': theme})
|
|
||||||
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: # 通过elif语句依次判断数字
|
|
||||||
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 [True, 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]) # 直接将0返回
|
|
||||||
return [True, final_b64_img_code, width_list[0], height_list[0]]
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ != '__main__':
|
|
||||||
conn = sqlite3.connect('./db/style.db', check_same_thread=False)
|
|
||||||
cursor = conn.cursor()
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -- coding:utf-8 --
|
||||||
|
# @Author: markushammered@gmail.com
|
||||||
|
# @Development Tool: PyCharm
|
||||||
|
# @Create Time: 2022/2/18
|
||||||
|
# @File Name: packlog.py
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
#!/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]}'
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -- coding:utf-8 --
|
||||||
|
# @Author: markushammered@gmail.com
|
||||||
|
# @Development Tool: PyCharm
|
||||||
|
# @Create Time: 2022/2/18
|
||||||
|
# @File Name: sort_image.py
|
||||||
|
|
||||||
|
|
||||||
|
import sqlite3
|
||||||
|
from flask import render_template
|
||||||
|
from db.sqlite import fetch_style_data
|
||||||
|
|
||||||
|
|
||||||
|
def view_template(style: str, length: int, name: str, count: str):
|
||||||
|
"""
|
||||||
|
渲染模板
|
||||||
|
:param count:
|
||||||
|
:param name:
|
||||||
|
:param length:
|
||||||
|
:param style:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
origin_data = fetch_style_data(style) # 获取数据库内的文件
|
||||||
|
except sqlite3.OperationalError:
|
||||||
|
return False, False
|
||||||
|
context = []
|
||||||
|
if count != '0000000000':
|
||||||
|
for i in count: # 通过elif语句依次判断数字
|
||||||
|
if i == '0':
|
||||||
|
context.append({'base64': origin_data[0]['base64'],
|
||||||
|
'width': origin_data[0]['width'],
|
||||||
|
'height': origin_data[0]['height']})
|
||||||
|
elif i == '1':
|
||||||
|
context.append({'base64': origin_data[1]['base64'],
|
||||||
|
'width': origin_data[1]['width'],
|
||||||
|
'height': origin_data[1]['height']})
|
||||||
|
elif i == '2':
|
||||||
|
context.append({'base64': origin_data[2]['base64'],
|
||||||
|
'width': origin_data[2]['width'],
|
||||||
|
'height': origin_data[2]['height']})
|
||||||
|
elif i == '3':
|
||||||
|
context.append({'base64': origin_data[3]['base64'],
|
||||||
|
'width': origin_data[3]['width'],
|
||||||
|
'height': origin_data[3]['height']})
|
||||||
|
elif i == '4':
|
||||||
|
context.append({'base64': origin_data[4]['base64'],
|
||||||
|
'width': origin_data[4]['width'],
|
||||||
|
'height': origin_data[4]['height']})
|
||||||
|
elif i == '5':
|
||||||
|
context.append({'base64': origin_data[5]['base64'],
|
||||||
|
'width': origin_data[5]['width'],
|
||||||
|
'height': origin_data[5]['height']})
|
||||||
|
elif i == '6':
|
||||||
|
context.append({'base64': origin_data[6]['base64'],
|
||||||
|
'width': origin_data[6]['width'],
|
||||||
|
'height': origin_data[6]['height']})
|
||||||
|
elif i == '7':
|
||||||
|
context.append({'base64': origin_data[7]['base64'],
|
||||||
|
'width': origin_data[7]['width'],
|
||||||
|
'height': origin_data[7]['height']})
|
||||||
|
elif i == '8':
|
||||||
|
context.append({'base64': origin_data[8]['base64'],
|
||||||
|
'width': origin_data[8]['width'],
|
||||||
|
'height': origin_data[8]['height']})
|
||||||
|
elif i == '9':
|
||||||
|
context.append({'base64': origin_data[9]['base64'],
|
||||||
|
'width': origin_data[9]['width'],
|
||||||
|
'height': origin_data[9]['height']})
|
||||||
|
|
||||||
|
for p, i in zip(context, range(0, length)):
|
||||||
|
p['position'] = i * p['width']
|
||||||
|
|
||||||
|
general_width = origin_data[0]['width'] * length
|
||||||
|
general_height = origin_data[0]['height']
|
||||||
|
|
||||||
|
return True, render_template('view.html',
|
||||||
|
context=context,
|
||||||
|
title=name,
|
||||||
|
general_height=general_height,
|
||||||
|
general_width=general_width)
|
||||||
Vendored
Whitespace-only changes.
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg width="{{ g_width }}" height="{{ height }}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<title>{{ title }}</title>
|
|
||||||
<g>
|
|
||||||
<image x="{{ x_position_0 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_0 }}"/>
|
|
||||||
<image x="{{ x_position_1 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_1 }}"/>
|
|
||||||
<image x="{{ x_position_2 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_2 }}"/>
|
|
||||||
<image x="{{ x_position_3 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_3 }}"/>
|
|
||||||
<image x="{{ x_position_4 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_4 }}"/>
|
|
||||||
<image x="{{ x_position_5 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_5 }}"/>
|
|
||||||
<image x="{{ x_position_6 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_6 }}"/>
|
|
||||||
<image x="{{ x_position_7 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_7 }}"/>
|
|
||||||
<image x="{{ x_position_8 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_8 }}"/>
|
|
||||||
<image x="{{ x_position_9 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_9 }}"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg width="{{ g_width }}" height="{{ height }}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<title>{{ title }}</title>
|
|
||||||
<g>
|
|
||||||
<image x="{{ x_position_0 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_0 }}"/>
|
|
||||||
<image x="{{ x_position_1 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_1 }}"/>
|
|
||||||
<image x="{{ x_position_2 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_2 }}"/>
|
|
||||||
<image x="{{ x_position_3 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_3 }}"/>
|
|
||||||
<image x="{{ x_position_4 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_4 }}"/>
|
|
||||||
<image x="{{ x_position_5 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_5 }}"/>
|
|
||||||
<image x="{{ x_position_6 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_6 }}"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg width="{{ g_width }}" height="{{ height }}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<title>{{ title }}</title>
|
|
||||||
<g>
|
|
||||||
<image x="{{ x_position_0 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_0 }}"/>
|
|
||||||
<image x="{{ x_position_1 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_1 }}"/>
|
|
||||||
<image x="{{ x_position_2 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_2 }}"/>
|
|
||||||
<image x="{{ x_position_3 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_3 }}"/>
|
|
||||||
<image x="{{ x_position_4 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_4 }}"/>
|
|
||||||
<image x="{{ x_position_5 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_5 }}"/>
|
|
||||||
<image x="{{ x_position_6 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_6 }}"/>
|
|
||||||
<image x="{{ x_position_7 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_7 }}"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<svg width="{{ g_width }}" height="{{ height }}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<title>{{ title }}</title>
|
|
||||||
<g>
|
|
||||||
<image x="{{ x_position_0 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_0 }}"/>
|
|
||||||
<image x="{{ x_position_1 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_1 }}"/>
|
|
||||||
<image x="{{ x_position_2 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_2 }}"/>
|
|
||||||
<image x="{{ x_position_3 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_3 }}"/>
|
|
||||||
<image x="{{ x_position_4 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_4 }}"/>
|
|
||||||
<image x="{{ x_position_5 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_5 }}"/>
|
|
||||||
<image x="{{ x_position_6 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_6 }}"/>
|
|
||||||
<image x="{{ x_position_7 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_7 }}"/>
|
|
||||||
<image x="{{ x_position_8 }}" y="0" width="{{ width }}" height="{{ height }}" xlink:href="{{ svg_img_8 }}"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>$Title$</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
$END$
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user