TUI 上传: 7z 输出改临时目录 (Android Download 公共目录写入受限 errno=1) + 透传压缩日志

This commit is contained in:
lou
2026-08-10 19:50:54 +08:00
parent 42734f8cea
commit 0461802a46
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ Package: 7z-encrypt-client
Version: 1.0.0
Architecture: all
Maintainer: edgevoid <edgevoid@users.noreply.gitee.com>
Installed-Size: 127
Installed-Size: 128
Depends: python3 (>= 3.10), python3-venv, p7zip-full
Section: utils
Priority: optional
+1 -1
View File
@@ -9,6 +9,6 @@ dcb31e74e0a6ee8073337fc4fb2acf99 usr/share/7z-encrypt/config.py
3478ac8277b4b1a38694ad0cc8cdbcdb usr/share/7z-encrypt/splitter.py
b90b8c950f99e1439bc273f50a2ee0a6 usr/share/7z-encrypt/state.py
795881c32c496161290920ae34bf74f1 usr/share/7z-encrypt/transfer.py
67d4b90265abf5a72af959f66679dd0f usr/share/7z-encrypt/tui.py
6aa2072a47dc2aa2a397836dda464040 usr/share/7z-encrypt/tui.py
198943ad7a94f6ba0995cf2d326f66d4 usr/share/doc/7z-encrypt-client/changelog.gz
fadf3972cc61c7c76d0ccc20b29a804c usr/share/doc/7z-encrypt-client/copyright
+6 -6
View File
@@ -13,6 +13,7 @@ import os
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
from urllib import request as urlrequest
@@ -103,13 +104,12 @@ def upload() -> None:
chunk_size = _clean(input("卷大小 MB [10]: ")) or "10"
print("\n[1/3] 7z 压缩 (-mx=9) ...")
src7z = path + ".7z"
r = subprocess.run(
["7z", "a", "-mx=9", "-bd", src7z, path],
capture_output=True, text=True,
)
# 输出到临时目录 (Android 公共目录如 Download 写入受限, errno=1)
src7z = os.path.join(tempfile.gettempdir(), os.path.basename(path) + ".7z")
r = subprocess.run(["7z", "a", "-mx=9", "-bd", src7z, path])
if r.returncode != 0:
print(f"[错误] 7z 压缩失败: {r.stderr[-300:]}")
os.remove(src7z)
print("[错误] 7z 压缩失败")
return
print(f"[1/3] 压缩完成: {os.path.getsize(path) / 1048576:.1f} MB -> {os.path.getsize(src7z) / 1048576:.1f} MB")