Skip to content

Commit e389065

Browse files
committed
修改文件
1 parent d37f75d commit e389065

File tree

10 files changed

+19
-3745
lines changed

10 files changed

+19
-3745
lines changed

app/DataBase/media_msg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_ffmpeg_path():
1616
resource_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__)))
1717

1818
# 构建 FFmpeg 可执行文件的路径
19-
ffmpeg_path = os.path.join(resource_dir, 'app', 'resources', 'ffmpeg.exe')
19+
ffmpeg_path = os.path.join(resource_dir, 'app', 'resources','data', 'ffmpeg.exe')
2020

2121
return ffmpeg_path
2222

@@ -92,11 +92,11 @@ def get_audio(self, reserved0, output_path):
9292
else:
9393
# 源码运行的时候下面的有效
9494
# 这里不知道怎么捕捉异常
95-
cmd = f'''{os.path.join(os.getcwd(), 'app', 'resources', 'ffmpeg.exe')} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}'''
95+
cmd = f'''{os.path.join(os.getcwd(), 'app', 'resources', 'data','ffmpeg.exe')} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}'''
9696
system(cmd)
9797
except Exception as e:
9898
print(f"Error: {e}")
99-
cmd = f'''{os.path.join(os.getcwd(), 'app', 'resources', 'ffmpeg.exe')} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}'''
99+
cmd = f'''{os.path.join(os.getcwd(), 'app', 'resources', 'data', 'ffmpeg.exe')} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}'''
100100
system(cmd)
101101
system(f'del {silk_path}')
102102
system(f'del {pcm_path}')

app/DataBase/output_pc.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def makedirs(path):
3131
os.makedirs(os.path.join(path, 'voice'), exist_ok=True)
3232
os.makedirs(os.path.join(path, 'file'), exist_ok=True)
3333
os.makedirs(os.path.join(path, 'avatar'), exist_ok=True)
34+
file = './app/resources/data/file.png'
35+
if not os.path.exists(file):
36+
resource_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__)))
37+
file = os.path.join(resource_dir, 'app', 'resources', 'data','file.png')
38+
shutil.copy(file, path + '/file/file.png')
3439

3540

3641
def escape_js_and_html(input_str):
@@ -383,7 +388,6 @@ def file(self, doc, message):
383388
if self.output_type == Output.HTML:
384389
link = get_file(bytesExtra, thumb=True, output_path=origin_docx_path + '/file')
385390
file_name = ''
386-
shutil.copy(f"{os.path.abspath('.')}/app/resources/icons/file.png", origin_docx_path + '/file/file.png')
387391
file_path = './file/file.png'
388392
if link != "":
389393
file_name = os.path.basename(link)
@@ -544,16 +548,18 @@ def to_csv(self):
544548
def to_html_(self):
545549
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
546550
makedirs(origin_docx_path)
551+
547552
if self.contact.is_chatroom:
548553
packagemsg = PackageMsg()
549554
messages = packagemsg.get_package_message_by_wxid(self.contact.wxid)
550555
else:
551556
messages = msg_db.get_messages(self.contact.wxid)
552557
filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.html"
553-
file_path = './app/resources/template.html'
558+
file_path = './app/resources/data/template.html'
554559
if not os.path.exists(file_path):
555560
resource_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__)))
556-
file_path = os.path.join(resource_dir, 'app', 'resources', 'template.html')
561+
file_path = os.path.join(resource_dir, 'app', 'resources', 'data','template.html')
562+
557563
with open(file_path, "r", encoding="utf-8") as f:
558564
content = f.read()
559565
html_head, html_end = content.split('/*注意看这是分割线*/')
@@ -688,7 +694,8 @@ def run(self):
688694
for message in messages:
689695
str_content = message[7]
690696
try:
691-
emoji_path = get_emoji(str_content, thumb=True, output_path=origin_docx_path + '/emoji')
697+
pass
698+
# emoji_path = get_emoji(str_content, thumb=True, output_path=origin_docx_path + '/emoji')
692699
except:
693700
logger.error(traceback.format_exc())
694701
finally:

app/analysis/analysis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ def wordcloud_christmas(wxid, year='2023'):
9696
stopwords1 = set(stopword_file.read().splitlines())
9797
# 构建 FFmpeg 可执行文件的路径
9898
stopwords = set()
99-
stopwords_file = './app/resources/stopwords.txt'
99+
stopwords_file = './app/resources/data/stopwords.txt'
100100
if not os.path.exists(stopwords_file):
101101
resource_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__)))
102-
stopwords_file = os.path.join(resource_dir, 'app', 'resources', 'stopwords.txt')
102+
stopwords_file = os.path.join(resource_dir, 'app', 'resources', 'data','stopwords.txt')
103103
with open(stopwords_file, "r", encoding="utf-8") as stopword_file:
104104
stopwords = set(stopword_file.read().splitlines())
105105
stopwords = stopwords.union(stopwords1)

app/resources/ffmpeg.exe

-34.9 MB
Binary file not shown.

app/resources/icons/file.png

-568 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)