From 43497402d654c42fd2a03244275f56e828403402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:55:06 +0800 Subject: [PATCH] depracated --- .../LunaTranslator/translator/sugoi.py | 39 ----------------- .../LunaTranslator/translator/sugoionline.py | 22 ---------- .../files/defaultconfig/config.json | 12 ------ .../defaultconfig/translatorsetting.json | 42 ------------------- 4 files changed, 115 deletions(-) delete mode 100644 LunaTranslator/LunaTranslator/translator/sugoi.py delete mode 100644 LunaTranslator/LunaTranslator/translator/sugoionline.py diff --git a/LunaTranslator/LunaTranslator/translator/sugoi.py b/LunaTranslator/LunaTranslator/translator/sugoi.py deleted file mode 100644 index 7261cd22..00000000 --- a/LunaTranslator/LunaTranslator/translator/sugoi.py +++ /dev/null @@ -1,39 +0,0 @@ -import requests, os -from translator.basetranslator import basetrans -from myutils.subproc import subproc_w, autoproc - - -class TS(basetrans): - def inittranslator(self): - checks = ["Runtime", "tokenizator", "translator"] - self.checkempty(checks) - - self.Port = self.config["Port"] - server = os.path.join(self.config["Runtime"], "server.py") - pyexe = os.path.join( - self.config["Runtime"], "python-3.11.8-embed-amd64/python.exe" - ) - for k in [self.config[k] for k in checks] + [server, pyexe]: - if os.path.exists(k) == False: - raise Exception("not exists:" + k) - - self.engine = autoproc( - subproc_w( - '"{}" "{}" "{}" "{}" {}'.format( - pyexe, - server, - self.config["translator"], - self.config["tokenizator"], - self.Port, - ), - name="sugoi", - ) - ) - - def translate(self, query): - return ( - requests.get( - "http://127.0.0.1:{}/translate".format(self.Port), - params={"text": query}, - ).json() - )["trans"] diff --git a/LunaTranslator/LunaTranslator/translator/sugoionline.py b/LunaTranslator/LunaTranslator/translator/sugoionline.py deleted file mode 100644 index f44a4bfb..00000000 --- a/LunaTranslator/LunaTranslator/translator/sugoionline.py +++ /dev/null @@ -1,22 +0,0 @@ -from translator.basetranslator import basetrans - - -class TS(basetrans): - def langmap(self): - return {"en": "English", "ja": "Japanese", "zh": "Chinese", "vi": "Vietnamese"} - - def translate(self, query): - - json_data = { - "content": { - "input_text": query, - "input_language": self.srclang, - "output_language": self.tgtlang, - }, - "message": "translate sentences", - } - - response = self.session.post( - "https://translation-server-proxy-7ja5f.ondigitalocean.app/", json=json_data - ) - return response.json()[0] diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index d3e3c095..04183515 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -955,18 +955,6 @@ "color": "#1839f0", "name": "Jbeijing7" }, - "sugoi": { - "type": "offline", - "use": false, - "color": "#1839f0", - "name": "Sugoi" - }, - "sugoionline": { - "use": true, - "color": "#1839f0", - "name": "Sugoi", - "useproxy": true - }, "kingsoft": { "type": "offline", "use": false, diff --git a/LunaTranslator/files/defaultconfig/translatorsetting.json b/LunaTranslator/files/defaultconfig/translatorsetting.json index 00427968..feeffed6 100644 --- a/LunaTranslator/files/defaultconfig/translatorsetting.json +++ b/LunaTranslator/files/defaultconfig/translatorsetting.json @@ -99,48 +99,6 @@ "key": "" } }, - "sugoi": { - "args": { - "Runtime": "", - "Port":8000, - "tokenizator":"", - "translator":"", - "Download_Runtime":"https://github.com/HIllya51/RESOURCES/releases/download/offline_translator/SugoiRuntime.zip", - "Download_Sugoi":"https://github.com/zyddnys/manga-image-translator/releases/download/beta-0.3/sugoi-models.zip" - } - , - "argstype":{ - "Download_Runtime":{ - "type":"label", - "islink":true - }, - "Download_Sugoi":{ - "type":"label", - "islink":true - }, - "Runtime":{ - "type":"file", - "dir":true, - "filter":"SugoiRuntime" - }, - "Port":{ - "type":"intspin", - "min":1, - "max":65535, - "step":1 - }, - "translator":{ - "type":"file", - "dir":false, - "filter":"model.bin" - }, - "tokenizator":{ - "type":"file", - "dir":false, - "filter":"spm.*.nopretok.model" - } - } - }, "huoshanapi": { "args": { "注册网址": "https://www.volcengine.com/docs/4640/130872",