Skip to content

Commit

Permalink
Merge pull request #130 from STDquantum/master
Browse files Browse the repository at this point in the history
把视频、音频和图片的“修改时间”属性改为其发送时间,方便在本地筛选观察
  • Loading branch information
LC044 authored Dec 14, 2023
2 parents bec28be + b77676e commit f9748f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 10 additions & 2 deletions app/DataBase/output_pc.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def text(self, doc, message):
)

def image(self, doc, message):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
type_ = message[2]
str_content = message[7]
str_time = message[8]
Expand All @@ -210,6 +211,9 @@ def image(self, doc, message):
if image_path is None and image_thumb_path is None:
return
image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
image_path = image_path.replace('/', '\\')
os.utime(origin_docx_path + image_path[1:], (timestamp, timestamp))
print(origin_docx_path + image_path[1:])
image_path = image_path.replace('\\', '/')
# print(f"tohtml:---{image_path}")
if self.is_5_min(timestamp):
Expand All @@ -236,6 +240,8 @@ def audio(self, doc, message):
if self.output_type == Output.HTML:
try:
audio_path = media_msg_db.get_audio(msgSvrId, output_path=origin_docx_path + "/voice")
audio_path = audio_path.replace('/', '\\')
os.utime(audio_path, (timestamp, timestamp))
audio_path = audio_path.replace('\\', '/')
voice_to_text = media_msg_db.get_audio_text(str_content)
except:
Expand Down Expand Up @@ -356,9 +362,10 @@ def video(self, doc, message):
video_path = hard_link_db.get_video(str_content, BytesExtra, thumb=False)
image_path = hard_link_db.get_video(str_content, BytesExtra, thumb=True)
if video_path is None and image_path is not None:
print(video_path, image_path)
image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
print(image_path)
image_path = image_path
os.utime(origin_docx_path + image_path[1:], (timestamp, timestamp))
print(origin_docx_path + image_path[1:])
image_path = image_path.replace('\\', '/')
# print(f"tohtml:---{image_path}")
if self.is_5_min(timestamp):
Expand All @@ -376,6 +383,7 @@ def video(self, doc, message):
new_path = origin_docx_path + '/video/' + os.path.basename(video_path)
if not os.path.exists(new_path):
shutil.copy(video_path, os.path.join(origin_docx_path, 'video'))
os.utime(new_path, (timestamp, timestamp))
video_path = f'./video/{os.path.basename(video_path)}'
video_path = video_path.replace('\\', '/')
if self.is_5_min(timestamp):
Expand Down
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@
- 拍一拍等系统消息✅
- 导出聊天记录
- sqlite数据库✅
- HTML(文本、图片、视频、表情包)✅
- HTML(文本、图片、视频、表情包、语音)✅
- CSV文档✅
- TXT文档✅
- Word文档❎
- 分析聊天数据,做成可视化年报(急需前端大佬提供优质模板)
- 🔥**项目持续更新中**
- 导出全部表情包❎
- 合并多个备份数据❎
- 语音❎
- 文件❎
- 小伙伴们想要其他功能可以留言哦📬

Expand Down

0 comments on commit f9748f2

Please sign in to comment.