VideoCompress
This commit is contained in:
65
VideoCompress/installer
Normal file
65
VideoCompress/installer
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
; 脚本由 Inno Setup 脚本向导生成。
|
||||||
|
; 有关创建 Inno Setup 脚本文件的详细信息,请参阅帮助文档!
|
||||||
|
|
||||||
|
#define MyAppName "PDF解密"
|
||||||
|
#define MyAppVersion "1.1"
|
||||||
|
#define MyAppPublisher "flt"
|
||||||
|
#define MyAppURL "https://www.flt6.top/"
|
||||||
|
|
||||||
|
[Setup]
|
||||||
|
; 注意:AppId 的值唯一标识此应用程序。不要在其他应用程序的安装程序中使用相同的 AppId 值。
|
||||||
|
; (若要生成新的 GUID,请在 IDE 中单击 "工具|生成 GUID"。)
|
||||||
|
AppId={{34569C2B-A980-4031-94E1-7CC15988EA75}
|
||||||
|
AppName={#MyAppName}
|
||||||
|
AppVersion={#MyAppVersion}
|
||||||
|
;AppVerName={#MyAppName} {#MyAppVersion}
|
||||||
|
AppPublisher={#MyAppPublisher}
|
||||||
|
AppPublisherURL={#MyAppURL}
|
||||||
|
AppSupportURL={#MyAppURL}
|
||||||
|
AppUpdatesURL={#MyAppURL}
|
||||||
|
DefaultDirName={autopf}\pdfUnlock
|
||||||
|
DefaultGroupName={#MyAppName}
|
||||||
|
; 取消注释以下行以在非管理员安装模式下运行 (仅为当前用户安装)。
|
||||||
|
;PrivilegesRequired=lowest
|
||||||
|
OutputBaseFilename=mysetup
|
||||||
|
SolidCompression=yes
|
||||||
|
WizardStyle=modern
|
||||||
|
|
||||||
|
[Languages]
|
||||||
|
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
|
||||||
|
|
||||||
|
[Tasks]
|
||||||
|
Name: "pdfcontextmenu"; Description: "为PDF文件添加右键菜单"; GroupDescription: "上下文菜单:"; Flags: checkedonce
|
||||||
|
Name: "foldercontextmenu"; Description: "为文件夹添加右键菜单"; GroupDescription: "上下文菜单:"; Flags: checkedonce
|
||||||
|
Name: "folderbackgroundmenu"; Description: "为文件夹空白处添加右键菜单"; GroupDescription: "上下文菜单:"; Flags: checkedonce
|
||||||
|
|
||||||
|
[Files]
|
||||||
|
Source: "C:\git\tools-3\pdf_unlock\dist\main\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||||
|
; 注意:不要在任何共享系统文件上使用 "Flags: ignoreversion"
|
||||||
|
|
||||||
|
[Registry]
|
||||||
|
; PDF文件右键菜单
|
||||||
|
Root: HKCR; Subkey: "SystemFileAssociations\.pdf\shell\RemovePermissions"; ValueType: string; ValueName: ""; ValueData: "移除PDF权限"; Tasks: pdfcontextmenu; Flags: uninsdeletekey
|
||||||
|
Root: HKCR; Subkey: "SystemFileAssociations\.pdf\shell\RemovePermissions"; ValueType: string; ValueName: "MultiSelectModel"; ValueData: "Player"; Tasks: pdfcontextmenu
|
||||||
|
Root: HKCR; Subkey: "SystemFileAssociations\.pdf\shell\RemovePermissions\command"; ValueType: string; ValueName: ""; ValueData: """{app}\main.exe"" ""%1"""; Tasks: pdfcontextmenu
|
||||||
|
|
||||||
|
; 文件夹右键菜单
|
||||||
|
Root: HKCR; Subkey: "Directory\shell\RemovePermissions"; ValueType: string; ValueName: ""; ValueData: "移除PDF权限"; Tasks: foldercontextmenu; Flags: uninsdeletekey
|
||||||
|
Root: HKCR; Subkey: "Directory\shell\RemovePermissions\command"; ValueType: string; ValueName: ""; ValueData: """{app}\main.exe"" ""%1"""; Tasks: foldercontextmenu
|
||||||
|
|
||||||
|
; 文件夹背景右键菜单
|
||||||
|
Root: HKCR; Subkey: "Directory\Background\shell\RemovePermissions"; ValueType: string; ValueName: ""; ValueData: "移除PDF权限"; Tasks: folderbackgroundmenu; Flags: uninsdeletekey
|
||||||
|
Root: HKCR; Subkey: "Directory\Background\shell\RemovePermissions\command"; ValueType: string; ValueName: ""; ValueData: """{app}\main.exe"" ""%V"""; Tasks: folderbackgroundmenu
|
||||||
|
|
||||||
|
[Icons]
|
||||||
|
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||||
|
|
||||||
|
[UninstallDelete]
|
||||||
|
Type: files; Name: "{app}\*"
|
||||||
|
Type: dirifempty; Name: "{app}"
|
||||||
|
|
||||||
|
; [UninstallRun]
|
||||||
|
; 卸载时清理注册表项
|
||||||
|
; Filename: "reg"; Parameters: "delete ""HKCR\SystemFileAssociations\.pdf\shell\RemovePermissions"" /f"; Flags: runhidden; RunOnceId: "DelPDFMenu"
|
||||||
|
; Filename: "reg"; Parameters: "delete ""HKCR\Directory\shell\RemovePermissions"" /f"; Flags: runhidden; RunOnceId: "DelFolderMenu"
|
||||||
|
; Filename: "reg"; Parameters: "delete ""HKCR\Directory\Background\shell\RemovePermissions"" /f"; Flags: runhidden; RunOnceId: "DelBgMenu"
|
@ -177,7 +177,7 @@ def save_esti():
|
|||||||
logging.warning("保存估算数据失败")
|
logging.warning("保存估算数据失败")
|
||||||
logging.debug("error at save_esti",exc_info=e)
|
logging.debug("error at save_esti",exc_info=e)
|
||||||
|
|
||||||
def fmt_time(t:int) -> str:
|
def fmt_time(t:float|int) -> str:
|
||||||
if t>3600:
|
if t>3600:
|
||||||
return f"{t//3600}h {t//60}min {t%60}s"
|
return f"{t//3600}h {t//60}min {t%60}s"
|
||||||
elif t>60:
|
elif t>60:
|
||||||
@ -236,7 +236,8 @@ def process_video(video_path: Path, update_func=None):
|
|||||||
logging.warning(f"文件{output_file}存在,跳过")
|
logging.warning(f"文件{output_file}存在,跳过")
|
||||||
return use
|
return use
|
||||||
|
|
||||||
command = get_cmd(str(video_path.absolute()),output_file)
|
video_path_str = str(video_path.absolute())
|
||||||
|
command = get_cmd(video_path_str,output_file)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = subprocess.Popen(
|
result = subprocess.Popen(
|
||||||
@ -253,9 +254,9 @@ def process_video(video_path: Path, update_func=None):
|
|||||||
line+=result.stderr.read(1)
|
line+=result.stderr.read(1)
|
||||||
# print(line[-1])
|
# print(line[-1])
|
||||||
if 'warning' in line.lower():
|
if 'warning' in line.lower():
|
||||||
logging.warning(f"[FFmpeg]({video_path}): {line}")
|
logging.warning(f"[FFmpeg]({video_path_str}): {line}")
|
||||||
elif 'error' in line.lower():
|
elif 'error' in line.lower():
|
||||||
logging.error(f"[FFmpeg]({video_path}): {line}")
|
logging.error(f"[FFmpeg]({video_path_str}): {line}")
|
||||||
elif "frame=" in line:
|
elif "frame=" in line:
|
||||||
# print(line,end="")
|
# print(line,end="")
|
||||||
match = re.search(r"frame=\s*(\d+)",line)
|
match = re.search(r"frame=\s*(\d+)",line)
|
||||||
@ -265,11 +266,11 @@ def process_video(video_path: Path, update_func=None):
|
|||||||
update_func(frame_number)
|
update_func(frame_number)
|
||||||
|
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
logging.error(f"处理文件 {video_path} 失败,返回码: {result.returncode},cmd={' '.join(command)}")
|
logging.error(f"处理文件 {video_path_str} 失败,返回码: {result.returncode},cmd={' '.join(command)}")
|
||||||
logging.error(result.stdout)
|
logging.error(result.stdout)
|
||||||
logging.error(result.stderr)
|
logging.error(result.stderr)
|
||||||
else:
|
else:
|
||||||
logging.debug(f"文件处理成功: {video_path} -> {output_file}")
|
logging.debug(f"文件处理成功: {video_path_str} -> {output_file}")
|
||||||
|
|
||||||
end=time()
|
end=time()
|
||||||
if TRAIN:
|
if TRAIN:
|
||||||
@ -278,7 +279,7 @@ def process_video(video_path: Path, update_func=None):
|
|||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"执行 ffmpeg 命令时发生异常, 文件:{str(video_path)},cmd={' '.join(command)}",exc_info=e)
|
logging.error(f"执行 ffmpeg 命令时发生异常, 文件:{str(video_path_str)},cmd={' '.join(command)}",exc_info=e)
|
||||||
return use
|
return use
|
||||||
|
|
||||||
def traverse_directory(root_dir: Path):
|
def traverse_directory(root_dir: Path):
|
||||||
|
Reference in New Issue
Block a user