新增语音数据库查询模块

This commit is contained in:
shuaikangzhou 2023-12-03 12:19:24 +08:00
parent 292533b1a2
commit e281c08622
4 changed files with 63 additions and 6 deletions

View File

@ -7,8 +7,7 @@ import xml.etree.ElementTree as ET
from app.log import log
lock = threading.Lock()
DB = None
cursor = None
db_path = "./app/Database/Msg/HardLinkImage.db"
root_path = 'FileStorage/MsgAttach/'

58
app/DataBase/media_msg.py Normal file
View File

@ -0,0 +1,58 @@
import os.path
import sqlite3
import threading
lock = threading.Lock()
db_path = "./app/Database/Msg/MediaMSG3.db"
def singleton(cls):
_instance = {}
def inner():
if cls not in _instance:
_instance[cls] = cls()
return _instance[cls]
return inner
@singleton
class MediaMsg:
def __init__(self):
self.DB = None
self.cursor: sqlite3.Cursor = None
self.open_flag = False
self.init_database()
def init_database(self):
if not self.open_flag:
if os.path.exists(db_path):
self.DB = sqlite3.connect(db_path, check_same_thread=False)
# '''创建游标'''
self.cursor = self.DB.cursor()
self.open_flag = True
if lock.locked():
lock.release()
def get_media_buffer(self, reserved0):
pass
sql = '''
select Buf
from Media
where Reserved0 = ?
'''
try:
lock.acquire(True)
self.cursor.execute(sql, [reserved0])
return self.cursor.fetchone()
finally:
lock.release()
if __name__ == '__main__':
db_path = './Msg/MediaMSG3.db'
media_msg_db = MediaMsg()
reserved = '823076859361714342'
buf = media_msg_db.get_media_buffer(reserved)
print(buf)

View File

@ -49,7 +49,7 @@ class Msg:
if not self.open_flag:
return None
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID
from MSG
where StrTalker=?
order by CreateTime
@ -65,7 +65,7 @@ class Msg:
def get_messages_all(self):
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID
from MSG
order by CreateTime
'''

View File

@ -35,8 +35,8 @@
## 🍉功能
- 获得📱手机本地微信数据库的使用权🐶
- 获得💻PC端本地微信数据库的使用权🐶
- 解密📱手机本地微信数据库🐶
- 解密💻PC端本地微信数据库🐶
- 还原微信聊天界面
- 🗨文本✅
- 🏝图片✅