mirror of
https://gitea.pjck.top/Cookies/CookiesChartConverter.git
synced 2025-12-14 07:26:53 +08:00
qwq
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
class MaichartConverterFailed(BaseException):
|
||||
def __str__(self):
|
||||
return "Maichart conversion failed."
|
||||
|
||||
def ma2tosimai(ma2path):
|
||||
|
||||
cmd = [
|
||||
"/Users/bennett/Cookies_ToolsKit/mcc/MaichartConverter","CompileMa2","-p",
|
||||
"mcc/MaichartConverter","CompileMa2","-p",
|
||||
ma2path,
|
||||
"-f","SimaiFes"
|
||||
]
|
||||
@@ -19,9 +22,13 @@ def ma2tosimai(ma2path):
|
||||
if start_index != -1:
|
||||
extracted_content = text[start_index + len("TargetFormat : SimaiFes"):].strip()
|
||||
else:
|
||||
extracted_content = ""
|
||||
raise MaichartConverterFailed(result.stderr)
|
||||
|
||||
return extracted_content
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(ma2tosimai(""))
|
||||
|
||||
|
||||
|
||||
10
ReadOpt.py
10
ReadOpt.py
@@ -8,6 +8,10 @@ def parse_music_xml(file_path):
|
||||
tree = ET.parse(file_path)
|
||||
root = tree.getroot()
|
||||
|
||||
# 获取音乐ID
|
||||
name_elem = root.find("name/id")
|
||||
id = name_elem.text if name_elem is not None else "?"
|
||||
|
||||
# 获取音乐名称
|
||||
name_elem = root.find("name/str")
|
||||
music_name = name_elem.text if name_elem is not None else "?"
|
||||
@@ -41,13 +45,13 @@ def parse_music_xml(file_path):
|
||||
"levelshow": f"{level}{PLUS if int(level_decimal) > 6 else EMPTY}",
|
||||
})
|
||||
|
||||
return music_name, artist_name, note_infos
|
||||
return id,music_name, artist_name, note_infos
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
file_path = "/Users/bennett/Downloads/SDEZ/Package/Sinmai_Data/StreamingAssets/A000/music/music011663/Music.xml"
|
||||
music_name, artist_name, note_infos = parse_music_xml(file_path)
|
||||
|
||||
id,music_name, artist_name, note_infos = parse_music_xml(file_path)
|
||||
print("ID:",id)
|
||||
print("音乐名称:", music_name)
|
||||
print("艺术家名称:", artist_name)
|
||||
print("启用谱面列表:")
|
||||
|
||||
11
pv_decode.py
11
pv_decode.py
@@ -20,13 +20,13 @@ def convert_ivf_to_mp4(ivf_path: Path, output_mp4_path: Path):
|
||||
str(output_mp4_path)
|
||||
], check=True)
|
||||
|
||||
def dat_to_mp4(dat_file: str):
|
||||
def dat_to_mp4(dat_file: str,id:str):
|
||||
""" 将 .dat 文件当作 .usm 文件处理,提取并转换为 .mp4 """
|
||||
dat_path = Path(dat_file).resolve()
|
||||
base_name = dat_path.stem
|
||||
work_dir = dat_path.parent / "work" / "pv"
|
||||
work_dir = Path("/Users/bennett/PJCK/CookiesChartConverter") / "work" / id
|
||||
|
||||
usm_path = work_dir / f"{base_name}.dat" # 直接将 .dat 文件当作 .usm
|
||||
usm_path = Path(dat_file)
|
||||
ivf_path = work_dir / "output" / f"{base_name}.dat" / "videos" / f"{base_name}.ivf"
|
||||
mp4_path = work_dir / f"{base_name}.mp4"
|
||||
|
||||
@@ -42,6 +42,7 @@ def dat_to_mp4(dat_file: str):
|
||||
convert_ivf_to_mp4(ivf_path, mp4_path)
|
||||
|
||||
print(f"[3/3] 成功生成:{mp4_path}")
|
||||
process_video(mp4_path, work_dir/"pv.mp4")
|
||||
return mp4_path
|
||||
|
||||
# === 示例用法 ===
|
||||
@@ -55,7 +56,7 @@ if __name__ == "__main__":
|
||||
mp4_output = dat_to_mp4(dat_file)
|
||||
|
||||
if mp4_output:
|
||||
converted_mp4_path = f"{mp4_output.stem}(converted).mp4"
|
||||
converted_mp4_path = f"pv.mp4"
|
||||
print(f"[4/4] 开始转换为新的 MP4 文件:{converted_mp4_path}")
|
||||
process_video(mp4_output, converted_mp4_path)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user