From fc149666d9683e2f58d459b8f896be25052f1cce Mon Sep 17 00:00:00 2001 From: rustdesk Date: Tue, 5 Mar 2024 23:22:15 +0800 Subject: [PATCH] remove icon.rc and add compression level --- libs/portable/generate.py | 11 ++++++----- libs/portable/icon.rc | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 libs/portable/icon.rc diff --git a/libs/portable/generate.py b/libs/portable/generate.py index 0e240b1797f5..df02566a3fde 100755 --- a/libs/portable/generate.py +++ b/libs/portable/generate.py @@ -5,8 +5,6 @@ from hashlib import md5 import brotli -# file compress level(0-11) -compress_level = 11 # 4GB maximum length_count = 4 # encoding @@ -15,7 +13,7 @@ # output: {path: (compressed_data, file_md5)} -def generate_md5_table(folder: str) -> dict: +def generate_md5_table(folder: str, level) -> dict: res: dict = dict() curdir = os.curdir os.chdir(folder) @@ -28,7 +26,7 @@ def generate_md5_table(folder: str) -> dict: f = open(full_path, "rb") content = f.read() content_compressed = brotli.compress( - content, quality=compress_level) + content, quality=level) md5_generator.update(content) md5_code = md5_generator.hexdigest().encode(encoding=encoding) res[full_path] = (content_compressed, md5_code) @@ -81,6 +79,8 @@ def build_portable(output_folder: str, target: str): help="specify startup file in --folder, default is rustdesk.exe") parser.add_option("-t", "--target", dest="target", help="the target used by cargo") + parser.add_option("-l", "--level", dest="level", type="int", + help="compression level, default is 11, highest", default=11) (options, args) = parser.parse_args() folder = options.folder or './rustdesk' output_folder = os.path.abspath(options.output_folder or './') @@ -95,6 +95,7 @@ def build_portable(output_folder: str, target: str): exit(-1) exe = '.' + exe[len(os.path.abspath(folder)):] print("executable path: " + exe) - md5_table = generate_md5_table(folder) + print("compression level: " + str(options.level)) + md5_table = generate_md5_table(folder, options.level) write_metadata(md5_table, output_folder, exe) build_portable(output_folder, options.target) diff --git a/libs/portable/icon.rc b/libs/portable/icon.rc deleted file mode 100644 index 0454662820a1..000000000000 --- a/libs/portable/icon.rc +++ /dev/null @@ -1 +0,0 @@ -rustdesk_icon ICON "../../res/icon.ico"