This repository has been archived on 2026-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
RequestCounter/bin/tests/get_all_theme.py
T

33 lines
889 B
Python
Raw Normal View History

2022-02-11 17:28:08 +08:00
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2022/2/11
2022-02-11 17:31:30 +08:00
# @File Name: get_all_theme.py
import random
import base64
import sqlite3
conn = sqlite3.connect('../assets/theme.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()