From 694cf4650fcdcd3fc4844b6c0ee8bf820ec211d5 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Sat, 9 Nov 2024 06:59:59 +0300 Subject: [PATCH 01/12] vnrecode: draft of multithread UI --- vnrecode/__main__.py | 2 +- vnrecode/application.py | 29 ++++---- vnrecode/compress.py | 10 +-- vnrecode/params.py | 2 +- vnrecode/printer.py | 149 ++++++++++++++++++++++++---------------- vnrecode/utils.py | 15 ++-- 6 files changed, 116 insertions(+), 91 deletions(-) diff --git a/vnrecode/__main__.py b/vnrecode/__main__.py index e44ac79..28e325a 100644 --- a/vnrecode/__main__.py +++ b/vnrecode/__main__.py @@ -12,7 +12,7 @@ def init(): :return: None """ params = Params.setup() - printer = Printer(params.source) + printer = Printer(params) utils = Utils(params, printer) compress = Compress(params, printer, utils) diff --git a/vnrecode/application.py b/vnrecode/application.py index b8bbc57..91108c1 100755 --- a/vnrecode/application.py +++ b/vnrecode/application.py @@ -3,6 +3,8 @@ from concurrent.futures import ThreadPoolExecutor, as_completed from datetime import datetime from pathlib import Path import shutil +import psutil +import signal import os from vnrecode.compress import Compress @@ -10,7 +12,6 @@ from vnrecode.printer import Printer from vnrecode.params import Params from vnrecode.utils import Utils - class Application: """ Main class for utility @@ -37,23 +38,25 @@ class Application: if self.__params.dest.exists(): shutil.rmtree(self.__params.dest) - self.__printer.info("Creating folders...") for folder, folders, files in os.walk(source): output = self.__utils.get_comp_subdir(folder) if not output.exists(): os.mkdir(output) - self.__printer.info(f'Compressing "{folder}" folder...') - - with ThreadPoolExecutor(max_workers=self.__params.workers) as executor: - futures = [ - executor.submit(self.__compress, Path(folder, file), Path(output)) - for file in files if Path(folder, file).is_file() - ] - for future in as_completed(futures): - future.result() + for chunk in range(0, len(files), self.__params.workers): + with ThreadPoolExecutor(max_workers=self.__params.workers) as executor: + self.__printer.workers = [] + #for file in files: + for file in files[chunk:chunk+self.__params.workers]: + if Path(folder, file).is_file(): + work_dict = { + "task": executor.submit(self.__compress, Path(folder, file), Path(output)), + "path": [Path(folder, file), Path(output)] + } + self.__printer.workers.append(work_dict) self.__utils.print_duplicates() self.__utils.get_recode_status() - self.__utils.sys_pause() - print(f"Time taken: {datetime.now() - start_time}") \ No newline at end of file + self.__printer.plain(f"Time taken: {datetime.now() - start_time}") + self.__printer.stop() + self.__utils.sys_pause() \ No newline at end of file diff --git a/vnrecode/compress.py b/vnrecode/compress.py index 680da22..7435092 100644 --- a/vnrecode/compress.py +++ b/vnrecode/compress.py @@ -57,7 +57,6 @@ class Compress: def __init__(self, params_inst: Params, printer_inst: Printer, utils_inst: Utils): self.__params = params_inst - self.__printer = printer_inst self.__utils = utils_inst def audio(self, input_path: Path, output_dir: Path, extension: str) -> Path: @@ -80,7 +79,6 @@ class Compress: ) except FFmpegError as e: self.__utils.catch_unprocessed(input_path, out_file, e) - self.__printer.files(input_path, out_file, f"{bit_rate}") return out_file def image(self, input_path: Path, output_dir: Path, extension: str) -> Path: @@ -100,7 +98,6 @@ class Compress: if (extension == "jpg" or extension == "jpeg" or (extension == "webp" and not self.__params.webp_rgba)): if File.has_transparency(image): - self.__printer.warning(f"{input_path.name} has transparency. Changing to fallback...") out_file = Path(output_dir, f"{prefix}_{input_path.stem}.{self.__params.image_fall_ext}") if File.has_transparency(image): @@ -117,7 +114,6 @@ class Compress: lossless=self.__params.image_lossless, quality=quality, minimize_size=True) - self.__printer.files(input_path, out_file, f"{quality}%") except Exception as e: self.__utils.catch_unprocessed(input_path, out_file, e) return out_file @@ -144,7 +140,6 @@ class Compress: .output(out_file,{"codec:v": codec, "v:b": 0, "loglevel": "error"}, crf=crf) .execute() ) - self.__printer.files(input_path, out_file, codec) except FFmpegError as e: self.__utils.catch_unprocessed(input_path, out_file, e) else: @@ -162,7 +157,6 @@ class Compress: prefix = self.__utils.get_hash(input_path.name) out_file = Path(output_dir, f"{prefix}_{input_path.name}") if self.__params.force_compress: - self.__printer.unknown_file(input_path.name) try: (FFmpeg() .input(input_path) @@ -193,5 +187,5 @@ class Compress: out_file = self.unknown(source, output) self.__utils.out_rename(out_file, source) - self.__printer.bar.update() - self.__printer.bar.next() + #self.__printer.bar.update() + #self.__printer.bar.next() diff --git a/vnrecode/params.py b/vnrecode/params.py index d0388f2..cf2e9e3 100644 --- a/vnrecode/params.py +++ b/vnrecode/params.py @@ -93,7 +93,7 @@ class Params: parser.add_argument("-nm", "--no-mimic", dest='mimic', action='store_false', help="Disable mimic mode") parser.add_argument("-v", "--show_errors", action='store_false', help="Show recode errors") parser.add_argument("--webp-rgb", dest='webp_rgba', action='store_false', help="Recode .webp without alpha channel") - parser.add_argument("-j", "--jobs", type=int, help="Number of threads", default=16) + parser.add_argument("-j", "--jobs", type=int, help="Number of threads", default=8) parser.add_argument("-ae", dest="a_ext", help="Audio extension", default="opus") parser.add_argument("-ab", dest="a_bit", help="Audio bit rate", default="128k") parser.add_argument("-id", dest="i_down", type=int, help="Image resolution downscale multiplier", default=1) diff --git a/vnrecode/printer.py b/vnrecode/printer.py index 9207ba7..1ec9703 100644 --- a/vnrecode/printer.py +++ b/vnrecode/printer.py @@ -1,23 +1,103 @@ -from progress.bar import IncrementalBar -from pathlib import Path +from time import sleep import colorama import sys import os +from vnrecode.params import Params +from concurrent.futures import ThreadPoolExecutor + + class Printer: """ Class implements CLI UI for this utility """ - def __init__(self, source: Path): + __anim = ["\u280b", "\u2819", "\u28e0", "\u28c4"] + __ui_size = int + __messages = [] + + def __init__(self, params_inst: Params): """ - :param source: Path of original (compressing) folder to count its files for progress bar + :param params_inst: """ file_count = 0 - for folder, folders, file in os.walk(source): + for folder, folders, file in os.walk(params_inst.source): file_count += len(file) - self.bar = IncrementalBar('Compressing', max=file_count, suffix='[%(index)d/%(max)d] (%(percent).1f%%)') - self.bar.update() + self.workers = [] + self.__ui_size = 0 + self.__running = True + self.__ui_updater = ThreadPoolExecutor().submit(self.update) + + def __print_msgs(self): + for msg in self.__messages: + self.__ui_size += 1 + print(msg) + + def __print_bar(self): + from random import randint + print(f"Recoding... [███████████████] {randint(0, 100)}%") + self.__ui_size += 1 + + def __print_folder(self): + if len(self.workers) > 0: + print(f"\x1b[2K\r\033[100m{self.workers[0]['path'][0].parent}\033[49m:") + self.__ui_size += 1 + + def __print_works(self, frame): + for task in self.workers: + if task['task'].__getstate__()['_state'] == "RUNNING": + self.__ui_size += 1 + print( + f"[{self.__anim[frame % len(self.__anim)]}] " + f"\033[0;37m{task['path'][0].stem}\033[0m{task['path'][0].suffix}\033[0;37m -> " + f"{task['path'][0].stem}\033[0m.file") + + def __clear(self): + print("\033[F\x1b[2K" * self.__ui_size, end='') + self.__ui_size = 0 + + def update(self): + frame = 0 + while self.__running: + self.__print_msgs() + self.__print_bar() + self.__print_folder() + self.__print_works(frame) + sleep(0.1) + self.__clear() + frame+=1 + + def stop(self): + self.__running = False + self.__ui_updater.result() + self.__print_msgs() + + def plain(self, string: str): + self.__messages.append(string) + + def info(self, string: str): + """ + Method prints string with decor for info messages + :param string: String to print + :return: None + """ + self.__messages.append(f"\x1b[2K\r\033[100m- {string}\033[49m") + + def warning(self, string: str): + """ + Method prints string with decor for warning messages + :param string: String to print + :return: None + """ + self.__messages.append(f"\x1b[2K\r\033[93m!\033[0m {string}\033[49m") + + def error(self, string: str): + """ + Method prints string with decor for error messages + :param string: String to print + :return: None + """ + self.__messages.append(f"\x1b[2K\r\033[31m\u2715\033[0m {string}\033[49m") @staticmethod def win_ascii_esc(): @@ -26,57 +106,4 @@ class Printer: :return: None """ if sys.platform == "win32": - colorama.init() - - def bar_print(self, string: str): - """ - Method prints some string in console and updates progress bar - :param string: String to print - :return: None - """ - print(string) - self.bar.update() - - def info(self, string: str): - """ - Method prints string with decor for info messages - :param string: String to print - :return: None - """ - self.bar_print(f"\x1b[2K\r\033[100m- {string}\033[49m") - - def warning(self, string: str): - """ - Method prints string with decor for warning messages - :param string: String to print - :return: None - """ - self.bar_print(f"\x1b[2K\r\033[93m!\033[0m {string}\033[49m") - - def error(self, string: str): - """ - Method prints string with decor for error messages - :param string: String to print - :return: None - """ - self.bar_print(f"\x1b[2K\r\033[31m\u2715\033[0m {string}\033[49m") - - def files(self, source_path: Path, output_path: Path, comment: str): - """ - Method prints the result of recoding a file with some decorations in the form: - input file name -> output file name (quality setting) - :param source_path: Input file Path - :param output_path: Output file Path - :param comment: Comment about recode quality setting - :return: None - """ - self.bar_print(f"\x1b[2K\r\033[0;32m\u2713\033[0m \033[0;37m{source_path.stem}\033[0m{source_path.suffix}\033[0;37m -> " - f"{source_path.stem}\033[0m{output_path.suffix}\033[0;37m ({comment})\033[0m") - - def unknown_file(self, filename: str): - """ - Method prints the result of recoding unknown file - :param filename: Name of unknown file - :return: - """ - self.bar_print(f"\x1b[2K\r\u2713 \033[0;33m{filename}\033[0m (File will be force compressed via ffmpeg)") + colorama.init() \ No newline at end of file diff --git a/vnrecode/utils.py b/vnrecode/utils.py index af0dd8c..33352f1 100644 --- a/vnrecode/utils.py +++ b/vnrecode/utils.py @@ -68,13 +68,14 @@ class Utils: self.__printer.info("Success!") else: self.__printer.warning("Original and compressed folders are not identical!") - try: - source = sum(file.stat().st_size for file in self.__params.source.glob('**/*') if file.is_file()) - output = sum(file.stat().st_size for file in self.__params.dest.glob('**/*') if file.is_file()) - print(f"\nResult: {source/1024/1024:.2f}MB -> " - f"{output/1024/1024:.2f}MB ({(output - source)/1024/1024:.2f}MB)") - except ZeroDivisionError: + source = sum(file.stat().st_size for file in self.__params.source.glob('**/*') if file.is_file()) + output = sum(file.stat().st_size for file in self.__params.dest.glob('**/*') if file.is_file()) + + if (output - source) != 0: + self.__printer.plain(f"Result: {source/1024/1024:.2f}MB -> " + f"{output/1024/1024:.2f}MB ({(output - source)/1024/1024:.2f}MB)") + else: self.__printer.warning("Nothing compressed!") def catch_unprocessed(self, input_path: Path, output_path: Path, error): @@ -100,7 +101,7 @@ class Utils: """ if self.__params.copy_unprocessed: copyfile(input_path, output_path) - self.__printer.info(f"File {input_path.name} copied to compressed folder.") + #self.__printer.info(f"File {input_path.name} copied to compressed folder.") def catch_duplicates(self, path: Path) -> Path: """ From c1f152d8d0c77bff19659c7e062cd189be22f690 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Sat, 28 Dec 2024 02:09:56 +0300 Subject: [PATCH 02/12] Remove strict dependencies versioning --- pyproject.toml | 12 ++++++------ requirements.txt | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f2c379f..a195225 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,10 +23,10 @@ name = "vntools" version = "2.0-dev" requires-python = ">= 3.11" dependencies = [ - "Pillow==10.3.0", - "pillow-avif-plugin==1.4.3", - "python-ffmpeg==2.0.12", - "progress==1.6", - "colorama==0.4.6", - "argparse~=1.4.0" + "Pillow>=10.3.0", + "pillow-avif-plugin>=1.4.3", + "python-ffmpeg>=2.0.12", + "progress>=1.6", + "colorama>=0.4.6", + "argparse>=1.4.0" ] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 16bd1e6..c6dd905 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -Pillow==10.3.0 -pillow-avif-plugin==1.4.3 -python-ffmpeg==2.0.12 -progress==1.6 -colorama==0.4.6 -argparse~=1.4.0 \ No newline at end of file +Pillow>=10.3.0 +pillow-avif-plugin>=1.4.3 +python-ffmpeg>=2.0.12 +progress>=1.6 +colorama>=0.4.6 +argparse>=1.4.0 From 9c367e5249b0dc5ccacea0701fe74b286f7afabd Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Sat, 28 Dec 2024 03:12:45 +0300 Subject: [PATCH 03/12] vnrecode: fix dest path name --- vnrecode/params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnrecode/params.py b/vnrecode/params.py index d0388f2..c102482 100644 --- a/vnrecode/params.py +++ b/vnrecode/params.py @@ -68,7 +68,7 @@ class Params: video_ext = config["VIDEO"]["Extension"] if args.config else args.v_ext video_codec = config["VIDEO"]["Codec"] if args.config else args.v_codec source = Path(args.source) - dest = Path(f"{args.source}_compressed") + dest = Path(source.name + f"_compressed") return cls( copy_unprocessed, force_compress, mimic_mode, hide_errors, webp_rgba, workers, From 3802c52ba054817728cb8cada6d5e3a4ab35f130 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Fri, 24 Jan 2025 02:30:55 +0300 Subject: [PATCH 04/12] vnrecode: check if source path exist (lol) --- vnrecode/params.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vnrecode/params.py b/vnrecode/params.py index c102482..552036c 100644 --- a/vnrecode/params.py +++ b/vnrecode/params.py @@ -68,6 +68,9 @@ class Params: video_ext = config["VIDEO"]["Extension"] if args.config else args.v_ext video_codec = config["VIDEO"]["Codec"] if args.config else args.v_codec source = Path(args.source) + if not source.exists(): + print("Requested path does not exists. Exiting!") + exit(255) dest = Path(source.name + f"_compressed") return cls( From ce62218cdaf4ff35784e25622290f0690ce18370 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Fri, 24 Jan 2025 02:31:26 +0300 Subject: [PATCH 05/12] vnrecode: change progress bar message --- vnrecode/printer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnrecode/printer.py b/vnrecode/printer.py index 9207ba7..18d5138 100644 --- a/vnrecode/printer.py +++ b/vnrecode/printer.py @@ -16,7 +16,7 @@ class Printer: file_count = 0 for folder, folders, file in os.walk(source): file_count += len(file) - self.bar = IncrementalBar('Compressing', max=file_count, suffix='[%(index)d/%(max)d] (%(percent).1f%%)') + self.bar = IncrementalBar('Recoding', max=file_count, suffix='[%(index)d/%(max)d] (%(percent).1f%%)') self.bar.update() @staticmethod From debc1755bbd094b4626a9cb568849106cf8d69c4 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Fri, 24 Jan 2025 03:22:27 +0300 Subject: [PATCH 06/12] vnrecode: add info about default values --- vnrecode/params.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vnrecode/params.py b/vnrecode/params.py index 552036c..a20e9ce 100644 --- a/vnrecode/params.py +++ b/vnrecode/params.py @@ -96,17 +96,17 @@ class Params: parser.add_argument("-nm", "--no-mimic", dest='mimic', action='store_false', help="Disable mimic mode") parser.add_argument("-v", "--show_errors", action='store_false', help="Show recode errors") parser.add_argument("--webp-rgb", dest='webp_rgba', action='store_false', help="Recode .webp without alpha channel") - parser.add_argument("-j", "--jobs", type=int, help="Number of threads", default=16) - parser.add_argument("-ae", dest="a_ext", help="Audio extension", default="opus") - parser.add_argument("-ab", dest="a_bit", help="Audio bit rate", default="128k") - parser.add_argument("-id", dest="i_down", type=int, help="Image resolution downscale multiplier", default=1) - parser.add_argument("-ie", dest="i_ext", help="Image extension", default="avif") - parser.add_argument("-ife", dest="i_fallext", help="Image fallback extension", default="webp") + parser.add_argument("-j", "--jobs", type=int, help="Number of threads (default: 16)", default=16) + parser.add_argument("-ae", dest="a_ext", help="Audio extension (default: opus)", default="opus") + parser.add_argument("-ab", dest="a_bit", help="Audio bit rate (default: 128k)", default="128k") + parser.add_argument("-id", dest="i_down", type=int, help="Image resolution downscale multiplier (default: 1)", default=1) + parser.add_argument("-ie", dest="i_ext", help="Image extension (default: avif)", default="avif") + parser.add_argument("-ife", dest="i_fallext", help="Image fallback extension (default: webp)", default="webp") parser.add_argument("-il", dest='i_lossless', action='store_false', help="Image losing compression mode") - parser.add_argument("-iq", dest="i_quality", type=int, help="Image quality", default=100) - parser.add_argument("--v_crf", help="Video CRF number", type=int, default=27) + parser.add_argument("-iq", dest="i_quality", type=int, help="Image quality (default: 100)", default=100) + parser.add_argument("--v_crf", help="Video CRF number (default: 27)", type=int, default=27) parser.add_argument("-vs", dest="v_skip", action='store_true', help="Skip video recoding") - parser.add_argument("-ve", dest="v_ext", help="Video extension", default="webm") - parser.add_argument("-vc", dest="v_codec", help="Video codec name", default="libvpx-vp9") + parser.add_argument("-ve", dest="v_ext", help="Video extension (default: webm)", default="webm") + parser.add_argument("-vc", dest="v_codec", help="Video codec name (default: libvpx-vp9)", default="libvpx-vp9") args = parser.parse_args() return args \ No newline at end of file From e5bf961ddbf22df9a899eb8ed5110975a690e1f5 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Tue, 28 Jan 2025 21:17:57 +0300 Subject: [PATCH 07/12] vnrecode: fix dest path relativity --- vnrecode/params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnrecode/params.py b/vnrecode/params.py index a20e9ce..18f43a6 100644 --- a/vnrecode/params.py +++ b/vnrecode/params.py @@ -71,7 +71,7 @@ class Params: if not source.exists(): print("Requested path does not exists. Exiting!") exit(255) - dest = Path(source.name + f"_compressed") + dest = Path(source.parent, source.name + f"_compressed") return cls( copy_unprocessed, force_compress, mimic_mode, hide_errors, webp_rgba, workers, From 555ea0ebbb17cc227721086857944a34dcf3040e Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Sat, 1 Feb 2025 15:45:14 +0300 Subject: [PATCH 08/12] Initial Arch Linux packaging --- PKGBUILD | 31 +++++++++++++++++++++++++++++++ README.md | 4 +--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 PKGBUILD diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..0c6ef83 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,31 @@ +# Maintainer: D. Can Celasun +# Contributor: Ezekiel Bethel + +_pkgname=VNTools +pkgname=vntools-git +pkgver=2.0.e5bf961 +pkgrel=1 +pkgdesc="Collection of tools used by VienDesu! Porting Team" +arch=("any") +url="https://github.com/VienDesuPorting/VNTools" +depends=("python" "python-pillow" "python-pillow-avif-plugin" "python-python-ffmpeg" "python-progress" "python-colorama") +makedepends=("python-setuptools" "git") +provides=("vntools") +source=("git+${url}.git#branch=testing") +sha256sums=("SKIP") + +pkgver() { + cd "${srcdir}/${_pkgname}" + printf "2.0.%s" "$(git rev-parse --short HEAD)" +} + +build() { + cd "${srcdir}/${_pkgname}" + python -m build --wheel --no-isolation +} + +package() { + cd "${srcdir}/${_pkgname}" + python -m installer --destdir="${pkgdir}" dist/*.whl +} + diff --git a/README.md b/README.md index b3b0091..eb026d5 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,8 @@ Collection of tools used by VienDesu! Porting Team #### Build tools as binaries: * Run `./build.sh` on UNIX * Run `.\build.bat` for Windows - * Arch Linux - `TODO` - * NixOS - `TODO` #### Install as python package: * Run `pip install -U .` command in project folder - * Arch Linux - `TODO` + * Arch Linux - `paru -Bi .` * NixOS - `TODO` From 00925a4908ca346faafe37f73f1484028c40c617 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Fri, 7 Feb 2025 02:19:03 +0300 Subject: [PATCH 09/12] vnrecode: float image downscale multiplier --- vnrecode/params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnrecode/params.py b/vnrecode/params.py index 18f43a6..61fd8de 100644 --- a/vnrecode/params.py +++ b/vnrecode/params.py @@ -99,7 +99,7 @@ class Params: parser.add_argument("-j", "--jobs", type=int, help="Number of threads (default: 16)", default=16) parser.add_argument("-ae", dest="a_ext", help="Audio extension (default: opus)", default="opus") parser.add_argument("-ab", dest="a_bit", help="Audio bit rate (default: 128k)", default="128k") - parser.add_argument("-id", dest="i_down", type=int, help="Image resolution downscale multiplier (default: 1)", default=1) + parser.add_argument("-id", dest="i_down", type=float, help="Image resolution downscale multiplier (default: 1)", default=1) parser.add_argument("-ie", dest="i_ext", help="Image extension (default: avif)", default="avif") parser.add_argument("-ife", dest="i_fallext", help="Image fallback extension (default: webp)", default="webp") parser.add_argument("-il", dest='i_lossless', action='store_false', help="Image losing compression mode") From 3f3de59844f231743c8119c214bfaefe39113bd1 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Fri, 7 Feb 2025 02:24:34 +0300 Subject: [PATCH 10/12] vnrecode: make temp files hidden --- vnrecode/compress.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vnrecode/compress.py b/vnrecode/compress.py index 680da22..bbff31d 100644 --- a/vnrecode/compress.py +++ b/vnrecode/compress.py @@ -70,7 +70,7 @@ class Compress: """ bit_rate = self.__params.audio_bitrate prefix = self.__utils.get_hash(input_path.name) - out_file = Path(output_dir, f'{prefix}_{input_path.stem}.{extension}') + out_file = Path(output_dir, f'.{prefix}_{input_path.stem}.{extension}') try: (FFmpeg() .input(input_path) @@ -93,7 +93,7 @@ class Compress: """ quality = self.__params.image_quality prefix = self.__utils.get_hash(input_path.name) - out_file = Path(output_dir, f"{prefix}_{input_path.stem}.{extension}") + out_file = Path(output_dir, f".{prefix}_{input_path.stem}.{extension}") try: image = Image.open(input_path) @@ -101,7 +101,7 @@ class Compress: (extension == "webp" and not self.__params.webp_rgba)): if File.has_transparency(image): self.__printer.warning(f"{input_path.name} has transparency. Changing to fallback...") - out_file = Path(output_dir, f"{prefix}_{input_path.stem}.{self.__params.image_fall_ext}") + out_file = Path(output_dir, f".{prefix}_{input_path.stem}.{self.__params.image_fall_ext}") if File.has_transparency(image): image.convert('RGBA') @@ -131,7 +131,7 @@ class Compress: :return: Path of compressed video file with md5 hash as prefix """ prefix = self.__utils.get_hash(input_path.name) - out_file = Path(output_dir, f'{prefix}_{input_path.stem}.{extension}') + out_file = Path(output_dir, f'.{prefix}_{input_path.stem}.{extension}') if not self.__params.video_skip: codec = self.__params.video_codec crf = self.__params.video_crf @@ -160,7 +160,7 @@ class Compress: :return: Path of compressed file with md5 hash as prefix """ prefix = self.__utils.get_hash(input_path.name) - out_file = Path(output_dir, f"{prefix}_{input_path.name}") + out_file = Path(output_dir, f".{prefix}_{input_path.name}") if self.__params.force_compress: self.__printer.unknown_file(input_path.name) try: From 54a4bf1274796596518541536e20e76f9be573cb Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Tue, 18 Feb 2025 23:41:11 +0300 Subject: [PATCH 11/12] Set module version as 2.0.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a195225..01df088 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ unrenapk = "unrenapk.application:launch" [project] name = "vntools" -version = "2.0-dev" +version = "2.0.0" requires-python = ">= 3.11" dependencies = [ "Pillow>=10.3.0", From 44f6777f704e51c8f07967cac5c739d73f4ad02f Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Thu, 1 May 2025 03:16:59 +0300 Subject: [PATCH 12/12] Add release links to README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eb026d5..f9b3c17 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ Collection of tools used by VienDesu! Porting Team ### Installation #### Download from releases: - * Windows - `TODO` - * Linux - `TODO` - * MacOS - `TODO` + * Windows - [x64](https://git.viende.su/VienDesuPorting/VNTools/releases/download/2.0.0/vntools-win-x64.zip) + * Linux - [x86_64](https://git.viende.su/VienDesuPorting/VNTools/releases/download/2.0.0/vntools-linux-x86_64.zip) [arm64](https://git.viende.su/VienDesuPorting/VNTools/releases/download/2.0.0/vntools-linux-arm64.zip) + * MacOS - [x86_64](https://git.viende.su/VienDesuPorting/VNTools/releases/download/2.0.0/vntools-darwin-x86_64.zip) [arm64](https://git.viende.su/VienDesuPorting/VNTools/releases/download/2.0.0/vntools-darwin-arm64.zip) #### Build tools as binaries: - * Run `./build.sh` on UNIX + * Run `./build.sh` for UNIX * Run `.\build.bat` for Windows #### Install as python package: