TUI 上传: 7z 输出改临时目录 (Android Download 公共目录写入受限 errno=1) + 透传压缩日志
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user