', inner)]
+ print(imags2)
+
+ inner = simplehtmlparser(response.text, "div", '
', inner)
+ ]
+ print(imags1)
+
+ return {
+ # "namemap": namemap,
+ "title": title,
+ # "infopath": parsehtmlmethod(vndbdowloadinfo(vid)),
+ "imagepath_all": [self.dispatchdownloadtask(_) for _ in imags1 + imags2],
+ "webtags": tags,
+ "developers": [devp],
+ }
diff --git a/LunaTranslator/LunaTranslator/myutils/vndb.py b/LunaTranslator/LunaTranslator/myutils/metadata/vndb.py
similarity index 59%
rename from LunaTranslator/LunaTranslator/myutils/vndb.py
rename to LunaTranslator/LunaTranslator/myutils/metadata/vndb.py
index 237ff42b..c2d391c7 100644
--- a/LunaTranslator/LunaTranslator/myutils/vndb.py
+++ b/LunaTranslator/LunaTranslator/myutils/metadata/vndb.py
@@ -1,88 +1,19 @@
-import time, requests, re, os, hashlib
-from myutils.proxy import getproxy
-from myutils.config import globalconfig, vndbtagdata
+import time, requests, re, os
+from myutils.config import globalconfig, tryreadconfig, safesave
from threading import Thread
import gzip, json
import shutil
-
-def b64string(a):
- return hashlib.md5(a.encode("utf8")).hexdigest()
+from myutils.metadata.abstract import common
-def vndbdownloadimg(url, wait=True):
- os.makedirs("./cache/vndb", exist_ok=True)
- savepath = "./cache/vndb/" + b64string(url) + ".jpg"
- if os.path.exists(savepath):
- return savepath
-
- def _(url, savepath):
- headers = {
- "sec-ch-ua": '"Microsoft Edge";v="113", "Chromium";v="113", "Not-A.Brand";v="24"',
- "Referer": "https://vndb.org/",
- "sec-ch-ua-mobile": "?0",
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.42",
- "sec-ch-ua-platform": '"Windows"',
- }
- try:
- time.sleep(1)
- _content = requests.get(url, headers=headers, proxies=getproxy()).content
- with open(savepath, "wb") as ff:
- ff.write(_content)
- return savepath
- except:
- return None
-
- if wait:
- return _(url, savepath)
- else:
- Thread(target=_, args=(url, savepath)).start()
- return None
-
-
-def vndbdowloadinfo(vid):
- cookies = {
- "vndb_samesite": "1",
- }
-
- headers = {
- "authority": "vndb.org",
- "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
- "sec-ch-ua": '"Microsoft Edge";v="113", "Chromium";v="113", "Not-A.Brand";v="24"',
- "sec-ch-ua-mobile": "?0",
- "sec-ch-ua-platform": '"Windows"',
- "sec-fetch-dest": "document",
- "sec-fetch-mode": "navigate",
- "sec-fetch-site": "none",
- "sec-fetch-user": "?1",
- "upgrade-insecure-requests": "1",
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.42",
- }
- url = "https://vndb.org/" + vid
- os.makedirs("./cache/vndb", exist_ok=True)
- savepath = "./cache/vndb/" + b64string(url) + ".html"
- # print(url,savepath)
- if not os.path.exists(savepath):
- try:
- time.sleep(1)
- response = requests.get(
- url, cookies=cookies, headers=headers, proxies=getproxy()
- )
- with open(savepath, "w", encoding="utf8") as ff:
- ff.write(response.text)
- except:
- return None
- return savepath
-
-
-def safegetvndbjson(url, json, getter):
+def safegetvndbjson(proxy, url, json, getter):
try:
print(url, json)
_ = requests.post(
url,
json=json,
- proxies=getproxy(),
+ proxies=proxy,
)
print(_.text)
try:
@@ -94,7 +25,7 @@ def safegetvndbjson(url, json, getter):
return None
-def gettitlebyid(vid):
+def gettitlebyid(proxy, vid):
def _getter(js):
try:
@@ -110,13 +41,14 @@ def gettitlebyid(vid):
return js["results"][0]["title"]
return safegetvndbjson(
+ proxy,
"https://api.vndb.org/kana/vn",
{"filters": ["id", "=", vid], "fields": "title,titles.title,titles.main"},
_getter,
)
-def getscreenshotsbyid(vid):
+def getscreenshotsbyid(proxy, vid):
def _getter(js):
___ = []
@@ -126,30 +58,34 @@ def getscreenshotsbyid(vid):
return ___
return safegetvndbjson(
+ proxy,
"https://api.vndb.org/kana/vn",
{"filters": ["id", "=", vid], "fields": "screenshots.url"},
_getter,
)
-def getimgbyid(vid):
+def getimgbyid(proxy, vid):
return safegetvndbjson(
+ proxy,
"https://api.vndb.org/kana/vn",
{"filters": ["id", "=", vid], "fields": "image.url"},
lambda js: js["results"][0]["image"]["url"],
)
-def getvidbytitle_vn(title):
+def getvidbytitle_vn(proxy, title):
return safegetvndbjson(
+ proxy,
"https://api.vndb.org/kana/vn",
{"filters": ["search", "=", title], "fields": "id", "sort": "searchrank"},
lambda js: js["results"][0]["id"],
)
-def getvidbytitle_release(title):
+def getvidbytitle_release(proxy, title):
return safegetvndbjson(
+ proxy,
"https://api.vndb.org/kana/release",
{
"filters": ["search", "=", title],
@@ -160,7 +96,7 @@ def getvidbytitle_release(title):
)
-def getdevelopersbyid(vid):
+def getdevelopersbyid(proxy, vid):
def _js(js):
_ = []
@@ -171,6 +107,7 @@ def getdevelopersbyid(vid):
return _
name = safegetvndbjson(
+ proxy,
"https://api.vndb.org/kana/vn",
{"filters": ["id", "=", vid], "fields": "developers.name,developers.original"},
_js,
@@ -178,15 +115,16 @@ def getdevelopersbyid(vid):
return name
-def getvidbytitle(title):
- vid = getvidbytitle_vn(title)
+def getidbytitle_(proxy, title):
+ vid = getvidbytitle_vn(proxy, title)
if vid:
return vid
- return getvidbytitle_release(title)
+ return getvidbytitle_release(proxy, title)
-def getcharnamemapbyid(vid):
+def getcharnamemapbyid(proxy, vid):
res = safegetvndbjson(
+ proxy,
"https://api.vndb.org/kana/character",
{
"filters": [
@@ -213,11 +151,11 @@ def decompress_gzip_file(gzip_file, output_file):
shutil.copyfileobj(f_in, f_out)
-def safedownload():
+def safedownload(proxy):
try:
resp = requests.get(
"https://dl.vndb.org/dump/vndb-tags-latest.json.gz",
- proxies=getproxy(),
+ proxies=proxy,
)
os.makedirs("cache/temp", exist_ok=True)
with open("cache/temp/vndb-tags-latest.json.gz", "wb") as ff:
@@ -241,7 +179,7 @@ def safedownload():
return None
-def getvntagsbyid(vid):
+def getvntagsbyid(proxy, vid):
res = safegetvndbjson(
"https://api.vndb.org/kana/vn",
@@ -258,44 +196,26 @@ def getvntagsbyid(vid):
if not res:
return
tags = []
+ vndbtagdata = tryreadconfig("vndbtagdata.json")
+ changed = False
try:
for r in res:
tag = r["id"]
- if tag not in vndbtagdata:
- js = safedownload()
+ if tag not in vndbtagdata and not changed:
+ js = safedownload(proxy)
if js:
vndbtagdata.update(js)
-
- tags.append(r["id"])
+ changed = True
+ if tag not in vndbtagdata:
+ continue
+ tags.append(vndbtagdata[r["id"]])
except:
pass
+ if changed:
+ safesave("./userconfig/vndbtagdata.json", vndbtagdata)
return tags
-def searchfordata(vid):
-
- os.makedirs("./cache/vndb", exist_ok=True)
- vid = "v{}".format(vid)
- img = getimgbyid(vid)
- title = gettitlebyid(vid)
- namemap = getcharnamemapbyid(vid)
- vndbtags = getvntagsbyid(vid)
- developers = getdevelopersbyid(vid)
- try:
- imagepath_much2 = [vndbdownloadimg(_) for _ in getscreenshotsbyid(vid)]
- except:
- imagepath_much2 = []
- return {
- "namemap": namemap,
- "title": title,
- "infopath": vndbdowloadinfo(vid),
- "imagepath": vndbdownloadimg(img),
- "imagepath_much2": imagepath_much2,
- "vndbtags": vndbtags,
- "developers": developers,
- }
-
-
import re
@@ -324,8 +244,70 @@ def parsehtmlmethod(infopath):
text,
)
-
with open(resavepath, "w", encoding="utf8") as ff:
ff.write(text)
return resavepath
+
+
+def gettagfromhtml(path):
+ if path and os.path.exists(path):
+ with open(path, "r", encoding="utf8") as ff:
+ html = ff.read()
+ find = re.search('
([\\s\\S]*?)
', html)
+ if find:
+ html = find.groups()[0]
+ return [_[1] for _ in re.findall("
(.*?)", html)]
+ return []
+
+
+class searcher(common):
+
+ def refmainpage(self, _id):
+ return f"https://vndb.org/v{_id}"
+
+ def getidbytitle(self, title):
+ vid = getidbytitle_(self.proxy, title)
+ if vid:
+ return int(vid[1:])
+ return None
+
+ def searchfordata(self, vid):
+ os.makedirs("./cache/vndb", exist_ok=True)
+ vid = "v{}".format(vid)
+ img = getimgbyid(self.proxy, vid)
+ title = gettitlebyid(self.proxy, vid)
+ namemap = getcharnamemapbyid(self.proxy, vid)
+ vndbtags = [] # getvntagsbyid(self.proxy, vid) #这个东西谜之慢
+ if len(vndbtags) == 0:
+ # 没代理时下不动那个tag的json
+ vndbtags = gettagfromhtml(
+ self.dispatchdownloadtask(
+ self.refmainpage(vid), ishtml=True, delay=False
+ )
+ )
+ developers = getdevelopersbyid(self.proxy, vid)
+ try:
+ imagepath_much2 = [
+ self.dispatchdownloadtask(_)
+ for _ in getscreenshotsbyid(self.proxy, vid)
+ ]
+ except:
+ imagepath_much2 = []
+ _image = self.dispatchdownloadtask(img)
+ __ = []
+ if _image:
+ __.append(_image)
+ __ += imagepath_much2
+ return {
+ "namemap": namemap,
+ "title": title,
+ "infopath": parsehtmlmethod(
+ self.dispatchdownloadtask(
+ self.refmainpage(vid), ishtml=True, delay=False
+ )
+ ),
+ "imagepath_all": __,
+ "webtags": vndbtags,
+ "developers": developers,
+ }
diff --git a/LunaTranslator/LunaTranslator/myutils/utils.py b/LunaTranslator/LunaTranslator/myutils/utils.py
index 26d09e09..8ccc1171 100644
--- a/LunaTranslator/LunaTranslator/myutils/utils.py
+++ b/LunaTranslator/LunaTranslator/myutils/utils.py
@@ -20,9 +20,39 @@ from myutils.config import (
from ctypes import c_float, pointer, c_void_p
import threading
import re, heapq, winsharedutils
-from myutils.vndb import searchfordata, getvidbytitle
from myutils.wrapper import tryprint
+
+def findenclose(text, tag):
+ i = 0
+ tags = f"<{tag}"
+ tage = f"{tag}>"
+ collect = ""
+ __ = 0
+ while True:
+ if text.startswith(tags):
+ i += 1
+ text = text[len(tags) :]
+ collect += tags
+ elif text.startswith(tage):
+ i -= 1
+ text = text[len(tage) :]
+ collect += tage
+ else:
+ collect += text[0]
+ text = text[1:]
+ if i == 0:
+ break
+
+ return collect
+
+
+def simplehtmlparser(text, tag, sign):
+ text = text[text.find(sign) :]
+ inner = findenclose(text, tag)
+ return inner
+
+
def nowisdark():
dl = globalconfig["darklight"]
if dl == 0:
@@ -33,6 +63,7 @@ def nowisdark():
dark = winsharedutils.isDark()
return dark
+
def getimageformatlist():
_ = [_.data().decode() for _ in QImageWriter.supportedImageFormats()]
if globalconfig["imageformat"] == -1 or globalconfig["imageformat"] >= len(_):
@@ -67,12 +98,6 @@ class PriorityQueue:
searchvndbqueue = PriorityQueue()
-def checkimage(gamepath):
- return (savehook_new_data[gamepath]["imagepath"] is None) or (
- os.path.exists(savehook_new_data[gamepath]["imagepath"]) == False
- )
-
-
def checkinfo(gamepath):
return (savehook_new_data[gamepath]["infopath"] is None) or (
(savehook_new_data[gamepath]["infopath"][:4].lower() != "http")
@@ -82,120 +107,146 @@ def checkinfo(gamepath):
def checkvid(gamepath):
- return (
- checkimage(gamepath)
- or checkinfo(gamepath)
- or (
- (len(savehook_new_data[gamepath]["vndbtags"]) == 0)
- and (len(savehook_new_data[gamepath]["developers"]) == 0)
- )
+ return checkinfo(gamepath) or (
+ (len(savehook_new_data[gamepath]["webtags"]) == 0)
+ and (len(savehook_new_data[gamepath]["developers"]) == 0)
)
-def dispatachtask(gamepath):
+def guessmaybetitle(gamepath):
__t = []
- if savehook_new_data[gamepath]["vid"]:
- if not checkvid(gamepath):
- return
- print(gamepath)
- searchvndbqueue.put((1, gamepath, savehook_new_data[gamepath]["vid"]))
- else:
- if (
- time.time()
- < savehook_new_data[gamepath]["searchnoresulttime"] + 3600 * 24 * 7
- ):
- return
- print(gamepath)
- for _ in [
- savehook_new_data[gamepath]["title"],
- os.path.basename(os.path.dirname(gamepath)),
- os.path.basename(gamepath)[:-4],
- ]:
- _ = _.replace("(同人ゲーム)", "").replace("(18禁ゲーム)", "")
- _ = re.sub(r"\[RJ(.*?)\]", "", _)
- _ = re.sub(r"\[\d{4}-?\d{2}\-?\d{2}\]", "", _)
+
+ print(gamepath)
+ for _ in [
+ savehook_new_data[gamepath]["title"],
+ os.path.basename(os.path.dirname(gamepath)),
+ os.path.basename(gamepath)[:-4],
+ ]:
+ _ = _.replace("(同人ゲーム)", "").replace("(18禁ゲーム)", "")
+ _ = re.sub(r"\[RJ(.*?)\]", "", _)
+ _ = re.sub(r"\[\d{4}-?\d{2}\-?\d{2}\]", "", _)
+ __t.append(_)
+ _ = re.sub(r"\[(.*?)\]", "", _)
+ if _ != __t[-1]:
__t.append(_)
- _ = re.sub(r"\[(.*?)\]", "", _)
- if _ != __t[-1]:
- __t.append(_)
- _ = re.sub(r"\((.*?)\)", "", _)
- if _ != __t[-1]:
- __t.append(_)
- lst = []
- for i, t in enumerate(__t):
- t = t.strip()
- if t in lst:
- continue
- if (len(t) < 10) and (all(ord(c) < 128 for c in t)):
- continue
- lst.append(t)
- searchvndbqueue.put((0, gamepath, lst))
+ _ = re.sub(r"\((.*?)\)", "", _)
+ if _ != __t[-1]:
+ __t.append(_)
+ lst = []
+ for i, t in enumerate(__t):
+ t = t.strip()
+ if t in lst:
+ continue
+ if (len(t) < 10) and (all(ord(c) < 128 for c in t)):
+ continue
+ lst.append(t)
+ return lst
-def parsetask(_type, gamepath, arg):
- if _type == 2:
- dispatachtask(gamepath)
- elif _type == 0:
- searchargs = arg
+targetmod = {}
+for k in globalconfig["metadata"]:
+ targetmod[k] = importlib.import_module(f"myutils.metadata.{k}").searcher(k)
+
+
+def trysearchforid(gamepath, searchargs: list):
+ infoid = None
+ primitivtemetaorigin = globalconfig["primitivtemetaorigin"]
+ __ = list(targetmod.keys())
+ if primitivtemetaorigin not in __:
+ primitivtemetaorigin = __[0]
+ __.remove(primitivtemetaorigin)
+ __.insert(0, primitivtemetaorigin)
+
+ for key in __:
vid = None
for arg in searchargs:
- vid = getvidbytitle(arg)
+ vid = targetmod[key].getidbytitle(arg)
if vid:
break
if not vid:
- return
- savehook_new_data[gamepath]["vid"] = int(vid[1:])
- savehook_new_data[gamepath]["searchnoresulttime"] = time.time()
- searchvndbqueue.put((1, gamepath, int(vid[1:])))
+ continue
+ idname = globalconfig["metadata"][key]["target"]
+ savehook_new_data[gamepath][idname] = vid
+ if infoid is None or key == primitivtemetaorigin:
+ infoid = key, vid
+ if key == primitivtemetaorigin:
+ break
+ if infoid:
+ searchvndbqueue.put((1, gamepath, infoid))
+
+
+def trysearchfordata(gamepath, arg):
+ key, vid = arg
+ try:
+ data = targetmod[key].searchfordata(vid)
+ except:
+ data = {}
+ infopath = data.get("infopath", None)
+ title = data.get("title", None)
+ namemap = data.get("namemap", None)
+ developers = data.get("developers", [])
+ webtags = data.get("webtags", [])
+ imagepath_all = data.get("imagepath_all", [])
+
+ for _ in imagepath_all:
+ if _ is None:
+ continue
+ if _ not in savehook_new_data[gamepath]["imagepath_all"]:
+ savehook_new_data[gamepath]["imagepath_all"].append(_)
+ if title and (not savehook_new_data[gamepath]["istitlesetted"]):
+ savehook_new_data[gamepath]["title"] = title
+ if infopath:
+ savehook_new_data[gamepath]["infopath"] = infopath
+ if namemap:
+ savehook_new_data[gamepath]["namemap"] = namemap
+ if len(webtags):
+ savehook_new_data[gamepath]["webtags"] = webtags
+ if len(developers):
+ savehook_new_data[gamepath]["developers"] = developers
+
+
+def parsetask(_type, gamepath, arg):
+ if _type == 0:
+ trysearchforid(gamepath, arg)
elif _type == 1:
- vid = arg
- data = searchfordata(vid)
-
- imagepath = data.get("imagepath", None)
- infopath = data.get("infopath", None)
- title = data.get("title", None)
- namemap = data.get("namemap", None)
- developers = data.get("developers", None)
- vndbtags = data.get("vndbtags", None)
- imagepath_much2=data.get('imagepath_much2',[])
- if imagepath and (not savehook_new_data[gamepath]["isimagepathusersetted"]):
- savehook_new_data[gamepath]["imagepath"] = imagepath
- if len(imagepath_much2) and (not savehook_new_data[gamepath]["isimagepathusersetted_much"]):
- savehook_new_data[gamepath]["imagepath_much2"] = imagepath_much2
- if title and (not savehook_new_data[gamepath]["istitlesetted"]):
- savehook_new_data[gamepath]["title"] = title
- if infopath:
- savehook_new_data[gamepath]["infopath"] = infopath
- if namemap:
- savehook_new_data[gamepath]["namemap"] = namemap
- if vndbtags:
- savehook_new_data[gamepath]["vndbtags"] = vndbtags
- if developers:
- savehook_new_data[gamepath]["developers"] = developers
+ trysearchforid(gamepath, arg)
def everymethodsthread():
while True:
_ = searchvndbqueue.get()
_type, gamepath, arg = _
- tryprint(parsetask)(_type, gamepath, arg)
+ try:
+ if _type == 0:
+ trysearchforid(gamepath, arg)
+
+ elif _type == 1:
+ trysearchfordata(gamepath, arg)
+ except:
+ print_exc()
threading.Thread(target=everymethodsthread).start()
-def vidchangedtask(gamepath, vid):
- try:
- vid = int(vid)
- except:
+def gamdidchangedtask(key, idname, gamepath):
+ vid = savehook_new_data[gamepath][idname]
+ if vid == "":
return
-
- savehook_new_data[gamepath]["isimagepathusersetted_much"] = False
- savehook_new_data[gamepath]["isimagepathusersetted"] = False
- savehook_new_data[gamepath]["vid"] = vid
- searchvndbqueue.put((1, gamepath, vid), 1)
+ else:
+ try:
+ if globalconfig["metadata"][key]["idtype"] == 0:
+ try:
+ vid = int(vid)
+ except:
+ print(vid)
+ return
+ savehook_new_data[gamepath][idname] = vid
+ searchvndbqueue.put((1, gamepath, (key, vid)), 1)
+ except:
+ print_exc()
def titlechangedtask(gamepath, title):
@@ -205,14 +256,14 @@ def titlechangedtask(gamepath, title):
def checkifnewgame(targetlist, gamepath, title=None):
- if gamepath in targetlist:
- return False
- targetlist.insert(0, gamepath)
-
+ isnew = gamepath in targetlist
+ if not isnew:
+ targetlist.insert(0, gamepath)
if gamepath not in savehook_new_data:
savehook_new_data[gamepath] = getdefaultsavehook(gamepath, title)
- searchvndbqueue.put((2, gamepath, None))
- return True
+ searchvndbqueue.put((0, gamepath, [title] + guessmaybetitle(gamepath)))
+ return isnew
+
kanjichs2ja = str.maketrans(static_data["kanjichs2ja"])
diff --git a/LunaTranslator/LunaTranslator/ocrengines/baiduocr_X.py b/LunaTranslator/LunaTranslator/ocrengines/baiduocr_X.py
index c93784c8..1487823b 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/baiduocr_X.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/baiduocr_X.py
@@ -29,7 +29,7 @@ class OCR(baseocr):
self.config["API Key"],
self.config["Secret Key"],
)
- self.accstoken = self.session.get(
+ self.accstoken = self.proxysession.get(
"https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id="
+ self.appid
+ "&client_secret="
@@ -73,7 +73,7 @@ class OCR(baseocr):
"https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic",
"https://aip.baidubce.com/rest/2.0/ocr/v1/accurate",
][interfacetype]
- response = self.session.post(url, params=params, headers=headers, data=data)
+ response = self.proxysession.post(url, params=params, headers=headers, data=data)
try:
self.countnum()
diff --git a/LunaTranslator/LunaTranslator/ocrengines/baiduocr_ts.py b/LunaTranslator/LunaTranslator/ocrengines/baiduocr_ts.py
index d0764562..05bb4bee 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/baiduocr_ts.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/baiduocr_ts.py
@@ -67,7 +67,7 @@ class OCR(baseocr):
headers = {
"content-type": "multipart/form-data; boundary=6d94758aed493e27c73620d74ff01fc4",
}
- response = self.session.post(url, params=payload, headers=headers, data=data)
+ response = self.proxysession.post(url, params=payload, headers=headers, data=data)
try:
js = response.json()
diff --git a/LunaTranslator/LunaTranslator/ocrengines/docsumo.py b/LunaTranslator/LunaTranslator/ocrengines/docsumo.py
index 6d2bc65c..db5a7fc2 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/docsumo.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/docsumo.py
@@ -33,7 +33,7 @@ class OCR(baseocr):
+ "\r\n------WebKitFormBoundaryUjYOv45hug6CFh3t--\r\n".encode("latin-1")
)
- response = self.session.post(
+ response = self.proxysession.post(
"https://ocrserver.docsumo.com/api/v1/ocr/extract/",
headers=headers,
data=data,
diff --git a/LunaTranslator/LunaTranslator/ocrengines/feishu.py b/LunaTranslator/LunaTranslator/ocrengines/feishu.py
index 635df4de..2cf3bceb 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/feishu.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/feishu.py
@@ -12,7 +12,7 @@ class OCR(baseocr):
app_id = self.config["app_id"]
app_secret = self.config["app_secret"]
if (app_id, app_secret) not in self.tokens:
- res = self.session.post(
+ res = self.proxysession.post(
"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
headers={"Content-Type": "application/json; charset=utf-8"},
json={"app_id": app_id, "app_secret": app_secret},
@@ -27,7 +27,7 @@ class OCR(baseocr):
def ocr(self, imagebinary):
token = self.check()
b64 = base64.b64encode(imagebinary)
- res = self.session.post(
+ res = self.proxysession.post(
"https://open.feishu.cn/open-apis/optical_char_recognition/v1/image/basic_recognize",
headers={
"Content-Type": "application/json; charset=utf-8",
diff --git a/LunaTranslator/LunaTranslator/ocrengines/googlecloudvision.py b/LunaTranslator/LunaTranslator/ocrengines/googlecloudvision.py
index 47fff7a6..72581a96 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/googlecloudvision.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/googlecloudvision.py
@@ -21,7 +21,7 @@ class OCR(baseocr):
}
]
}
- response = self.session.post(ocr_url, json=data)
+ response = self.proxysession.post(ocr_url, json=data)
try:
boxs = []
texts = []
diff --git a/LunaTranslator/LunaTranslator/ocrengines/ocrspace.py b/LunaTranslator/LunaTranslator/ocrengines/ocrspace.py
index c64b2a71..275fe315 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/ocrspace.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/ocrspace.py
@@ -48,7 +48,7 @@ class OCR(baseocr):
"apikey": apikey,
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://" + base + "/parse/image", headers=headers, data=data
)
# print(response.text)
diff --git a/LunaTranslator/LunaTranslator/ocrengines/txocr.py b/LunaTranslator/LunaTranslator/ocrengines/txocr.py
index b73c8a29..b8c1dfcf 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/txocr.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/txocr.py
@@ -55,7 +55,7 @@ class OCR(baseocr):
hashed = hmac.new(key, raw, sha1)
b64output = base64.encodebytes(hashed.digest()).decode("utf-8")
req_para.update({"Signature": b64output})
- r = self.session.get(
+ r = self.proxysession.get(
url="https://ocr.tencentcloudapi.com/", params=req_para, timeout=10
)
# print(r.text)
diff --git a/LunaTranslator/LunaTranslator/ocrengines/txocrtrans.py b/LunaTranslator/LunaTranslator/ocrengines/txocrtrans.py
index b3f699b8..cbc463c2 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/txocrtrans.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/txocrtrans.py
@@ -103,7 +103,7 @@ class OCR(baseocr):
+ signature
)
- r = self.session.post(
+ r = self.proxysession.post(
url="https://tmt.tencentcloudapi.com",
headers={
"Authorization": authorization,
diff --git a/LunaTranslator/LunaTranslator/ocrengines/xunfei.py b/LunaTranslator/LunaTranslator/ocrengines/xunfei.py
index 18464c85..6f748c48 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/xunfei.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/xunfei.py
@@ -120,7 +120,7 @@ class OCR(baseocr):
# print("request_url:", request_url)
body = printed_word_recognition.get_body(file_path=imagebinary)
- response = self.session.post(
+ response = self.proxysession.post(
request_url, data=json.dumps(body), headers=headers
)
diff --git a/LunaTranslator/LunaTranslator/ocrengines/youdaocr.py b/LunaTranslator/LunaTranslator/ocrengines/youdaocr.py
index 9884f06d..7665fa0d 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/youdaocr.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/youdaocr.py
@@ -33,7 +33,7 @@ class OCR(baseocr):
"company": "",
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://aidemo.youdao.com/ocrapi1", headers=headers, data=data
)
@@ -82,7 +82,7 @@ class OCR(baseocr):
data["sign"] = sign
headers = {"Content-Type": "application/x-www-form-urlencoded"}
- response = self.session.post(YOUDAO_URL, data=data, headers=headers)
+ response = self.proxysession.post(YOUDAO_URL, data=data, headers=headers)
self.countnum()
try:
_ = []
diff --git a/LunaTranslator/LunaTranslator/ocrengines/youdaocrtrans.py b/LunaTranslator/LunaTranslator/ocrengines/youdaocrtrans.py
index feba260b..2f9618db 100644
--- a/LunaTranslator/LunaTranslator/ocrengines/youdaocrtrans.py
+++ b/LunaTranslator/LunaTranslator/ocrengines/youdaocrtrans.py
@@ -33,7 +33,7 @@ class OCR(baseocr):
"company": "",
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://aidemo.youdao.com/ocrtransapi1", headers=headers, data=data
)
@@ -134,9 +134,9 @@ class OCR(baseocr):
def doCall(url, header, params, method):
if "get" == method:
- return self.session.get(url, params)
+ return self.proxysession.get(url, params)
elif "post" == method:
- return self.session.post(url, params, header)
+ return self.proxysession.post(url, params, header)
def readFileAsBase64(imagebinary):
return str(base64.b64encode(imagebinary), "utf-8")
diff --git a/LunaTranslator/LunaTranslator/translator/DeepLX.py b/LunaTranslator/LunaTranslator/translator/DeepLX.py
index e9b4d101..fb6ff85b 100644
--- a/LunaTranslator/LunaTranslator/translator/DeepLX.py
+++ b/LunaTranslator/LunaTranslator/translator/DeepLX.py
@@ -17,7 +17,7 @@ class TS(basetrans):
"target_lang": self.tgtlang,
}
- response = self.session.post(self.config["api"], json=payload)
+ response = self.proxysession.post(self.config["api"], json=payload)
try:
return response.json()["data"]
diff --git a/LunaTranslator/LunaTranslator/translator/ali.py b/LunaTranslator/LunaTranslator/translator/ali.py
index b341bcaa..1411485d 100644
--- a/LunaTranslator/LunaTranslator/translator/ali.py
+++ b/LunaTranslator/LunaTranslator/translator/ali.py
@@ -8,7 +8,7 @@ class TS(basetrans):
def inittranslator(self):
- self.session.get(
+ self.proxysession.get(
"https://translate.alibaba.com",
headers={
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
@@ -34,7 +34,7 @@ class TS(basetrans):
},
).text
- self.csrf = self.session.get(
+ self.csrf = self.proxysession.get(
"https://translate.alibaba.com/api/translate/csrftoken"
).json()["token"]
@@ -69,7 +69,7 @@ class TS(basetrans):
"query": content,
"_csrf": self.csrf,
}
- r = self.session.post(
+ r = self.proxysession.post(
"https://translate.alibaba.com/api/translate/text",
headers=headers,
params=form_data,
diff --git a/LunaTranslator/LunaTranslator/translator/aliyunapi.py b/LunaTranslator/LunaTranslator/translator/aliyunapi.py
index fd7f4f21..23bdd443 100644
--- a/LunaTranslator/LunaTranslator/translator/aliyunapi.py
+++ b/LunaTranslator/LunaTranslator/translator/aliyunapi.py
@@ -53,7 +53,7 @@ class TS(basetrans):
"x-acs-signature-method": "HMAC-SHA1",
"x-acs-version": "2019-01-02",
}
- request = self.session.post(url, headers=headers, data=req_body)
+ request = self.proxysession.post(url, headers=headers, data=req_body)
try:
response = request.json()
return response["Data"]["Translated"]
diff --git a/LunaTranslator/LunaTranslator/translator/azure.py b/LunaTranslator/LunaTranslator/translator/azure.py
index 37b7d9c1..e4e36305 100644
--- a/LunaTranslator/LunaTranslator/translator/azure.py
+++ b/LunaTranslator/LunaTranslator/translator/azure.py
@@ -30,7 +30,7 @@ class TS(basetrans):
# You can pass more than one object in body.
body = [{"text": query}]
- request = self.session.post(
+ request = self.proxysession.post(
constructed_url, params=params, headers=headers, json=body
)
response = request.json()
diff --git a/LunaTranslator/LunaTranslator/translator/baidu_ai.py b/LunaTranslator/LunaTranslator/translator/baidu_ai.py
index 112c5684..a8076a30 100644
--- a/LunaTranslator/LunaTranslator/translator/baidu_ai.py
+++ b/LunaTranslator/LunaTranslator/translator/baidu_ai.py
@@ -22,7 +22,7 @@ class TS(basetrans):
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
}
- self.session.get(
+ self.proxysession.get(
"https://fanyi.baidu.com/mtpe-individual/multimodal#/", headers=headers
)
@@ -74,7 +74,7 @@ class TS(basetrans):
"milliTimestamp": int(time.time() * 1000),
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://fanyi.baidu.com/ait/text/translate",
headers=headers,
json=json_data,
diff --git a/LunaTranslator/LunaTranslator/translator/baiduapi.py b/LunaTranslator/LunaTranslator/translator/baiduapi.py
index 0ffdca5c..4c02760d 100644
--- a/LunaTranslator/LunaTranslator/translator/baiduapi.py
+++ b/LunaTranslator/LunaTranslator/translator/baiduapi.py
@@ -47,7 +47,7 @@ class TS(basetrans):
+ sign
)
- res = self.session.get("https://api.fanyi.baidu.com" + myurl)
+ res = self.proxysession.get("https://api.fanyi.baidu.com" + myurl)
try:
_ = "\n".join([_["dst"] for _ in res.json()["trans_result"]])
diff --git a/LunaTranslator/LunaTranslator/translator/caiyun.py b/LunaTranslator/LunaTranslator/translator/caiyun.py
index e736813b..0d72f5b5 100644
--- a/LunaTranslator/LunaTranslator/translator/caiyun.py
+++ b/LunaTranslator/LunaTranslator/translator/caiyun.py
@@ -61,12 +61,12 @@ class TS(basetrans):
json_data = {
"browser_id": self.bid,
}
- self.session.options(
+ self.proxysession.options(
"https://api.interpreter.caiyunai.com/v1/user/jwt/generate",
headers=headers,
json=json_data,
)
- self.jwt = self.session.post(
+ self.jwt = self.proxysession.post(
"https://api.interpreter.caiyunai.com/v1/user/jwt/generate",
headers=headers,
json=json_data,
@@ -108,12 +108,12 @@ class TS(basetrans):
"detect": True,
"browser_id": self.bid,
}
- self.session.options(
+ self.proxysession.options(
"https://api.interpreter.caiyunai.com/v1/translator",
headers=headers,
json=json_data,
)
- response = self.session.post(
+ response = self.proxysession.post(
"https://api.interpreter.caiyunai.com/v1/translator",
headers=headers,
json=json_data,
diff --git a/LunaTranslator/LunaTranslator/translator/caiyunapi.py b/LunaTranslator/LunaTranslator/translator/caiyunapi.py
index 4b661bbf..82042298 100644
--- a/LunaTranslator/LunaTranslator/translator/caiyunapi.py
+++ b/LunaTranslator/LunaTranslator/translator/caiyunapi.py
@@ -22,7 +22,7 @@ class TS(basetrans):
"content-type": "application/json",
"x-authorization": "token " + token,
}
- response = self.session.request(
+ response = self.proxysession.request(
"POST", url, data=json.dumps(payload), headers=headers
)
try:
diff --git a/LunaTranslator/LunaTranslator/translator/claude.py b/LunaTranslator/LunaTranslator/translator/claude.py
index 43d462ba..eb0784ca 100644
--- a/LunaTranslator/LunaTranslator/translator/claude.py
+++ b/LunaTranslator/LunaTranslator/translator/claude.py
@@ -88,7 +88,7 @@ class TS(basetrans):
temperature=temperature,
stream=usingstream,
)
- response = self.session.post(
+ response = self.proxysession.post(
self.checkv1(self.config["BASE_URL"]) + "/messages",
headers=headers,
json=data,
diff --git a/LunaTranslator/LunaTranslator/translator/cohere.py b/LunaTranslator/LunaTranslator/translator/cohere.py
index 3e442a76..0d85b481 100644
--- a/LunaTranslator/LunaTranslator/translator/cohere.py
+++ b/LunaTranslator/LunaTranslator/translator/cohere.py
@@ -124,7 +124,7 @@ class TS(basetrans):
temperature=temperature,
stream=usingstream,
)
- response = self.session.post(
+ response = self.proxysession.post(
"https://api.cohere.ai/v1/chat",
headers=headers,
json=data,
diff --git a/LunaTranslator/LunaTranslator/translator/deepl2.py b/LunaTranslator/LunaTranslator/translator/deepl2.py
index 4bd1fec5..45c51033 100644
--- a/LunaTranslator/LunaTranslator/translator/deepl2.py
+++ b/LunaTranslator/LunaTranslator/translator/deepl2.py
@@ -77,7 +77,7 @@ class TS(basetrans):
"id": 3266547795,
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://www2.deepl.com/jsonrpc?client=chrome-extension,1.11.2",
headers=headers,
json=json_data,
diff --git a/LunaTranslator/LunaTranslator/translator/deeplapi-free.py b/LunaTranslator/LunaTranslator/translator/deeplapi-free.py
index 481c301a..9f35c5c5 100644
--- a/LunaTranslator/LunaTranslator/translator/deeplapi-free.py
+++ b/LunaTranslator/LunaTranslator/translator/deeplapi-free.py
@@ -28,7 +28,7 @@ class TS(basetrans):
+ self.srclang
)
- response = self.session.post(
+ response = self.proxysession.post(
"https://api-free.deepl.com/v2/translate",
headers=headers,
verify=False,
diff --git a/LunaTranslator/LunaTranslator/translator/deeplapi.py b/LunaTranslator/LunaTranslator/translator/deeplapi.py
index f2fdef26..bdb26101 100644
--- a/LunaTranslator/LunaTranslator/translator/deeplapi.py
+++ b/LunaTranslator/LunaTranslator/translator/deeplapi.py
@@ -28,7 +28,7 @@ class TS(basetrans):
+ self.srclang
)
- response = self.session.post(
+ response = self.proxysession.post(
"https://api.deepl.com/v2/translate",
headers=headers,
verify=False,
diff --git a/LunaTranslator/LunaTranslator/translator/feishu.py b/LunaTranslator/LunaTranslator/translator/feishu.py
index 1e083c16..5d56ecec 100644
--- a/LunaTranslator/LunaTranslator/translator/feishu.py
+++ b/LunaTranslator/LunaTranslator/translator/feishu.py
@@ -14,7 +14,7 @@ class TS(basetrans):
app_id = self.multiapikeycurrent["app_id"]
app_secret = self.multiapikeycurrent["app_secret"]
if (app_id, app_secret) not in self.tokens:
- res = self.session.post(
+ res = self.proxysession.post(
"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
headers={"Content-Type": "application/json; charset=utf-8"},
json={"app_id": app_id, "app_secret": app_secret},
@@ -29,7 +29,7 @@ class TS(basetrans):
def translate(self, query):
token = self.check()
- res = self.session.post(
+ res = self.proxysession.post(
"https://open.feishu.cn/open-apis/translation/v1/text/translate",
headers={
"Content-Type": "application/json; charset=utf-8",
diff --git a/LunaTranslator/LunaTranslator/translator/gemini.py b/LunaTranslator/LunaTranslator/translator/gemini.py
index 2bbd9a98..5b5b6876 100644
--- a/LunaTranslator/LunaTranslator/translator/gemini.py
+++ b/LunaTranslator/LunaTranslator/translator/gemini.py
@@ -86,9 +86,9 @@ class TS(basetrans):
payload= {**contents, **safety, **sys_message, **gen_config }
- res = self.session.post(
+ res = self.proxysession.post(
f"https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent",
- params={"key": self.config["SECRET_KEY"]},
+ params={"key": self.multiapikeycurrent["SECRET_KEY"]},
json=payload
)
try:
diff --git a/LunaTranslator/LunaTranslator/translator/google.py b/LunaTranslator/LunaTranslator/translator/google.py
index 0f7483b8..28c154bd 100644
--- a/LunaTranslator/LunaTranslator/translator/google.py
+++ b/LunaTranslator/LunaTranslator/translator/google.py
@@ -11,7 +11,7 @@ class TS(basetrans):
def inittranslator(self):
- _ = self.session.get(
+ _ = self.proxysession.get(
"https://translate.google.com/",
headers={
"authority": "translate.google.com",
@@ -71,7 +71,7 @@ class TS(basetrans):
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://translate.google.com/_/TranslateWebserverUi/data/batchexecute",
verify=False,
headers=headers,
diff --git a/LunaTranslator/LunaTranslator/translator/google2.py b/LunaTranslator/LunaTranslator/translator/google2.py
index 30289120..409df559 100644
--- a/LunaTranslator/LunaTranslator/translator/google2.py
+++ b/LunaTranslator/LunaTranslator/translator/google2.py
@@ -39,7 +39,7 @@ class TS(basetrans):
"q": content,
}
- response = self.session.get(
+ response = self.proxysession.get(
"https://translate.google.com/m",
params=params,
verify=False,
diff --git a/LunaTranslator/LunaTranslator/translator/googleapi.py b/LunaTranslator/LunaTranslator/translator/googleapi.py
index 4ef4ac10..6d04038b 100644
--- a/LunaTranslator/LunaTranslator/translator/googleapi.py
+++ b/LunaTranslator/LunaTranslator/translator/googleapi.py
@@ -16,7 +16,7 @@ class TS(basetrans):
"target": self.tgtlang,
"q": (query),
}
- response = self.session.get(
+ response = self.proxysession.get(
"https://translation.googleapis.com/language/translate/v2/", params=params
)
diff --git a/LunaTranslator/LunaTranslator/translator/gptcommon.py b/LunaTranslator/LunaTranslator/translator/gptcommon.py
index 48d3d3e6..c135930c 100644
--- a/LunaTranslator/LunaTranslator/translator/gptcommon.py
+++ b/LunaTranslator/LunaTranslator/translator/gptcommon.py
@@ -91,7 +91,7 @@ class gptcommon(basetrans):
frequency_penalty=self.config["frequency_penalty"],
stream=usingstream,
)
- response = self.session.post(
+ response = self.proxysession.post(
self.createurl(),
headers=self.createheaders(),
params=self.createparam(),
diff --git a/LunaTranslator/LunaTranslator/translator/huoshan.py b/LunaTranslator/LunaTranslator/translator/huoshan.py
index 67a5e345..439e166f 100644
--- a/LunaTranslator/LunaTranslator/translator/huoshan.py
+++ b/LunaTranslator/LunaTranslator/translator/huoshan.py
@@ -28,7 +28,7 @@ class TS(basetrans):
"glossary_list": [],
"category": "",
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://translate.volcengine.com/crx/translate/v1/",
headers=headers,
json=json_data,
diff --git a/LunaTranslator/LunaTranslator/translator/ibm.py b/LunaTranslator/LunaTranslator/translator/ibm.py
index a2c149c0..9354a9df 100644
--- a/LunaTranslator/LunaTranslator/translator/ibm.py
+++ b/LunaTranslator/LunaTranslator/translator/ibm.py
@@ -12,7 +12,7 @@ class TS(basetrans):
headers = {"Content-Type": "application/json"}
data = {"text": [query], "source": self.srclang, "target": self.tgtlang}
- response = self.session.post(
+ response = self.proxysession.post(
url, auth=("apikey", apikey), headers=headers, data=json.dumps(data)
)
try:
diff --git a/LunaTranslator/LunaTranslator/translator/lingva.py b/LunaTranslator/LunaTranslator/translator/lingva.py
index dae3b1c7..9a7fb8ac 100644
--- a/LunaTranslator/LunaTranslator/translator/lingva.py
+++ b/LunaTranslator/LunaTranslator/translator/lingva.py
@@ -22,7 +22,7 @@ class TS(basetrans):
def translate(self, content):
# print(self.url%(self.srclang,self.tgtlang,urllib.parse.quote(content)))
- x = self.session.get(
+ x = self.proxysession.get(
"https://"
+ self.config["host"]
+ "/api/v1/%s/%s/%s" % (self.srclang, self.tgtlang, quote_plus(content)),
diff --git a/LunaTranslator/LunaTranslator/translator/microsoft.py b/LunaTranslator/LunaTranslator/translator/microsoft.py
index 997f55c6..062d8924 100644
--- a/LunaTranslator/LunaTranslator/translator/microsoft.py
+++ b/LunaTranslator/LunaTranslator/translator/microsoft.py
@@ -91,7 +91,7 @@ def translate_async(text, to_language, from_language=None, self=None):
"Content-Type": "application/json",
}
json_data = [{"Text": text}]
- response = self.session.post(
+ response = self.proxysession.post(
"https://{}".format(url),
headers=headers,
data=json.dumps(json_data).encode("utf-8"),
diff --git a/LunaTranslator/LunaTranslator/translator/papago.py b/LunaTranslator/LunaTranslator/translator/papago.py
index 760e17cd..632a7fa5 100644
--- a/LunaTranslator/LunaTranslator/translator/papago.py
+++ b/LunaTranslator/LunaTranslator/translator/papago.py
@@ -22,10 +22,10 @@ class TS(basetrans):
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36",
}
- host_html = self.session.get("https://papago.naver.com/", headers=headers).text
+ host_html = self.proxysession.get("https://papago.naver.com/", headers=headers).text
url_path = re.compile("/home.(.*?).chunk.js").search(host_html).group()
self.language_url = "".join(["https://papago.naver.com", url_path])
- lang_html = self.session.get(self.language_url, headers=headers).text
+ lang_html = self.proxysession.get(self.language_url, headers=headers).text
self.auth_key = self.get_auth_key(lang_html)
self.uuid = uuid.uuid4().__str__()
@@ -80,7 +80,7 @@ class TS(basetrans):
"text": content,
}
- r = self.session.post(
+ r = self.proxysession.post(
"https://papago.naver.com/apis/n2mt/translate", headers=headers, data=data
)
diff --git a/LunaTranslator/LunaTranslator/translator/qqimt.py b/LunaTranslator/LunaTranslator/translator/qqimt.py
index fccce355..22db891a 100644
--- a/LunaTranslator/LunaTranslator/translator/qqimt.py
+++ b/LunaTranslator/LunaTranslator/translator/qqimt.py
@@ -32,7 +32,7 @@ class TS(basetrans):
"target": {"lang": self.tgtlang},
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://transmart.qq.com/api/imt", headers=headers, json=data
)
return response.json()["auto_translation"]
diff --git a/LunaTranslator/LunaTranslator/translator/sougou2.py b/LunaTranslator/LunaTranslator/translator/sougou2.py
index c2af4f07..a1bfdf83 100644
--- a/LunaTranslator/LunaTranslator/translator/sougou2.py
+++ b/LunaTranslator/LunaTranslator/translator/sougou2.py
@@ -25,7 +25,7 @@ class TS(basetrans):
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
}
- res = self.session.get(
+ res = self.proxysession.get(
"https://fanyi.sogou.com/text?keyword="
+ quote(content)
+ "&transfrom="
diff --git a/LunaTranslator/LunaTranslator/translator/sugoix.py b/LunaTranslator/LunaTranslator/translator/sugoix.py
index 01a5e238..cbe0413a 100644
--- a/LunaTranslator/LunaTranslator/translator/sugoix.py
+++ b/LunaTranslator/LunaTranslator/translator/sugoix.py
@@ -11,7 +11,7 @@ class TS(basetrans):
"message": "translate sentences",
}
- response = self.session.post(self.config["api"], json=json_data)
+ response = self.proxysession.post(self.config["api"], json=json_data)
try:
return response.json()
except:
diff --git a/LunaTranslator/LunaTranslator/translator/tencentapi.py b/LunaTranslator/LunaTranslator/translator/tencentapi.py
index 10cff287..7dceedad 100644
--- a/LunaTranslator/LunaTranslator/translator/tencentapi.py
+++ b/LunaTranslator/LunaTranslator/translator/tencentapi.py
@@ -61,7 +61,7 @@ class TS(basetrans):
data["Signature"] = sign_str(secret_key, s, hashlib.sha1)
# 此处会实际调用,成功后可能产生计费
- r = self.session.get("https://" + endpoint, params=data, timeout=3)
+ r = self.proxysession.get("https://" + endpoint, params=data, timeout=3)
# print(r.json())
return r
diff --git a/LunaTranslator/LunaTranslator/translator/xiaoniu.py b/LunaTranslator/LunaTranslator/translator/xiaoniu.py
index e3136097..89b221d7 100644
--- a/LunaTranslator/LunaTranslator/translator/xiaoniu.py
+++ b/LunaTranslator/LunaTranslator/translator/xiaoniu.py
@@ -28,7 +28,7 @@ class TS(basetrans):
"src_text": query,
"apikey": apikey,
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://api.niutrans.com/NiuTransServer/translation",
headers=headers,
params=params,
diff --git a/LunaTranslator/LunaTranslator/translator/yandexapi.py b/LunaTranslator/LunaTranslator/translator/yandexapi.py
index c3d4ffcb..56efb042 100644
--- a/LunaTranslator/LunaTranslator/translator/yandexapi.py
+++ b/LunaTranslator/LunaTranslator/translator/yandexapi.py
@@ -16,7 +16,7 @@ class TS(basetrans):
"text": content,
}
- response = self.session.get(url, params=params)
+ response = self.proxysession.get(url, params=params)
try:
return response.json()["text"][0]
diff --git a/LunaTranslator/LunaTranslator/translator/youdao.py b/LunaTranslator/LunaTranslator/translator/youdao.py
index e0187f63..c833576d 100644
--- a/LunaTranslator/LunaTranslator/translator/youdao.py
+++ b/LunaTranslator/LunaTranslator/translator/youdao.py
@@ -45,9 +45,9 @@ class TS(basetrans):
}
# proxies = { "http": None, "https": None}
- self.session.trust_env = False
- self.session.headers.update(self.headers)
- self.session.get("https://fanyi.youdao.com")
+ self.proxysession.trust_env = False
+ self.proxysession.headers.update(self.headers)
+ self.proxysession.get("https://fanyi.youdao.com")
def translate(self, content):
@@ -91,7 +91,7 @@ class TS(basetrans):
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://fanyi.youdao.com/translate_o",
params=params,
headers=headers,
diff --git a/LunaTranslator/LunaTranslator/translator/youdao3.py b/LunaTranslator/LunaTranslator/translator/youdao3.py
index bf979af1..21e35595 100644
--- a/LunaTranslator/LunaTranslator/translator/youdao3.py
+++ b/LunaTranslator/LunaTranslator/translator/youdao3.py
@@ -14,7 +14,7 @@ class TS(basetrans):
}
def inittranslator(self):
- self.session.get(
+ self.proxysession.get(
"https://m.youdao.com/translate",
headers={
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
@@ -61,7 +61,7 @@ class TS(basetrans):
"sec-ch-ua-platform": '"Windows"',
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://m.youdao.com/translate",
data=data,
headers=headers,
diff --git a/LunaTranslator/LunaTranslator/translator/youdao5.py b/LunaTranslator/LunaTranslator/translator/youdao5.py
index bb46b594..d2d6db07 100644
--- a/LunaTranslator/LunaTranslator/translator/youdao5.py
+++ b/LunaTranslator/LunaTranslator/translator/youdao5.py
@@ -22,9 +22,9 @@ class TS(basetrans):
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36",
}
- self.session.trust_env = False
- self.session.headers.update(self.headers)
- self.session.get("https://ai.youdao.com/product-fanyi-text.s")
+ self.proxysession.trust_env = False
+ self.proxysession.headers.update(self.headers)
+ self.proxysession.get("https://ai.youdao.com/product-fanyi-text.s")
def translate(self, content):
@@ -50,7 +50,7 @@ class TS(basetrans):
"to": self.tgtlang,
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://aidemo.youdao.com/trans", data=data, headers=headers
)
try:
diff --git a/LunaTranslator/LunaTranslator/translator/youdaoapi.py b/LunaTranslator/LunaTranslator/translator/youdaoapi.py
index a96cd69a..e2dd4c60 100644
--- a/LunaTranslator/LunaTranslator/translator/youdaoapi.py
+++ b/LunaTranslator/LunaTranslator/translator/youdaoapi.py
@@ -41,7 +41,7 @@ class TS(basetrans):
"signType": "v3", # 签名类型,固定值
"curtime": time_curtime, # 秒级时间戳
}
- r = self.session.get(youdao_url, params=data) # 获取返回的json()内容
+ r = self.proxysession.get(youdao_url, params=data) # 获取返回的json()内容
try:
self.countnum(content)
diff --git a/LunaTranslator/LunaTranslator/translator/youdaodict.py b/LunaTranslator/LunaTranslator/translator/youdaodict.py
index f0efc68c..ceb56931 100644
--- a/LunaTranslator/LunaTranslator/translator/youdaodict.py
+++ b/LunaTranslator/LunaTranslator/translator/youdaodict.py
@@ -118,7 +118,7 @@ class TS(basetrans):
"appVersion": "8.10.8.0",
"product": "deskdict",
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://dict.youdao.com/dicttranslate",
params=param,
cookies=cookies,
diff --git a/LunaTranslator/LunaTranslator/translator/yunyi2.py b/LunaTranslator/LunaTranslator/translator/yunyi2.py
index 164fc1ab..ff3d463d 100644
--- a/LunaTranslator/LunaTranslator/translator/yunyi2.py
+++ b/LunaTranslator/LunaTranslator/translator/yunyi2.py
@@ -25,7 +25,7 @@ class TS(basetrans):
"sec-ch-ua-platform": '"Windows"',
}
- response = self.session.post(
+ response = self.proxysession.post(
"https://online.cloudtranslation.com/api/v1.0/request_translate/try_translate",
data={
"type": "text",
diff --git a/LunaTranslator/LunaTranslator/tts/basettsclass.py b/LunaTranslator/LunaTranslator/tts/basettsclass.py
index 125880d1..ea80630a 100644
--- a/LunaTranslator/LunaTranslator/tts/basettsclass.py
+++ b/LunaTranslator/LunaTranslator/tts/basettsclass.py
@@ -2,9 +2,12 @@ from myutils.config import globalconfig
import threading, os, functools
from myutils.wrapper import threader
from traceback import print_exc
+from myutils.proxy import getproxy
class TTSbase:
+ typename = None
+
def init(self):
pass
@@ -19,6 +22,10 @@ class TTSbase:
####################
# 一些可能需要的属性
+ @property
+ def proxy(self):
+ return getproxy(("reader", self.typename))
+
@property
def config(self):
return self.privateconfig["args"]
diff --git a/LunaTranslator/LunaTranslator/tts/edgetts.py b/LunaTranslator/LunaTranslator/tts/edgetts.py
index 2c389a5f..ae35d013 100644
--- a/LunaTranslator/LunaTranslator/tts/edgetts.py
+++ b/LunaTranslator/LunaTranslator/tts/edgetts.py
@@ -1,5 +1,4 @@
import requests
-from myutils.proxy import getproxy
import websocket
from datetime import datetime
@@ -17,12 +16,12 @@ class TTS(TTSbase):
def getvoicelist(self):
self.alllist = requests.get(
"https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=6A5AA1D4EAFF4E9FB37E23D68491D6F4",
- proxies=getproxy(),
+ proxies=self.proxy,
).json()
return [_["ShortName"] for _ in self.alllist]
def speak(self, content, rate, voice, voiceidx):
- return transferMsTTSData(rate, content, voice)
+ return transferMsTTSData(rate, content, voice, self.proxy)
# Fix the time to match Americanisms
@@ -123,7 +122,7 @@ def connect_id() -> str:
return str(uuid.uuid4()).replace("-", "")
-def transferMsTTSData(rate, content, voice):
+def transferMsTTSData(rate, content, voice, proxy):
endpoint2 = "wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4"
headers = {
@@ -144,7 +143,7 @@ def transferMsTTSData(rate, content, voice):
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
" (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.41",
]
- proxy = getproxy()["https"]
+ proxy = proxy["https"]
if proxy:
ip, port = proxy.split(":")
diff --git a/LunaTranslator/LunaTranslator/tts/gtts.py b/LunaTranslator/LunaTranslator/tts/gtts.py
index 55ca0153..eeb7ff56 100644
--- a/LunaTranslator/LunaTranslator/tts/gtts.py
+++ b/LunaTranslator/LunaTranslator/tts/gtts.py
@@ -4,7 +4,6 @@ import json, time
import logging, os
import re
import urllib
-from myutils.proxy import getproxy
import requests
_langs = {
@@ -379,6 +378,7 @@ class gTTS:
def __init__(
self,
+ ref,
text,
tld="com",
lang="en",
@@ -400,7 +400,7 @@ class gTTS:
).run,
timeout=None,
):
-
+ self.ref = ref
# Debug
for k, v in dict(locals()).items():
if k == "self":
@@ -492,7 +492,7 @@ class gTTS:
url=translate_url,
data=data,
headers=self.GOOGLE_TTS_HEADERS,
- proxies=getproxy(),
+ proxies=self.ref.proxy,
)
# Prepare request
@@ -597,6 +597,7 @@ class gTTSError(Exception):
from tts.basettsclass import TTSbase
+
from myutils.config import getlangsrc
@@ -605,5 +606,5 @@ class TTS(TTSbase):
return [""]
def speak(self, content, rate, voice, voiceidx):
- tts = gTTS(content, lang=getlangsrc())
+ tts = gTTS(self, content, lang=getlangsrc())
return tts.save()
diff --git a/LunaTranslator/LunaTranslator/tts/huoshantts.py b/LunaTranslator/LunaTranslator/tts/huoshantts.py
index d675b696..4780a10b 100644
--- a/LunaTranslator/LunaTranslator/tts/huoshantts.py
+++ b/LunaTranslator/LunaTranslator/tts/huoshantts.py
@@ -1,7 +1,6 @@
from traceback import print_exc
import requests
import base64
-import time, os
from tts.basettsclass import TTSbase
@@ -43,7 +42,7 @@ class TTS(TTSbase):
"https://translate.volcengine.com/crx/tts/v1/",
headers=headers,
json=json_data,
- proxies={"http": None, "https": None},
+ proxies=self.proxy,
)
b64 = base64.b64decode(response.json()["audio"]["data"])
diff --git a/LunaTranslator/LunaTranslator/tts/youdaotts.py b/LunaTranslator/LunaTranslator/tts/youdaotts.py
index 02fab944..23107b41 100644
--- a/LunaTranslator/LunaTranslator/tts/youdaotts.py
+++ b/LunaTranslator/LunaTranslator/tts/youdaotts.py
@@ -36,6 +36,6 @@ class TTS(TTSbase):
"https://dict.youdao.com/dictvoice",
params=params,
headers=headers,
- proxies={"http": None, "https": None},
+ proxies=self.proxy,
).content
return response
diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json
index b5c441cd..e29154d9 100644
--- a/LunaTranslator/files/defaultconfig/config.json
+++ b/LunaTranslator/files/defaultconfig/config.json
@@ -17,6 +17,30 @@
"network": 1,
"hookmagpie": true,
"imagewrapmode": 0,
+ "primitivtemetaorigin": "vid",
+ "metadata": {
+ "vndb": {
+ "name": "vndb",
+ "downloadtasks": [],
+ "useproxy": false,
+ "target": "vid",
+ "idtype": 0
+ },
+ "dlsite": {
+ "name": "dlsite",
+ "downloadtasks": [],
+ "useproxy": true,
+ "target": "dlsiteid",
+ "idtype": 1
+ },
+ "bangumi": {
+ "name": "bangumi",
+ "downloadtasks": [],
+ "useproxy": true,
+ "target": "bgmsid",
+ "idtype": 0
+ }
+ },
"relationlinks": [
[
"LunaTranslator",
@@ -715,7 +739,8 @@
"huoshantts": {
"use": false,
"voice": "",
- "name": "火山TTS"
+ "name": "火山TTS",
+ "useproxy": false
},
"edgetts": {
"use": false,
@@ -725,22 +750,26 @@
"youdaotts": {
"use": false,
"voice": "",
- "name": "有道TTS"
+ "name": "有道TTS",
+ "useproxy": false
},
"windowstts": {
"use": false,
"voice": "",
- "name": "WindowsTTS"
+ "name": "WindowsTTS",
+ "type": "offline"
},
"NeoSpeech": {
"use": false,
"voice": "",
- "name": "NeoSpeech"
+ "name": "NeoSpeech",
+ "type": "offline"
},
"voiceroid2": {
"use": false,
"voice": "",
"name": "VoiceRoid2/VoiceRoid+",
+ "type": "offline",
"args": {
"path": ""
},
@@ -756,6 +785,7 @@
"use": false,
"voice": "",
"name": "VOICEVOX",
+ "type": "offline",
"args": {
"path": "",
"Port": 50021
@@ -779,6 +809,7 @@
"use": false,
"voice": "",
"name": "vits-simple-api",
+ "type": "offline",
"args": {
"Port": 23456,
"preset": ""
@@ -802,6 +833,14 @@
"voice": ""
}
},
+ "github": {
+ "versioncheck": {
+ "useproxy": false
+ },
+ "download": {
+ "useproxy": true
+ }
+ },
"hirasetting": {
"mecab": {
"use": false,
@@ -824,18 +863,21 @@
"shiftjis"
]
}
- }
+ },
+ "type": "offline"
},
"mojinlt": {
"use": false,
"name": "mojinlt",
"args": {
"Moji NLT Token": ""
- }
+ },
+ "useproxy": false
},
"latin": {
"use": false,
"name": "标点",
+ "type": "offline",
"args": {
"punctuations": [
" ",
@@ -909,7 +951,8 @@
}
},
"use": false,
- "name": "小学馆"
+ "name": "小学馆",
+ "type": "offline"
},
"edict": {
"use": false,
@@ -940,7 +983,8 @@
"max": 10000,
"step": 1
}
- }
+ },
+ "type": "offline"
},
"edict2": {
"use": false,
@@ -970,7 +1014,8 @@
"max": 10000,
"step": 1
}
- }
+ },
+ "type": "offline"
},
"linggesi": {
"use": false,
@@ -1000,7 +1045,8 @@
"max": 10000,
"step": 1
}
- }
+ },
+ "type": "offline"
},
"mojidict": {
"use": false,
@@ -1016,7 +1062,8 @@
"max": 10000,
"step": 1
}
- }
+ },
+ "useproxy": false
},
"youdao": {
"use": false,
@@ -1032,7 +1079,8 @@
"max": 10000,
"step": 1
}
- }
+ },
+ "useproxy": false
},
"jisho": {
"use": false,
@@ -1127,7 +1175,8 @@
"Flow"
]
}
- }
+ },
+ "type": "offline"
}
},
"darklight": 0,
@@ -1159,15 +1208,18 @@
"ocr": {
"local": {
"use": true,
- "name": "本地OCR"
+ "name": "本地OCR",
+ "type": "offline"
},
"windowsocr": {
"use": false,
- "name": "WindowsOCR"
+ "name": "WindowsOCR",
+ "type": "offline"
},
"tesseract5": {
"use": false,
- "name": "Tesseract5"
+ "name": "Tesseract5",
+ "type": "offline"
},
"baiduocr_X": {
"use": false,
@@ -1219,7 +1271,8 @@
},
"mangaocr": {
"use": false,
- "name": "manga-ocr"
+ "name": "manga-ocr",
+ "type": "offline"
}
},
"fanyi": {
diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json
index 58a6ab36..335fa18a 100644
--- a/LunaTranslator/files/lang/ar.json
+++ b/LunaTranslator/files/lang/ar.json
@@ -9,7 +9,6 @@
"获取失败": "الحصول على فشل",
"助動詞": "فعل مساعد",
"添加行": "إضافة صف",
- "在线OCR": "التعرف الضوئي على الحروف على الانترنت",
"图标": "أيقونات",
"首选翻译": "يفضل الترجمة",
"移除非选定hook": "إزالة غير اختيار هوك",
@@ -498,7 +497,6 @@
"云译": "سحابة ترجمة",
"普通字体": "الخط العادي",
"3D游戏模式": "لعبة وسائط 3D",
- "统计信息": "معلومات إحصائية",
"合并多行识别结果": "دمج نتائج تحديد خط متعددة",
"空心线宽": "جوفاء خط العرض",
"显示": "عرض .",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "امتيازات غير كافية ، يرجى تشغيل مع امتيازات المسؤول !",
"标点": "علامات الترقيم",
"添加到列表": "إضافة إلى قائمة",
- "目标": "الهدف"
+ "目标": "الهدف",
+ "统计": "إحصائيات",
+ "元数据": "البيانات الوصفية",
+ "来源": "المصدر",
+ "首选的": "مفضل",
+ "设为封面": "مجموعة غطاء",
+ "复制": "نسخ",
+ "画廊": "معرض",
+ "删除图片": "حذف الصور"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json
index faa3d15f..3d59c5d2 100644
--- a/LunaTranslator/files/lang/cht.json
+++ b/LunaTranslator/files/lang/cht.json
@@ -440,7 +440,6 @@
"失败": "失敗",
"仅使用激活的翻译": "僅使用啟動的翻譯",
"云译": "雲譯",
- "在线OCR": "線上OCR",
"使用代理的项目": "使用代理的項目",
"相关说明": "相關說明",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "如果你感覺該軟件對你有幫助,歡迎微信掃碼贊助,謝謝~",
@@ -485,7 +484,6 @@
"打开目录": "打開目錄",
"标题": "標題",
"封面": "封面",
- "统计信息": "統計資訊",
"游戏时间": "遊戲時間",
"未开始": "未開始",
"秒": "秒",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "許可權不足,請以管理員許可權運行!",
"标点": "標點",
"添加到列表": "添加到清單",
- "目标": "目標"
+ "目标": "目標",
+ "统计": "統計",
+ "元数据": "中繼資料",
+ "来源": "來源",
+ "首选的": "首選的",
+ "设为封面": "設為封面",
+ "复制": "複製",
+ "画廊": "畫廊",
+ "删除图片": "删除圖片"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json
index ebb01bfe..3e52d24d 100644
--- a/LunaTranslator/files/lang/en.json
+++ b/LunaTranslator/files/lang/en.json
@@ -440,7 +440,6 @@
"失败": "fail",
"仅使用激活的翻译": "Use only active translations",
"云译": "Cloud translation",
- "在线OCR": "Online OCR",
"使用代理的项目": "Projects using proxies",
"相关说明": "Related instructions",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "If you feel that this software is helpful to you, you are welcome to scan WeChat for sponsorship. Thank you~",
@@ -485,7 +484,6 @@
"打开目录": "Open directory",
"标题": "title",
"封面": "cover",
- "统计信息": "statistical information ",
"游戏时间": "Game time",
"未开始": "Not Started",
"秒": "second",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "Insufficient permissions, please run with administrator privileges!",
"标点": "punctuation",
"添加到列表": "Add to list",
- "目标": "target"
+ "目标": "target",
+ "统计": "statistics",
+ "元数据": "metadata",
+ "来源": "source",
+ "首选的": "Preferred",
+ "设为封面": "Set as Cover",
+ "复制": "copy",
+ "画廊": "gallery",
+ "删除图片": "Delete image"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json
index 684a4d06..6a61fee9 100644
--- a/LunaTranslator/files/lang/es.json
+++ b/LunaTranslator/files/lang/es.json
@@ -440,7 +440,6 @@
"失败": "Fracaso",
"仅使用激活的翻译": "Solo se utilizan traducciones activadas",
"云译": "Traducción en la nube",
- "在线OCR": "OCR en línea",
"使用代理的项目": "Proyectos con agentes",
"相关说明": "Instrucciones pertinentes",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "Si sientes que el software te ayuda, Bienvenido al patrocinio de escaneo de wechat, Gracias.",
@@ -485,7 +484,6 @@
"打开目录": "Abrir catálogo",
"标题": "Título",
"封面": "Portada",
- "统计信息": "Información Estadística",
"游戏时间": "Tiempo de juego",
"未开始": "Sin empezar",
"秒": "Segundos",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "¡Permisos insuficientes, ¡ por favor, ejecute con permisos de administrador!",
"标点": "Puntuación",
"添加到列表": "Añadir a la lista",
- "目标": "Objetivo"
+ "目标": "Objetivo",
+ "统计": "Estadísticas",
+ "元数据": "Metadata",
+ "来源": "Fuente",
+ "首选的": "Preferido",
+ "设为封面": "Como portada",
+ "复制": "Copiar",
+ "画廊": "Galería",
+ "删除图片": "Eliminar imagen"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json
index 8d868779..323b776e 100644
--- a/LunaTranslator/files/lang/fr.json
+++ b/LunaTranslator/files/lang/fr.json
@@ -440,7 +440,6 @@
"失败": "L'échec",
"仅使用激活的翻译": "Utiliser uniquement les traductions activées",
"云译": "Traduction Cloud",
- "在线OCR": "OCR en ligne",
"使用代理的项目": "Projets utilisant des agents",
"相关说明": "Instructions connexes",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "Si vous sentez que le logiciel vous aide, bienvenue Wechat scan code sponsoring, merci ~",
@@ -485,7 +484,6 @@
"打开目录": "Ouvrir le catalogue",
"标题": "Titre",
"封面": "Couverture",
- "统计信息": "Informations statistiques",
"游戏时间": "Temps de jeu",
"未开始": "Pas commencé",
"秒": "Secondes",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "Autorisations insuffisantes, exécutez avec des privilèges d'administrateur!",
"标点": "Ponctuation",
"添加到列表": "Ajouter à la Liste",
- "目标": "Objectifs"
+ "目标": "Objectifs",
+ "统计": "Statistiques",
+ "元数据": "Métadonnées",
+ "来源": "Sources",
+ "首选的": "Préféré",
+ "设为封面": "Faire la couverture",
+ "复制": "Copier",
+ "画廊": "Galerie",
+ "删除图片": "Supprimer une image"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json
index 9a0ca7b5..c862d0dc 100644
--- a/LunaTranslator/files/lang/it.json
+++ b/LunaTranslator/files/lang/it.json
@@ -428,7 +428,6 @@
"失败": "fail",
"仅使用激活的翻译": "Usa solo traduzioni attive",
"云译": "Traduzione cloud",
- "在线OCR": "OCR online",
"使用代理的项目": "Progetti che utilizzano proxy",
"相关说明": "Istruzioni correlate",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "Se ritieni che questo software sia utile per te, sei il benvenuto a scansionare WeChat per la sponsorizzazione.",
@@ -485,7 +484,6 @@
"打开目录": "Apri directory",
"标题": "titolo",
"封面": "cover",
- "统计信息": "informazioni statistiche",
"游戏时间": "Tempo di gioco",
"未开始": "Non iniziato",
"秒": "secondo",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "Permessi insufficienti, si prega di eseguire con privilegi di amministratore!",
"标点": "punteggiatura",
"添加到列表": "Aggiungi alla lista",
- "目标": "obiettivo"
+ "目标": "obiettivo",
+ "统计": "statistiche",
+ "元数据": "metadati",
+ "来源": "fonte",
+ "首选的": "Preferito",
+ "设为封面": "Imposta come copertina",
+ "复制": "copia",
+ "画廊": "gallery",
+ "删除图片": "Elimina immagine"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json
index 3870648a..2626c9be 100644
--- a/LunaTranslator/files/lang/ja.json
+++ b/LunaTranslator/files/lang/ja.json
@@ -440,7 +440,6 @@
"失败": "に失敗",
"仅使用激活的翻译": "アクティブな翻訳のみを使用",
"云译": "クラウド翻訳",
- "在线OCR": "オンラインOCR",
"使用代理的项目": "エージェントを使用したアイテム",
"相关说明": "関連説明",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "もしあなたがこのソフトウェアがあなたに役立つと感じたら、微信スキャンコードの協賛を歓迎します、ありがとうございます~",
@@ -485,7 +484,6 @@
"打开目录": "ディレクトリを開く",
"标题": "タイトル",
"封面": "カバー枚",
- "统计信息": "統計#トウケイ#",
"游戏时间": "ゲーム時間",
"未开始": "開始していません",
"秒": "秒",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "権限が不足しています。管理者権限で実行してください。",
"标点": "ひょうてん",
"添加到列表": "リストに追加",
- "目标": "ターゲット"
+ "目标": "ターゲット",
+ "统计": "統計#トウケイ#",
+ "元数据": "メタデータ",
+ "来源": "ソース",
+ "首选的": "優先",
+ "设为封面": "表紙にする",
+ "复制": "レプリケーション",
+ "画廊": "ギャラリー",
+ "删除图片": "画像を削除"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json
index 785c1287..6c187236 100644
--- a/LunaTranslator/files/lang/ko.json
+++ b/LunaTranslator/files/lang/ko.json
@@ -440,7 +440,6 @@
"失败": "실패",
"仅使用激活的翻译": "활성화된 번역만 사용",
"云译": "클라우드 번역",
- "在线OCR": "온라인 OCR",
"使用代理的项目": "프록시 사용 항목",
"相关说明": "관련 설명",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "만약 당신이 이 소프트웨어가 당신에게 도움이 된다고 느낀다면, 위챗 스캔 협찬을 환영합니다. 감사합니다~",
@@ -485,7 +484,6 @@
"打开目录": "디렉토리 열기",
"标题": "제목",
"封面": "표지",
- "统计信息": "통계 정보",
"游戏时间": "게임 시간",
"未开始": "시작하지 않음",
"秒": "초",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "권한이 부족합니다. 관리자 권한으로 실행하십시오!",
"标点": "구두점",
"添加到列表": "목록에 추가",
- "目标": "목표"
+ "目标": "목표",
+ "统计": "통계",
+ "元数据": "메타데이터",
+ "来源": "출처",
+ "首选的": "선호",
+ "设为封面": "표지로 설정하다",
+ "复制": "복제",
+ "画廊": "갤러리",
+ "删除图片": "그림 삭제"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json
index 0fd79e0b..51670e24 100644
--- a/LunaTranslator/files/lang/pl.json
+++ b/LunaTranslator/files/lang/pl.json
@@ -440,7 +440,6 @@
"失败": "niepowodzenie",
"仅使用激活的翻译": "Używaj tylko aktywnych tłumaczeń",
"云译": "Tłumaczenie chmury",
- "在线OCR": "OCR online",
"使用代理的项目": "Projekty wykorzystujące serwery proxy",
"相关说明": "Powiązane instrukcje",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "Jeśli uważasz, że to oprogramowanie jest dla Ciebie pomocne, zapraszamy do skanowania WeChat w celu uzyskania sponsorowania.",
@@ -485,7 +484,6 @@
"打开目录": "Otwórz katalog",
"标题": "tytuł",
"封面": "osłona",
- "统计信息": "informacje statystyczne",
"游戏时间": "Czas gry",
"未开始": "Nie uruchomiono",
"秒": "drugie",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "Niewystarczające uprawnienia, proszę uruchomić z uprawnieniami administratora!",
"标点": "interpunkcja",
"添加到列表": "Dodaj do listy",
- "目标": "cel"
+ "目标": "cel",
+ "统计": "statystyki",
+ "元数据": "metadane",
+ "来源": "źródło",
+ "首选的": "Preferowane",
+ "设为封面": "Ustaw jako okładka",
+ "复制": "kopia",
+ "画廊": "galeria",
+ "删除图片": "Usuń obraz"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json
index 52bdcc55..91031f4e 100644
--- a/LunaTranslator/files/lang/ru.json
+++ b/LunaTranslator/files/lang/ru.json
@@ -440,7 +440,6 @@
"失败": "Неудача",
"仅使用激活的翻译": "Использовать только активный перевод",
"云译": "Облачный перевод",
- "在线OCR": "Онлайн OCR",
"使用代理的项目": "Использовать прокси - проекты",
"相关说明": "Примечания",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "Если вы чувствуете, что программное обеспечение помогает вам, добро пожаловать в спонсорскую поддержку WeChat подметания, спасибо",
@@ -485,7 +484,6 @@
"打开目录": "Открыть каталог",
"标题": "Заголовок",
"封面": "Обложка",
- "统计信息": "Статистическая информация",
"游戏时间": "Время игры",
"未开始": "Не началось",
"秒": "Секунда",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "Недостаточные права, пожалуйста, запустите с правами администратора!",
"标点": "Пунктуация",
"添加到列表": "Добавить в список",
- "目标": "Цель"
+ "目标": "Цель",
+ "统计": "Статистика",
+ "元数据": "Метаданные",
+ "来源": "Источник",
+ "首选的": "Предпочтительный",
+ "设为封面": "Установить обложку",
+ "复制": "Копирование",
+ "画廊": "Галерея",
+ "删除图片": "Удалить изображение"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json
index c8cea7a9..fe4d77e9 100644
--- a/LunaTranslator/files/lang/th.json
+++ b/LunaTranslator/files/lang/th.json
@@ -156,7 +156,6 @@
"标题": "ชื่อเรื่อง",
"过滤尖括号<>": "กรองวงเล็บแหลม <>",
"繁简转换": "การแปลงที่ง่ายดาย",
- "统计信息": "ข้อมูลสถิติ",
"设置": "การตั้งค่า",
"接受的编码": "การเข้ารหัสที่ยอมรับ",
"OCR自动化方法": "วิธีการอัตโนมัติ OCR",
@@ -269,7 +268,6 @@
"自动检测": "การตรวจจับอัตโนมัติ",
"繁体中文(BIG5)": "ภาษาจีนดั้งเดิม (BIG5)",
"翻译等待时间(s)": "เวลารอการแปล (s)",
- "在线OCR": "ออนไลน์ OCR",
"词性": "คำพูด เพศ",
"收到翻译结果时才刷新": "รีเฟรชเมื่อได้รับผลการแปล",
"禁用DirectFlip": "ปิดใช้งาน DirectFlip",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "สิทธิ์ไม่เพียงพอโปรดเรียกใช้ด้วยสิทธิ์ของผู้ดูแลระบบ!",
"标点": "เครื่องหมายวรรคตอน",
"添加到列表": "เพิ่มลงในรายการ",
- "目标": "วัตถุประสงค์"
+ "目标": "วัตถุประสงค์",
+ "统计": "สถิติ",
+ "元数据": "ข้อมูลกำกับภาพ",
+ "来源": "แหล่งที่มา",
+ "首选的": "ตัวเลือกแรก",
+ "设为封面": "ตั้งค่าเป็นปก",
+ "复制": "คัดลอก",
+ "画廊": "แกลเลอรี่",
+ "删除图片": "ลบรูปภาพ"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json
index 7e61bfce..eaa3a357 100644
--- a/LunaTranslator/files/lang/tr.json
+++ b/LunaTranslator/files/lang/tr.json
@@ -440,7 +440,6 @@
"失败": "başarısız",
"仅使用激活的翻译": "Sadece aktif çevirimleri kullan",
"云译": "Bulud çevirimi",
- "在线OCR": "Online OCR",
"使用代理的项目": "Proksiler kullanarak projeler",
"相关说明": "İlişkili talimatlar",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "Eğer bu yazılım size yardımcı olduğunu hissediyorsanız, sponsorluk için WeChat'ı taramak için hoş geldiniz. Teşekkürler ~",
@@ -485,7 +484,6 @@
"打开目录": "Dizini Aç",
"标题": "isim",
"封面": "cover",
- "统计信息": "istatistik bilgi",
"游戏时间": "Oyun zamanı",
"未开始": "Başlanmadı",
"秒": "saniye",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "Insufficient permissions, please run with administrator privileges!",
"标点": "noqtalama",
"添加到列表": "Listeye ekle",
- "目标": "hedef"
+ "目标": "hedef",
+ "统计": "istatistikler",
+ "元数据": "metadata",
+ "来源": "kaynak",
+ "首选的": "Tercih et",
+ "设为封面": "Kapağı olarak ayarlayın",
+ "复制": "kopyalama",
+ "画廊": "Galeri",
+ "删除图片": "Resimi sil"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json
index b2cb02c3..bc85d6f1 100644
--- a/LunaTranslator/files/lang/uk.json
+++ b/LunaTranslator/files/lang/uk.json
@@ -428,7 +428,6 @@
"失败": "невдачі",
"仅使用激活的翻译": "Використовувати лише активні переклади",
"云译": "Переклад хмар",
- "在线OCR": "В мережі OCR",
"使用代理的项目": "Projects using proxies",
"相关说明": "Пов’ язані інструкції",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "Якщо ви відчуваєте, що це програмне забезпечення допомагає вам, ви можете сканувати WeChat для спонсорування. Дякую ~",
@@ -485,7 +484,6 @@
"打开目录": "Відкрити каталог",
"标题": "заголовок",
"封面": "обкладинка",
- "统计信息": "статистична інформація",
"游戏时间": "Час гри",
"未开始": "Не запущено",
"秒": "second",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "Недостатньо прав доступу, будь ласка, запускайте привілеї адміністратора!",
"标点": "пунктуація",
"添加到列表": "Додати до списку",
- "目标": "мета"
+ "目标": "мета",
+ "统计": "статистика",
+ "元数据": "метадані",
+ "来源": "джерело",
+ "首选的": "Найбільше",
+ "设为封面": "Встановити як обкладинку",
+ "复制": "копіювати",
+ "画廊": "галерія",
+ "删除图片": "Вилучити зображення"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json
index 9dc860ff..67281159 100644
--- a/LunaTranslator/files/lang/vi.json
+++ b/LunaTranslator/files/lang/vi.json
@@ -440,7 +440,6 @@
"失败": "Thất bại",
"仅使用激活的翻译": "Chỉ sử dụng bản dịch kích hoạt",
"云译": "Dịch Mây",
- "在线OCR": "Trực tuyến OCR",
"使用代理的项目": "Các dự án sử dụng proxy",
"相关说明": "Hướng dẫn liên quan",
"如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "Nếu bạn cảm thấy phần mềm này có ích cho bạn, hoan nghênh tài trợ quét mã wechat, cảm ơn~",
@@ -485,7 +484,6 @@
"打开目录": "Mở thư mục",
"标题": "Tiêu đề",
"封面": "Trang chủ",
- "统计信息": "Thống kê",
"游戏时间": "Thời gian chơi",
"未开始": "Chưa bắt đầu",
"秒": "giây",
@@ -820,5 +818,13 @@
"权限不足,请以管理员权限运行!": "Không đủ quyền, hãy chạy với quyền quản trị viên!",
"标点": "Chấm câu",
"添加到列表": "Thêm vào danh sách",
- "目标": "Mục tiêu"
+ "目标": "Mục tiêu",
+ "统计": "Thống kê",
+ "元数据": "Siêu dữ liệu",
+ "来源": "Nguồn",
+ "首选的": "Ưu tiên",
+ "设为封面": "Đặt làm bìa",
+ "复制": "Sao chép",
+ "画廊": "Thư viện",
+ "删除图片": "Xóa ảnh"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json
index 404e3c0b..b67a8a91 100644
--- a/LunaTranslator/files/lang/zh.json
+++ b/LunaTranslator/files/lang/zh.json
@@ -155,7 +155,7 @@
"标题": "",
"过滤尖括号<>": "",
"繁简转换": "",
- "统计信息": "",
+ "统计": "",
"设置": "",
"接受的编码": "",
"OCR自动化方法": "",
@@ -266,7 +266,6 @@
"自动检测": "",
"繁体中文(BIG5)": "",
"翻译等待时间(s)": "",
- "在线OCR": "",
"词性": "",
"收到翻译结果时才刷新": "",
"禁用DirectFlip": "",
@@ -820,5 +819,12 @@
"权限不足,请以管理员权限运行!": "",
"标点": "",
"添加到列表": "",
- "目标": ""
+ "目标": "",
+ "元数据": "",
+ "来源": "",
+ "首选的": "",
+ "设为封面": "",
+ "复制": "",
+ "画廊": "",
+ "删除图片": ""
}
\ No newline at end of file
diff --git a/LunaTranslator/trans_lang.py b/LunaTranslator/trans_lang.py
index 272e3560..fa62330c 100644
--- a/LunaTranslator/trans_lang.py
+++ b/LunaTranslator/trans_lang.py
@@ -39,12 +39,13 @@ if __name__=='__main__':
js.pop(k)
with open(f'./files/lang/'+f,'w',encoding='utf8') as ff:
ff.write( json.dumps(js,ensure_ascii=False,sort_keys=False, indent=4))
+ a=TS1('baiduapi')
for kk in xxx:
with open(f'./files/lang/{kk}.json','r',encoding='utf8') as ff:
jsen=json.loads(ff.read())
- a=TS1('baiduapi')
+
a.tgtlang=xxx[kk]
needpop=[]
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index 5a0e29f1..06a73d59 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -28,8 +28,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/version)
include(generate_product_version)
set(VERSION_MAJOR 3)
-set(VERSION_MINOR 2)
-set(VERSION_PATCH 3)
+set(VERSION_MINOR 5)
+set(VERSION_PATCH 0)
add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)