支持红石延迟格式输出

This commit is contained in:
EillesWan 2023-09-10 19:26:19 +08:00
parent 8970d86226
commit fb4aa81604
2 changed files with 13 additions and 5 deletions

View File

@ -56,7 +56,7 @@ languages = {
"ChooseFileFormat": "请输入输出格式[BDX(1) 或 MCPACK(0)]", "ChooseFileFormat": "请输入输出格式[BDX(1) 或 MCPACK(0)]",
"EnterMethod": "请输入转换算法[{}~{}]", "EnterMethod": "请输入转换算法[{}~{}]",
"MethodRangeErr": "输入的转换算法应为 [{},{}](首尾皆含)之间的一个整数。", "MethodRangeErr": "输入的转换算法应为 [{},{}](首尾皆含)之间的一个整数。",
"ChoosePlayer": "请选择播放方式[计分板(1) 或 延迟(0)]", "ChoosePlayer": "请选择播放方式[红石(2) 或 计分板(1) 或 延迟(0)]",
"WhetherArgEntering": "是否为文件夹内文件的转换统一参数[是(1) 或 否(0)]", "WhetherArgEntering": "是否为文件夹内文件的转换统一参数[是(1) 或 否(0)]",
"EnterArgs": "请输入转换参数", "EnterArgs": "请输入转换参数",
"noteofArgs": "文件夹内的全部midi将统一以此参数转换", "noteofArgs": "文件夹内的全部midi将统一以此参数转换",

View File

@ -25,7 +25,7 @@ import Musicreater
from Musicreater.plugin import ConvertConfig from Musicreater.plugin import ConvertConfig
from Musicreater.plugin.bdxfile import to_BDX_file_in_delay, to_BDX_file_in_score from Musicreater.plugin.bdxfile import to_BDX_file_in_delay, to_BDX_file_in_score
from Musicreater.plugin.funcpack import to_function_addon_in_score from Musicreater.plugin.funcpack import to_function_addon_in_score
from Musicreater.plugin.mcstructpack import to_mcstructure_addon_in_delay from Musicreater.plugin.mcstructpack import to_mcstructure_addon_in_delay, to_mcstructure_addon_in_redstone_cd
# from Musicreater.plugin.mcstructure import commands_to_structure, commands_to_redstone_delay_structure # from Musicreater.plugin.mcstructure import commands_to_structure, commands_to_redstone_delay_structure
from utils.io import * from utils.io import *
@ -180,6 +180,8 @@ def is_in_player(sth: str):
return 0 return 0
elif sth.lower() in ("1", "计分板", "scoreboard"): elif sth.lower() in ("1", "计分板", "scoreboard"):
return 1 return 1
elif sth.lower() in ('2', "红石", 'redstone'):
return 2
else: else:
raise ValueError("播放器字符串啊?") raise ValueError("播放器字符串啊?")
@ -258,15 +260,21 @@ else:
prompts.append(format_ipt(*args)[1]) prompts.append(format_ipt(*args)[1])
if playerFormat == 1:
cvt_method = to_function_addon_in_score
elif playerFormat == 0:
cvt_method = to_mcstructure_addon_in_delay
elif playerFormat == 2:
cvt_method = to_mcstructure_addon_in_redstone_cd
for singleMidi in midis: for singleMidi in midis:
prt("\n" f"{_('Dealing')} {singleMidi} {_(':')}") prt("\n" f"{_('Dealing')} {singleMidi} {_(':')}")
cvt_mid = Musicreater.MidiConvert.from_midi_file(singleMidi, old_exe_format=False) cvt_mid = Musicreater.MidiConvert.from_midi_file(singleMidi, old_exe_format=False)
cvt_cfg = ConvertConfig(out_path, *prompts[:3]) cvt_cfg = ConvertConfig(out_path, *prompts[:3])
conversion_result = (( conversion_result = ((
to_function_addon_in_score(cvt_mid, cvt_cfg, *prompts[3:]) cvt_method(cvt_mid, cvt_cfg, *prompts[3:])
if playerFormat == 1
else to_mcstructure_addon_in_delay(cvt_mid, cvt_cfg, *prompts[3:])
)if fileFormat == 0 )if fileFormat == 0
else ( else (
to_BDX_file_in_score(cvt_mid, cvt_cfg, *prompts[3:]) to_BDX_file_in_score(cvt_mid, cvt_cfg, *prompts[3:])