mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-21 01:52:35 +08:00
添加ffmpeg
This commit is contained in:
parent
48830a648c
commit
e9d7b1b7c9
@ -55,17 +55,20 @@ class MediaMsg:
|
||||
silk_path = f"{output_path}\\{reserved0}.silk"
|
||||
pcm_path = f"{output_path}\\{reserved0}.pcm"
|
||||
mp3_path = f"{output_path}\\{reserved0}.mp3"
|
||||
slik_path = silk_path.replace("/", "\\")
|
||||
silk_path = silk_path.replace("/", "\\")
|
||||
pcm_path = pcm_path.replace("/", "\\")
|
||||
mp3_path = mp3_path.replace("/", "\\")
|
||||
print(mp3_path)
|
||||
if os.path.exists(mp3_path):
|
||||
return mp3_path
|
||||
open(silk_path, "wb").write(buf)
|
||||
with open(silk_path, "wb") as f:
|
||||
f.write(buf)
|
||||
# open(silk_path, "wb").write()
|
||||
decode(silk_path, pcm_path, 44100)
|
||||
system(f'ffmpeg.exe -loglevel quiet -y -f s16le -i "{pcm_path}" -ar 44100 -ac 1 "{mp3_path}"')
|
||||
system(f'del "{silk_path}"')
|
||||
system(f'del "{pcm_path}"')
|
||||
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}'''
|
||||
system(cmd)
|
||||
system(f'del {silk_path}')
|
||||
system(f'del {pcm_path}')
|
||||
print(mp3_path)
|
||||
return mp3_path
|
||||
|
||||
def get_audio_text(self, content):
|
||||
|
@ -203,10 +203,16 @@ class Msg:
|
||||
for dialog in temp:
|
||||
msg1 = dialog[0]
|
||||
msg2 = dialog[1]
|
||||
res.append((
|
||||
(msg1[4], msg1[5], msg1[7].split(keyword), msg1[8]),
|
||||
(msg2[4], msg2[5], msg2[7], msg2[8])
|
||||
))
|
||||
try:
|
||||
res.append((
|
||||
(msg1[4], msg1[5], msg1[7].split(keyword), msg1[8]),
|
||||
(msg2[4], msg2[5], msg2[7], msg2[8])
|
||||
))
|
||||
except TypeError:
|
||||
res.append((
|
||||
('', '', ['', ''], ''),
|
||||
('', '', '', '')
|
||||
))
|
||||
return res
|
||||
|
||||
def get_messages_by_days(self, username_, is_Annual_report_=False, year_='2023'):
|
||||
|
@ -313,9 +313,20 @@ class ChildThread(QThread):
|
||||
)
|
||||
elif self.output_type==Output.TXT:
|
||||
name = '你' if is_send else self.contact.remark
|
||||
doc.write(
|
||||
f'''{str_time} {name}\n{content.get('title')}\n引用:{refer_msg.get('displayname')}:{refer_msg.get('content')}\n\n'''
|
||||
)
|
||||
if refer_msg:
|
||||
referText = f"{refer_msg.get('displayname')}:{refer_msg.get('content')}"
|
||||
emojiText = findall(r"(\[.+?\])", referText)
|
||||
for emoji_text in emojiText:
|
||||
if emoji_text in emoji:
|
||||
referText = referText.replace(emoji_text, emoji[emoji_text])
|
||||
doc.write(
|
||||
f'''{str_time} {name}\n{content.get('title')}\n引用:{refer_msg.get('displayname')}:{refer_msg.get('content')}\n\n'''
|
||||
)
|
||||
else:
|
||||
doc.write(
|
||||
f'''{str_time} {name}\n{content.get('title')}\n引用:未知\n\n'''
|
||||
)
|
||||
|
||||
|
||||
def system_msg(self, doc, message):
|
||||
str_content = message[7]
|
||||
|
BIN
app/resources/ffmpeg.exe
Normal file
BIN
app/resources/ffmpeg.exe
Normal file
Binary file not shown.
@ -16,4 +16,4 @@ google==3.0.0
|
||||
protobuf==4.25.1
|
||||
soupsieve==2.5
|
||||
lz4==4.3.2
|
||||
pilk
|
||||
pilk==0.2.4
|
Loading…
Reference in New Issue
Block a user