mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-23 03:22:17 +08:00
Merge branch 'LC044:master' into master
This commit is contained in:
commit
77ec5716d0
@ -10,8 +10,6 @@
|
|||||||
from .hard_link import HardLink
|
from .hard_link import HardLink
|
||||||
from .micro_msg import MicroMsg
|
from .micro_msg import MicroMsg
|
||||||
from .media_msg import MediaMsg
|
from .media_msg import MediaMsg
|
||||||
# from . import data
|
|
||||||
# from . import output
|
|
||||||
from .misc import Misc
|
from .misc import Misc
|
||||||
from .msg import Msg
|
from .msg import Msg
|
||||||
from .msg import MsgType
|
from .msg import MsgType
|
||||||
@ -31,4 +29,12 @@ def close_db():
|
|||||||
media_msg_db.close()
|
media_msg_db.close()
|
||||||
|
|
||||||
|
|
||||||
|
def init_db():
|
||||||
|
misc_db.init_database()
|
||||||
|
msg_db.init_database()
|
||||||
|
micro_msg_db.init_database()
|
||||||
|
hard_link_db.init_database()
|
||||||
|
media_msg_db.init_database()
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['output', 'misc_db', 'micro_msg_db', 'msg_db', 'hard_link_db', 'MsgType', "media_msg_db"]
|
__all__ = ['output', 'misc_db', 'micro_msg_db', 'msg_db', 'hard_link_db', 'MsgType', "media_msg_db"]
|
||||||
|
@ -206,8 +206,8 @@ class Msg:
|
|||||||
('', '', ['', ''], ''),
|
('', '', ['', ''], ''),
|
||||||
('', '', '', '')
|
('', '', '', '')
|
||||||
))
|
))
|
||||||
print(keyword,res)
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_contact(self, contacts):
|
def get_contact(self, contacts):
|
||||||
if not self.open_flag:
|
if not self.open_flag:
|
||||||
return None
|
return None
|
||||||
@ -227,6 +227,7 @@ class Msg:
|
|||||||
contacts[i].append(0)
|
contacts[i].append(0)
|
||||||
contacts.sort(key=lambda cur_contact: cur_contact[-1], reverse=True)
|
contacts.sort(key=lambda cur_contact: cur_contact[-1], reverse=True)
|
||||||
return contacts
|
return contacts
|
||||||
|
|
||||||
def get_messages_by_days(self, username_, is_Annual_report_=False, year_='2023'):
|
def get_messages_by_days(self, username_, is_Annual_report_=False, year_='2023'):
|
||||||
if is_Annual_report_:
|
if is_Annual_report_:
|
||||||
sql = '''
|
sql = '''
|
||||||
@ -375,7 +376,7 @@ if __name__ == '__main__':
|
|||||||
msg.init_database()
|
msg.init_database()
|
||||||
result = msg.get_message_by_num('wxid_vtz9jk9ulzjt22', 9999999)
|
result = msg.get_message_by_num('wxid_vtz9jk9ulzjt22', 9999999)
|
||||||
print(result)
|
print(result)
|
||||||
result = msg.get_messages_by_type('wxid_vtz9jk9ulzjt22',49)
|
result = msg.get_messages_by_type('wxid_vtz9jk9ulzjt22', 49)
|
||||||
for r in result:
|
for r in result:
|
||||||
type_ = r[2]
|
type_ = r[2]
|
||||||
sub_type = r[3]
|
sub_type = r[3]
|
||||||
|
@ -274,7 +274,6 @@ class ChildThread(QThread):
|
|||||||
f'''{str_time} {name}\n[语音]\n\n'''
|
f'''{str_time} {name}\n[语音]\n\n'''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def emoji(self, doc, message):
|
def emoji(self, doc, message):
|
||||||
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
|
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
|
||||||
str_content = message[7]
|
str_content = message[7]
|
||||||
@ -304,7 +303,7 @@ class ChildThread(QThread):
|
|||||||
def retract_message(self, doc, isSend, content, status):
|
def retract_message(self, doc, isSend, content, status):
|
||||||
return
|
return
|
||||||
|
|
||||||
def refermsg(self, doc,message):
|
def refermsg(self, doc, message):
|
||||||
"""
|
"""
|
||||||
处理回复消息
|
处理回复消息
|
||||||
@param doc:
|
@param doc:
|
||||||
@ -337,7 +336,7 @@ class ChildThread(QThread):
|
|||||||
doc.write(
|
doc.write(
|
||||||
f'''{{ type:49, text: '{contentText}',is_send:{is_send},sub_type:{content.get('type')},avatar_path:'{avatar}'}},'''
|
f'''{{ type:49, text: '{contentText}',is_send:{is_send},sub_type:{content.get('type')},avatar_path:'{avatar}'}},'''
|
||||||
)
|
)
|
||||||
elif self.output_type==Output.TXT:
|
elif self.output_type == Output.TXT:
|
||||||
name = '你' if is_send else self.contact.remark
|
name = '你' if is_send else self.contact.remark
|
||||||
if refer_msg:
|
if refer_msg:
|
||||||
doc.write(
|
doc.write(
|
||||||
@ -348,7 +347,6 @@ class ChildThread(QThread):
|
|||||||
f'''{str_time} {name}\n{content.get('title')}\n引用:未知\n\n'''
|
f'''{str_time} {name}\n{content.get('title')}\n引用:未知\n\n'''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def system_msg(self, doc, message):
|
def system_msg(self, doc, message):
|
||||||
str_content = message[7]
|
str_content = message[7]
|
||||||
is_send = message[4]
|
is_send = message[4]
|
||||||
@ -470,7 +468,7 @@ class ChildThread(QThread):
|
|||||||
elif type_ == 10000 and self.message_types.get(type_):
|
elif type_ == 10000 and self.message_types.get(type_):
|
||||||
self.system_msg(f, message)
|
self.system_msg(f, message)
|
||||||
elif type_ == 49 and sub_type == 57:
|
elif type_ == 49 and sub_type == 57:
|
||||||
self.refermsg(f,message)
|
self.refermsg(f, message)
|
||||||
f.write(html_end)
|
f.write(html_end)
|
||||||
f.close()
|
f.close()
|
||||||
self.okSignal.emit(1)
|
self.okSignal.emit(1)
|
||||||
@ -501,6 +499,7 @@ class ChildThread(QThread):
|
|||||||
elif type_ == 49 and sub_type == 57:
|
elif type_ == 49 and sub_type == 57:
|
||||||
self.refermsg(f, message)
|
self.refermsg(f, message)
|
||||||
self.okSignal.emit(1)
|
self.okSignal.emit(1)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.output_type == Output.DOCX:
|
if self.output_type == Output.DOCX:
|
||||||
return
|
return
|
||||||
|
@ -3,6 +3,7 @@ from collections import Counter
|
|||||||
from PyQt5.QtCore import QFile, QTextStream, QIODevice
|
from PyQt5.QtCore import QFile, QTextStream, QIODevice
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('.')
|
sys.path.append('.')
|
||||||
|
|
||||||
from app.DataBase import msg_db, MsgType
|
from app.DataBase import msg_db, MsgType
|
||||||
@ -22,13 +23,13 @@ def wordcloud(wxid, is_Annual_report=False, year='2023', who='1'):
|
|||||||
txt_messages = msg_db.get_messages_by_type(wxid, MsgType.TEXT, is_Annual_report, year)
|
txt_messages = msg_db.get_messages_by_type(wxid, MsgType.TEXT, is_Annual_report, year)
|
||||||
if not txt_messages:
|
if not txt_messages:
|
||||||
return {
|
return {
|
||||||
'chart_data': None,
|
'chart_data': None,
|
||||||
'keyword': "没有聊天你想分析啥",
|
'keyword': "没有聊天你想分析啥",
|
||||||
'max_num': "0",
|
'max_num': "0",
|
||||||
'dialogs': []
|
'dialogs': []
|
||||||
}
|
}
|
||||||
# text = ''.join(map(lambda x: x[7], txt_messages))
|
# text = ''.join(map(lambda x: x[7], txt_messages))
|
||||||
text = ''.join(map(lambda x: x[7] if x[4] == int(who) else '', txt_messages)) # 1“我”说的话,0“Ta”说的话
|
text = ''.join(map(lambda x: x[7] if x[4] == int(who) else '', txt_messages)) # 1“我”说的话,0“Ta”说的话
|
||||||
|
|
||||||
total_msg_len = len(text)
|
total_msg_len = len(text)
|
||||||
# 使用jieba进行分词,并加入停用词
|
# 使用jieba进行分词,并加入停用词
|
||||||
@ -60,15 +61,7 @@ def wordcloud(wxid, is_Annual_report=False, year='2023', who='1'):
|
|||||||
keyword, max_num = text_data[0]
|
keyword, max_num = text_data[0]
|
||||||
w = (
|
w = (
|
||||||
WordCloud(init_opts=opts.InitOpts(width=f"{wordcloud_width}px", height=f"{wordcloud_height}px"))
|
WordCloud(init_opts=opts.InitOpts(width=f"{wordcloud_width}px", height=f"{wordcloud_height}px"))
|
||||||
.add(series_name="聊天文字", data_pair=text_data, word_size_range=[20, 100])
|
.add(series_name="聊天文字", data_pair=text_data, word_size_range=[5, 40])
|
||||||
.set_global_opts(
|
|
||||||
title_opts=opts.TitleOpts(
|
|
||||||
title=f"词云图", subtitle=f"总计{total_msg_len}字",
|
|
||||||
title_textstyle_opts=opts.TextStyleOpts(font_size=23)
|
|
||||||
),
|
|
||||||
tooltip_opts=opts.TooltipOpts(is_show=True),
|
|
||||||
legend_opts=opts.LegendOpts(is_show=False)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
# return w.render_embed()
|
# return w.render_embed()
|
||||||
return {
|
return {
|
||||||
@ -134,20 +127,20 @@ def month_count(wxid, is_Annual_report=False, year='2023'):
|
|||||||
.add_yaxis("消息数量", y_data,
|
.add_yaxis("消息数量", y_data,
|
||||||
label_opts=opts.LabelOpts(is_show=False),
|
label_opts=opts.LabelOpts(is_show=False),
|
||||||
itemstyle_opts=opts.ItemStyleOpts(color="skyblue"),
|
itemstyle_opts=opts.ItemStyleOpts(color="skyblue"),
|
||||||
)
|
)
|
||||||
.set_global_opts(
|
.set_global_opts(
|
||||||
title_opts=opts.TitleOpts(title="逐月统计", subtitle=None),
|
title_opts=opts.TitleOpts(title="逐月统计", subtitle=None),
|
||||||
datazoom_opts=opts.DataZoomOpts(),
|
datazoom_opts=opts.DataZoomOpts(),
|
||||||
toolbox_opts=opts.ToolboxOpts(),
|
toolbox_opts=opts.ToolboxOpts(),
|
||||||
visualmap_opts=opts.VisualMapOpts(
|
visualmap_opts=opts.VisualMapOpts(
|
||||||
min_=min(y_data),
|
min_=min(y_data),
|
||||||
max_=max(y_data),
|
max_=max(y_data),
|
||||||
dimension=1, # 根据第2个维度(y 轴)进行映射
|
dimension=1, # 根据第2个维度(y 轴)进行映射
|
||||||
is_piecewise=False, # 是否分段显示
|
is_piecewise=False, # 是否分段显示
|
||||||
range_color=["#66ccff", "#003366"], # 设置颜色范围
|
range_color=["#66ccff", "#003366"], # 设置颜色范围
|
||||||
type_="color",
|
type_="color",
|
||||||
pos_right="0%",
|
pos_right="0%",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,9 +1,21 @@
|
|||||||
version = '0.2.8'
|
version = '0.2.9'
|
||||||
contact = '701805520'
|
contact = '701805520'
|
||||||
|
github = 'https://github.com/LC044/WeChatMsg'
|
||||||
|
website = 'http://memotrace.lc044.love/'
|
||||||
|
copyright = '©2023-2023 ShuaikangZhou'
|
||||||
description = [
|
description = [
|
||||||
'1. 支持获取个人信息<br>',
|
'1. 支持获取个人信息<br>',
|
||||||
'2. 支持显示聊天界面<br>',
|
'2. 支持显示聊天界面<br>',
|
||||||
'3. 支持导出聊天记录<br> * csv<br> * html<br> * txt<br>',
|
'3. 支持导出聊天记录<br> * csv<br> * html<br> * '
|
||||||
|
'txt<br>',
|
||||||
'4. 查找联系人<br>',
|
'4. 查找联系人<br>',
|
||||||
'5. 生成年度报告<br>',
|
'5. 生成年度报告<br>',
|
||||||
]
|
]
|
||||||
|
about = f'''
|
||||||
|
版本:{version}<br>
|
||||||
|
QQ交流群:{contact},加群要求请阅读文档<br>
|
||||||
|
地址:<a href='{github}'>{github}</a><br>
|
||||||
|
官网:<a href='{website}'>{website}</a><br>
|
||||||
|
新特性:<br>{''.join(['' + i for i in description])}<br>
|
||||||
|
Copyright {copyright}
|
||||||
|
'''
|
||||||
|
@ -53,6 +53,7 @@ class ContactPC:
|
|||||||
self.smallHeadImgBLOG = b''
|
self.smallHeadImgBLOG = b''
|
||||||
self.avatar = QPixmap()
|
self.avatar = QPixmap()
|
||||||
self.avatar_path = Icon.Default_avatar_path
|
self.avatar_path = Icon.Default_avatar_path
|
||||||
|
self.is_chatroom = self.wxid.__contains__('@chatroom')
|
||||||
|
|
||||||
def set_avatar(self, img_bytes):
|
def set_avatar(self, img_bytes):
|
||||||
if not img_bytes:
|
if not img_bytes:
|
||||||
|
@ -225,10 +225,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
"""
|
"""
|
||||||
关于
|
关于
|
||||||
"""
|
"""
|
||||||
QMessageBox.about(self, "关于",
|
QMessageBox.about(self, "关于",config.about)
|
||||||
f'''版本:{config.version}<br>QQ交流群:{config.contact},加群要求请阅读文档<br>地址:<a href='https://github.com/LC044/WeChatMsg'>https://github.com/LC044/WeChatMsg</a><br>新特性:<br>{''.join(['' + i for i in config.description])}
|
|
||||||
'''
|
|
||||||
)
|
|
||||||
|
|
||||||
def decrypt_success(self):
|
def decrypt_success(self):
|
||||||
QMessageBox.about(self, "解密成功", "请重新启动")
|
QMessageBox.about(self, "解密成功", "请重新启动")
|
||||||
|
Loading…
Reference in New Issue
Block a user