From fb4aa816045abaee0149d53be9f222829f698368 Mon Sep 17 00:00:00 2001 From: EillesWan Date: Sun, 10 Sep 2023 19:26:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=BA=A2=E7=9F=B3=E5=BB=B6?= =?UTF-8?q?=E8=BF=9F=E6=A0=BC=E5=BC=8F=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/lang.py | 2 +- llc_cli.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/languages/lang.py b/languages/lang.py index c527d28..460835d 100644 --- a/languages/lang.py +++ b/languages/lang.py @@ -56,7 +56,7 @@ languages = { "ChooseFileFormat": "请输入输出格式[BDX(1) 或 MCPACK(0)]", "EnterMethod": "请输入转换算法[{}~{}]", "MethodRangeErr": "输入的转换算法应为 [{},{}](首尾皆含)之间的一个整数。", - "ChoosePlayer": "请选择播放方式[计分板(1) 或 延迟(0)]", + "ChoosePlayer": "请选择播放方式[红石(2) 或 计分板(1) 或 延迟(0)]", "WhetherArgEntering": "是否为文件夹内文件的转换统一参数[是(1) 或 否(0)]", "EnterArgs": "请输入转换参数", "noteofArgs": "注:文件夹内的全部midi将统一以此参数转换", diff --git a/llc_cli.py b/llc_cli.py index eb7d403..0e03347 100644 --- a/llc_cli.py +++ b/llc_cli.py @@ -25,7 +25,7 @@ import Musicreater from Musicreater.plugin import ConvertConfig 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.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 utils.io import * @@ -180,6 +180,8 @@ def is_in_player(sth: str): return 0 elif sth.lower() in ("1", "计分板", "scoreboard"): return 1 + elif sth.lower() in ('2', "红石", 'redstone'): + return 2 else: raise ValueError("播放器字符串啊?") @@ -258,15 +260,21 @@ else: 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: prt("\n" f"{_('Dealing')} {singleMidi} {_(':')}") cvt_mid = Musicreater.MidiConvert.from_midi_file(singleMidi, old_exe_format=False) cvt_cfg = ConvertConfig(out_path, *prompts[:3]) conversion_result = (( - to_function_addon_in_score(cvt_mid, cvt_cfg, *prompts[3:]) - if playerFormat == 1 - else to_mcstructure_addon_in_delay(cvt_mid, cvt_cfg, *prompts[3:]) + cvt_method(cvt_mid, cvt_cfg, *prompts[3:]) )if fileFormat == 0 else ( to_BDX_file_in_score(cvt_mid, cvt_cfg, *prompts[3:])