From 7fc3578ec39b75d0ea0d5a0e781f8914393b19cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Mon, 23 Dec 2024 01:46:54 +0800 Subject: [PATCH] . --- .github/scripts/build_lunatranslator.py | 21 +++++++++------------ py/LunaTranslator/cishu/mdict.py | 8 +++++++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/scripts/build_lunatranslator.py b/.github/scripts/build_lunatranslator.py index 453eacc2..a8d1e708 100644 --- a/.github/scripts/build_lunatranslator.py +++ b/.github/scripts/build_lunatranslator.py @@ -264,36 +264,33 @@ def downloadbass(): os.chdir(rootDir + "\\temp") subprocess.run(f"curl -LO https://www.un4seen.com/files/bass24.zip") - subprocess.run(f"7z x bass24.zip -oALL") + subprocess.run(f"7z x bass24.zip -obass24") shutil.move( - "ALL/bass.dll", + "bass24/bass.dll", f"{rootDir}/files/plugins/DLL32", ) shutil.move( - "ALL/x64/bass.dll", + "bass24/x64/bass.dll", f"{rootDir}/files/plugins/DLL64", ) subprocess.run(f"curl -LO https://www.un4seen.com/files/z/2/bass_spx24.zip") - subprocess.run(f"7z x bass_spx24.zip -oALL") + subprocess.run(f"7z x bass_spx24.zip -obass_spx24") shutil.move( - "ALL/bass_spx.dll", + "bass_spx24/bass_spx.dll", f"{rootDir}/files/plugins/DLL32", ) shutil.move( - "ALL/x64/bass_spx.dll", + "bass_spx24/x64/bass_spx.dll", f"{rootDir}/files/plugins/DLL64", ) subprocess.run(f"curl -LO https://www.un4seen.com/files/z/2/bass_aac24.zip") - subprocess.run(f"7z x bass_aac24.zip -oALL") - for _dir, _, _fs in os.walk('ALL'): - for _f in _fs: - print(os.path.normpath(os.path.abspath(os.path.join(_dir, _f)))) + subprocess.run(f"7z x bass_aac24.zip -obass_aac24") shutil.move( - "ALL/bass_aac.dll", + "bass_aac24/bass_aac.dll", f"{rootDir}/files/plugins/DLL32", ) shutil.move( - "ALL/x64/bass_aac.dll", + "bass_aac24/x64/bass_aac.dll", f"{rootDir}/files/plugins/DLL64", ) diff --git a/py/LunaTranslator/cishu/mdict.py b/py/LunaTranslator/cishu/mdict.py index 053c3cda..eab84439 100644 --- a/py/LunaTranslator/cishu/mdict.py +++ b/py/LunaTranslator/cishu/mdict.py @@ -1765,12 +1765,18 @@ class IndexBuilder(object): self.makemdds(_filename, _targetfilenamebase) def makemdds(self, _filename, _targetfilenamebase): - for end in (".mdd", ".1.mdd"): + i = 0 + while True: + extra = "" if i == 0 else ".%d" % i + i += 1 + end = extra + ".mdd" if os.path.isfile(_filename + end): self._mdd_files.append(_filename + end) self._mdd_dbs.append(_targetfilenamebase + end + ".db") if not os.path.isfile(self._mdd_dbs[-1]): self._make_mdd_index(self._mdd_files[-1], self._mdd_dbs[-1]) + else: + break def _replace_stylesheet(self, txt): # substitute stylesheet definition