diff --git a/.github/scripts/build_lunatranslator.py b/.github/scripts/build_lunatranslator.py index d4795a39..7abccd68 100644 --- a/.github/scripts/build_lunatranslator.py +++ b/.github/scripts/build_lunatranslator.py @@ -283,6 +283,16 @@ def downloadbass(): "ALL/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") + shutil.move( + "ALL/bass_aac.dll", + f"{rootDir}/files/plugins/DLL32", + ) + shutil.move( + "ALL/x64/bass_aac.dll", + f"{rootDir}/files/plugins/DLL64", + ) if __name__ == "__main__": diff --git a/cpp/version.cmake b/cpp/version.cmake index aace0731..2397a57e 100644 --- a/cpp/version.cmake +++ b/cpp/version.cmake @@ -1,7 +1,7 @@ set(VERSION_MAJOR 6) set(VERSION_MINOR 14) -set(VERSION_PATCH 11) +set(VERSION_PATCH 12) set(VERSION_REVISION 0) set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}") add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp) diff --git a/py/LunaTranslator/cishu/mdict.py b/py/LunaTranslator/cishu/mdict.py index 12365289..0820eec2 100644 --- a/py/LunaTranslator/cishu/mdict.py +++ b/py/LunaTranslator/cishu/mdict.py @@ -2125,7 +2125,7 @@ class mdict(cishubase): if dis <= distance: results.append(k) diss[k] = dis - return sorted(results, key=lambda x: (diss[x], x))[: self.config["max_num"]] + return sorted(results, key=lambda x: diss[x])[: self.config["max_num"]] def parse_strings(self, input_string): parsed_strings = [] @@ -2291,26 +2291,13 @@ class mdict(cishubase): try: from tinycss2 import parse_stylesheet, serialize from tinycss2.ast import ( - HashToken, WhitespaceToken, AtRule, QualifiedRule, - IdentToken, ParseError, - Node, + LiteralToken, ) - class KlassToken(Node): - type = "ident" - - def __init__(self, line, column, value): - Node.__init__(self, line, column) - self.value = value - - def _serialize_to(self, write): - write(".") - write(self.value) - rules = parse_stylesheet(file_content, True, True) def parseaqr(rule: QualifiedRule): @@ -2325,7 +2312,9 @@ class mdict(cishubase): if start: if token.type == "ident" and token.value == "body": # body - rule.prelude.insert(idx + 1, KlassToken(0, 0, divid)) + rule.prelude.insert( + idx + 1, LiteralToken(0, 0, "." + divid) + ) rule.prelude.insert(idx + 1, WhitespaceToken(0, 0, " ")) idx += 2 else: @@ -2333,7 +2322,9 @@ class mdict(cishubase): # tag # #class tag rule.prelude.insert(idx, WhitespaceToken(0, 0, " ")) - rule.prelude.insert(idx, KlassToken(0, 0, divid)) + rule.prelude.insert( + idx, LiteralToken(0, 0, "." + divid + " ") + ) idx += 2 start = False elif token.type == "literal" and token.value == ",": @@ -2364,14 +2355,10 @@ class mdict(cishubase): continue # @....{ .klas{} } internal = parserules(internal) - ser = "@" - ser += rule.at_keyword - ser += "{" - for _ in internal: - ser += _.serialize() - ser += "}" - # rule.serialize=functools.partial(__,ser) - rules[i] = shitrule(ser) + _ = [] + rule.content = internal + rule._serialize_to(_.append) + rules[i] = shitrule("".join(_)) elif isinstance(rule, QualifiedRule): parseaqr(rules[i]) return rules @@ -2449,7 +2436,7 @@ class mdict(cishubase): # print(keys) for k in keys: __safe = [] - for content in set(self.searchthread_internal(index, k, __safe)): + for content in sorted(set(self.searchthread_internal(index, k, __safe))): results.append(self.parseashtml(content)) except: diff --git a/py/LunaTranslator/myutils/audioplayer.py b/py/LunaTranslator/myutils/audioplayer.py index d0936033..d0d4f9aa 100644 --- a/py/LunaTranslator/myutils/audioplayer.py +++ b/py/LunaTranslator/myutils/audioplayer.py @@ -141,7 +141,7 @@ class playonce: BASS_Init(-1, 44100, 0, 0, 0) # https://www.un4seen.com/ -plugins = {".spx": "bass_spx.dll"} +plugins = {".spx": "bass_spx.dll", ".aac": "bass_aac.dll"} pluginshandle = {}