又写了一个写入数据库的py文件
No files matched your search
@@ -0,0 +1 @@
|
||||
# 此文件夹内的所有文件全部来自
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 680 B |
|
After Width: | Height: | Size: 769 B |
|
After Width: | Height: | Size: 855 B |
|
After Width: | Height: | Size: 775 B |
|
After Width: | Height: | Size: 819 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 795 B |
|
After Width: | Height: | Size: 1012 B |
|
After Width: | Height: | Size: 913 B |
|
After Width: | Height: | Size: 826 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 922 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 974 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/7
|
||||
# @File Name: dump_theme_db.py
|
||||
|
||||
|
||||
import os
|
||||
import base64
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect('../assets/theme.db')
|
||||
cursor = conn.cursor()
|
||||
|
||||
|
||||
dir_name = 'gelbooru-h'
|
||||
file_list = os.listdir(f'../assets/themes/moe_theme/{dir_name}')
|
||||
dict_count = 0
|
||||
img_dict = {}
|
||||
for i in file_list:
|
||||
with open(f'../assets/themes/moe_theme/{dir_name}/{i}', 'rb') as f:
|
||||
base64_data = base64.b64encode(f.read())
|
||||
base64_code = f'data:image/jpeg;base64,' + base64_data.decode('utf-8')
|
||||
img_dict[str(dict_count)] = base64_code
|
||||
dict_count += 1
|
||||
for k, v in zip(img_dict.keys(), img_dict.values()):
|
||||
cursor.execute("insert into gelbooruh values(?, ?)", (k, v))
|
||||
conn.commit()
|
||||