From 5dde5446c766be749f77cf73fbaf057c223a04bc Mon Sep 17 00:00:00 2001 From: AlekPet Date: Wed, 7 May 2025 10:44:37 +0300 Subject: [PATCH] update deeplxtranslatenode Add in config.json ability to disable nodes startup, property 'run_deeplx' --- DeepLXTranslateNode/README.md | 7 +++--- DeepLXTranslateNode/deeplx_translate_node.py | 11 ++++++++- DeepLXTranslateNode/install_deeplx.py | 24 +++++++++++++++++--- pyproject.toml | 2 +- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/DeepLXTranslateNode/README.md b/DeepLXTranslateNode/README.md index 7bc6078..5422d81 100644 --- a/DeepLXTranslateNode/README.md +++ b/DeepLXTranslateNode/README.md @@ -109,15 +109,16 @@ You can also call the automatic installer by running shell `run_install_deeplx_w ### Note -On first launch, a `config.json` file will be created where you can specify the initial values ​​from which language to translate and to which language. +On first launch, a `config.json` file will be created where you can specify the initial values ​​from which language to translate and to which language. You can also disable DeepLXTranslate nodes using the 'run_deeplx' property. **Default config.json values:** ```json { "settings": { - "__commnet": "Please check the list of available languages ​​before specifying, especially target_lang! See README file", + "__commnet": "Please check the list of available languages ​​before specifying, especially target_lang! Property run_deeplx disable DeepLXTranslate nodes. See README file", "source_lang": "Russian", - "target_lang": "English" + "target_lang": "English", + "run_deeplx": true } } ``` diff --git a/DeepLXTranslateNode/deeplx_translate_node.py b/DeepLXTranslateNode/deeplx_translate_node.py index e047493..10d5c90 100644 --- a/DeepLXTranslateNode/deeplx_translate_node.py +++ b/DeepLXTranslateNode/deeplx_translate_node.py @@ -109,9 +109,10 @@ if not os.path.exists(config_path): with open(config_path, "w", encoding="utf-8") as f: defaultJSON = { "settings": { - "__commnet": "Please check the list of available languages ​​before specifying, especially target_lang! See README file", + "__commnet": "Please check the list of available languages ​​before specifying, especially target_lang! Property run_deeplx disable DeepLXTranslate nodes. See README file", "source_lang": "Russian", "target_lang": "English", + "run_deeplx": True } } json.dump(defaultJSON, f, ensure_ascii=False, indent=4) @@ -123,6 +124,8 @@ else: if SETTINGS.keys(): reset_lang = False + + # Getting user settings for config.json source_lang = SETTINGS.get("source_lang") target_lang = SETTINGS.get("target_lang") @@ -149,6 +152,12 @@ RETRY_CHECK_SERVER = 10 PATH_TO_DEEPLX_SERVER = os.path.join(NODE_DIR, "DeepLX") PATH_TO_GO = os.path.join(NODE_DIR, "go", "bin") +# We check whether the user has disabled the launch of the DeepLX server. +if not SETTINGS.get("run_deeplx", True): # Setting whether to run DeepLX server + DEEPLX_SERVER_RUNNING = False + raise Exception("User disabled DeepLX server startup in config.json (proprety: 'run_deeplx')") + + ### Automatical install Golang (Go) and DeepLX ### try: # Checking exists path to Go and install Golang (Go) diff --git a/DeepLXTranslateNode/install_deeplx.py b/DeepLXTranslateNode/install_deeplx.py index 877b7e9..f3649ec 100644 --- a/DeepLXTranslateNode/install_deeplx.py +++ b/DeepLXTranslateNode/install_deeplx.py @@ -22,7 +22,10 @@ GO_URLS = { "win32": "https://go.dev/dl/go1.24.2.windows-386.zip", "win64": "https://go.dev/dl/go1.24.2.windows-amd64.zip", "darwin": "https://go.dev/dl/go1.24.2.darwin-arm64.tar.gz", - "linux": "https://go.dev/dl/go1.24.2.linux-386.tar.gz", + "linux_i386_i686": "https://go.dev/dl/go1.24.2.linux-386.tar.gz", + "linux_x86_64": "https://go.dev/dl/go1.24.3.linux-amd64.tar.gz", + "linux_aarch64": "https://go.dev/dl/go1.24.3.linux-arm64.tar.gz", + "linux_armv6l": "https://go.dev/dl/go1.24.3.linux-armv6l.tar.gz", } FILES_DOWNLOAD = { @@ -42,8 +45,23 @@ def getPlatform(): platform_name = None if _platform.startswith("linux"): - platform_name = "linux" - + # Check architecture linux + arch = platform.uname() + if arch.machine == "x86_64": + platform_name = "linux_x86_64" + + elif arch.machine == "i386" or arch.machine == "i686": + platform_name = "linux_i386_i686" + + elif arch.machine == "aarch64": + platform_name = "linux_aarch64" + + elif arch.machine == "armv6l" or arch.machine == "armv7l": + platform_name = "linux_armv6l" + + else: + platform_name = "linux_i386_i686" + elif _platform == "darwin": platform_name = "darwin" diff --git a/pyproject.toml b/pyproject.toml index 5aa2bbf..5c9557c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_custom_nodes_alekpet" description = "Nodes: PoseNode, PainterNode, TranslateTextNode, TranslateCLIPTextEncodeNode, DeepTranslatorTextNode, DeepTranslatorCLIPTextEncodeNode, ArgosTranslateTextNode, ArgosTranslateCLIPTextEncodeNode, ChatGLM4TranslateCLIPTextEncodeNode, ChatGLM4TranslateTextNode, ChatGLM4InstructNode, ChatGLM4InstructMediaNode, DeepLXTranslateTextNode, DeepLXTranslateCLIPTextEncodeNode, PreviewTextNode, HexToHueNode, ColorsCorrectNode, IDENode." -version = "1.0.63" +version = "1.0.64" license = { file = "LICENSE" } [project.urls]