diff --git a/.github/scripts/build_lunatranslator.py b/.github/scripts/build_lunatranslator.py index a8d1e7082bf..c04d1bbf03c 100644 --- a/.github/scripts/build_lunatranslator.py +++ b/.github/scripts/build_lunatranslator.py @@ -263,36 +263,24 @@ def buildPlugins(arch): 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 -obass24") - shutil.move( - "bass24/bass.dll", - f"{rootDir}/files/plugins/DLL32", - ) - shutil.move( - "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 -obass_spx24") - shutil.move( - "bass_spx24/bass_spx.dll", - f"{rootDir}/files/plugins/DLL32", - ) - shutil.move( - "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 -obass_aac24") - shutil.move( - "bass_aac24/bass_aac.dll", - f"{rootDir}/files/plugins/DLL32", - ) - shutil.move( - "bass_aac24/x64/bass_aac.dll", - f"{rootDir}/files/plugins/DLL64", - ) + for link in ( + "https://www.un4seen.com/files/bass24.zip", + "https://www.un4seen.com/files/z/2/bass_spx24.zip", + "https://www.un4seen.com/files/z/2/bass_aac24.zip", + "https://www.un4seen.com/files/bassopus24.zip", + ): + name = link.split("/")[-1] + d = name.split(".")[0] + subprocess.run("curl -LO " + link) + subprocess.run(f"7z x {name} -o{d}") + shutil.move( + f"{d}/{d[:-2]}.dll", + f"{rootDir}/files/plugins/DLL32", + ) + shutil.move( + f"{d}/x64/{d[:-2]}.dll", + f"{rootDir}/files/plugins/DLL64", + ) if __name__ == "__main__": diff --git a/py/LunaTranslator/cishu/mdict.py b/py/LunaTranslator/cishu/mdict.py index ffe9c353dc5..5326da4dc14 100644 --- a/py/LunaTranslator/cishu/mdict.py +++ b/py/LunaTranslator/cishu/mdict.py @@ -2276,7 +2276,7 @@ def tryloadurl(self, index: IndexBuilder, base, url: str, audiob64vals: dict): if not file_content: return ext = os.path.splitext(url)[1].lower() - if ext in (".aac", ".spx"): + if ext in (".aac", ".spx", ".opus"): mp3 = bass_decode(file_content, ext) if not mp3: print(ext, "decode error") diff --git a/py/LunaTranslator/myutils/audioplayer.py b/py/LunaTranslator/myutils/audioplayer.py index d0d4f9aa6f4..3c6463b44ae 100644 --- a/py/LunaTranslator/myutils/audioplayer.py +++ b/py/LunaTranslator/myutils/audioplayer.py @@ -141,7 +141,7 @@ def __stop(self): BASS_Init(-1, 44100, 0, 0, 0) # https://www.un4seen.com/ -plugins = {".spx": "bass_spx.dll", ".aac": "bass_aac.dll"} +plugins = {".spx": "bass_spx.dll", ".aac": "bass_aac.dll", ".opus": "bassopus.dll"} pluginshandle = {}