Merge remote-tracking branch 'origin/master'

This commit is contained in:
ZhangKang 2023-12-07 11:15:46 +08:00
commit 30e63fadbe
5 changed files with 13 additions and 10 deletions

View File

@ -13,7 +13,7 @@ def merge_databases(source_paths, target_path):
if not os.path.exists(source_path):
break
db = sqlite3.connect(source_path)
db.text_factory = bytes
# db.text_factory = bytes
cursor = db.cursor()
sql = '''
SELECT TalkerId,MsgsvrID,Type,SubType,IsSender,CreateTime,Sequence,StrTalker,StrContent,DisplayContent,BytesExtra

View File

@ -58,7 +58,7 @@ class Msg:
sql = '''
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=?
where TRIM(StrTalker)=?
order by CreateTime
'''
try:
@ -109,7 +109,7 @@ class Msg:
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime
from MSG
where StrTalker = ? and localId < ?
where TRIM(StrTalker) = ? and localId < ?
order by CreateTime desc
limit 10
'''
@ -133,7 +133,7 @@ class Msg:
sql = '''
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=? and Type=?
where TRIM(StrTalker)=? and Type=?
order by CreateTime
'''
try:
@ -150,7 +150,7 @@ class Msg:
sql = '''
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=? and Type=1 and LENGTH(StrContent)<? and StrContent like ?
where TRIM(StrTalker)=? and Type=1 and LENGTH(StrContent)<? and StrContent like ?
order by CreateTime desc
'''
temp = []
@ -194,7 +194,7 @@ class Msg:
sql = '''
select StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime
from MSG
where StrTalker=?
where TRIM(StrTalker)=?
order by CreateTime
limit 1
'''

View File

@ -890,7 +890,7 @@ const chatMessages = [
if match:
continue
image_path = hard_link_db.get_image(content=str_content, thumb=False)
image_path = path.get_relative_path(image_path, base_path=f'./data/聊天记录/{self.contact.remark}/image')
image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
image_path = image_path.replace('\\', '/')
# print(f"tohtml:---{image_path}")
if self.is_5_min(timestamp):

View File

@ -17,6 +17,8 @@ class TextMessage(QLabel):
heightSingal = pyqtSignal(int)
def __init__(self, text, is_send=False, parent=None):
if isinstance(text, bytes):
text = text.decode('utf-8')
super(TextMessage, self).__init__(text, parent)
font = QFont('微软雅黑', 12)
self.setFont(font)

View File

@ -50,14 +50,15 @@ def decode_dat(file_path, out_path):
if decode_code == -1:
return
filename = os.path.basename(file_path)
if file_type == 1:
pic_name = os.path.basename(file_path)[:-4] + ".jpg"
elif file_type == 3:
pic_name = file_path[:-4] + ".png"
pic_name = filename[:-4] + ".png"
elif file_type == 5:
pic_name = file_path[:-4] + ".gif"
pic_name = filename[:-4] + ".gif"
else:
pic_name = file_path[:-4] + ".jpg"
pic_name = filename[:-4] + ".jpg"
file_outpath = os.path.join(out_path, pic_name)
if os.path.exists(file_outpath):
return file_outpath