update deeplxtranslatenode

Add in config.json ability to disable nodes startup, property 'run_deeplx'
This commit is contained in:
AlekPet
2025-05-07 10:44:37 +03:00
parent d2665a1f73
commit 5dde5446c7
4 changed files with 36 additions and 8 deletions
+4 -3
View File
@@ -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
}
}
```
+10 -1
View File
@@ -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)
+21 -3
View File
@@ -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"
+1 -1
View File
@@ -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]