mirror of
https://gitea.pjck.top/Cookies/CookiesChartConverter.git
synced 2025-12-14 12:56:54 +08:00
28 lines
751 B
Python
28 lines
751 B
Python
import subprocess
|
|
|
|
class MaichartConverterFailed(BaseException):
|
|
def __str__(self):
|
|
return "Maichart conversion failed."
|
|
|
|
def ma2tosimai(ma2path):
|
|
cmd = [
|
|
"/Users/bennett/Cookies_ToolsKit/mcc/MaichartConverter","CompileMa2","-p",
|
|
ma2path,
|
|
"-f","SimaiFes"
|
|
]
|
|
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
text = result.stdout
|
|
|
|
start_index = text.find("TargetFormat : SimaiFes")
|
|
|
|
# 如果找到了该字符串,提取后面的内容
|
|
if start_index != -1:
|
|
extracted_content = text[start_index + len("TargetFormat : SimaiFes"):].strip()
|
|
else:
|
|
raise MaichartConverterFailed(result.stderr)
|
|
|
|
return extracted_content
|
|
|
|
|
|
|