Skip to content

Commit

Permalink
修复pyinstaller下ffmeg失效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
tech-shrimp committed Mar 29, 2024
1 parent 20e21b3 commit 408f598
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 3 additions & 1 deletion decrypter/video_decrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_output_path(dir_name, md5, duration):
# 这是到_internal文件夹
resource_dir = getattr(sys, '_MEIPASS')
# 获取_internal上一级文件夹再拼接
return os.path.join(resource_dir, 'output', dir_name, 'videos', f'{md5}_{duration}.mp4')
return os.path.join(os.path.dirname(resource_dir), 'output', dir_name, 'videos', f'{md5}_{duration}.mp4')
else:
return os.path.join(os.getcwd(), 'output', dir_name, 'videos', f'{md5}_{duration}.mp4')

Expand Down Expand Up @@ -117,8 +117,10 @@ def decrypt_videos(self, exporter, start_date, end_date, dir_name, convert_video
input_path = str(file.resolve())
ffmpeg_path = self.get_ffmpeg_path()
output_path = self.get_output_path(dir_name, md5, duration)
print("ffmpeg_path: " + str(ffmpeg_path))
if os.path.exists(ffmpeg_path):
cmd = f'''"{ffmpeg_path}" -loglevel quiet -i "{input_path}" -c:v libx264 "{output_path}"'''
print("ffmpeg_path cmd:" + cmd)
subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
shutil.copy(file.resolve(), f"output/{dir_name}/videos/{md5}_{duration}.mp4")
Expand Down
7 changes: 2 additions & 5 deletions gui/gui.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import os
import threading
import tkinter
import tkinter.font
import tkinter.ttk
from datetime import datetime, timedelta
from pathlib import Path
from typing import Optional
from time import sleep
import tkcalendar
from pywxdump import read_info
from decrypter.db_decrypt import DatabaseDecrypter
from decrypter.video_decrypt import VideoDecrypter
from gui.auto_scroll_guide import AutoScrollGuide
Expand Down Expand Up @@ -82,13 +79,13 @@ def wechat_logged_in(self, account_info):
self.waiting_label.config(text="微信已登录")

self.auto_scroll_button_text = tkinter.StringVar()
self.auto_scroll_button_text.set("读取全部朋友")
self.auto_scroll_button_text.set("自动浏览全部朋友圈")
self.auto_scroll_button = tkinter.ttk.Button(self.root, textvariable=self.auto_scroll_button_text,
command=self.open_auto_scroll_guide)
self.auto_scroll_button.place(relx=0.35, rely=0.15, anchor='center')

self.auto_scroll_button_single_text = tkinter.StringVar()
self.auto_scroll_button_single_text.set("读取单个朋友")
self.auto_scroll_button_single_text.set("自动浏览单个朋友")
self.auto_scroll_button_single = tkinter.ttk.Button(self.root, textvariable=self.auto_scroll_button_single_text,
command=self.switch_auto_scroll_single)
self.auto_scroll_button_single.place(relx=0.655, rely=0.15, anchor='center')
Expand Down

0 comments on commit 408f598

Please sign in to comment.