mirror of
https://github.com/TriM-Organization/Linglun-Converter.git
synced 2024-11-14 11:27:33 +08:00
支持新版音·创库
This commit is contained in:
parent
63d6a749d8
commit
b925884b74
63
llc_cli.py
63
llc_cli.py
@ -14,7 +14,7 @@ Copyright © 2023 EillesWan & TriM Org.
|
|||||||
Terms & Conditions: ./Lisense.md
|
Terms & Conditions: ./Lisense.md
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "0.0.1"
|
__version__ = "0.0.2"
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
@ -164,29 +164,40 @@ convert_method = format_ipt(
|
|||||||
)[1]
|
)[1]
|
||||||
|
|
||||||
# 选择输出格式
|
# 选择输出格式
|
||||||
while True:
|
|
||||||
fileFormat = ipt(f"{_('ChooseFileFormat')}{_(':')}").lower()
|
|
||||||
if fileFormat in ("0", "mcpack"):
|
|
||||||
fileFormat = 0
|
|
||||||
playerFormat = 1
|
|
||||||
break
|
|
||||||
|
|
||||||
elif fileFormat in ("1", "bdx"):
|
|
||||||
fileFormat = 1
|
def is_in_bdx_mcpack(sth: str):
|
||||||
while True:
|
if sth.lower() in ("0", "mcpack"):
|
||||||
playerFormat = ipt(f"{_('ChoosePlayer')}{_(':')}").lower()
|
return 0
|
||||||
if playerFormat in ("0", "延迟", "delay"):
|
|
||||||
playerFormat = 0
|
elif sth.lower() in ("1", "bdx"):
|
||||||
elif playerFormat in ("1", "计分板", "scoreboard"):
|
return 1
|
||||||
playerFormat = 1
|
|
||||||
else:
|
else:
|
||||||
prt(f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}")
|
raise ValueError("文件格式字符串啊?")
|
||||||
continue
|
|
||||||
break
|
|
||||||
|
fileFormat = format_ipt(
|
||||||
|
f"{_('ChooseFileFormat')}{_(':')}",
|
||||||
|
is_in_bdx_mcpack,
|
||||||
|
f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}",
|
||||||
|
)[1]
|
||||||
|
|
||||||
|
|
||||||
|
def is_in_player(sth: str):
|
||||||
|
if sth.lower() in ("0", "延迟", "delay"):
|
||||||
|
return 0
|
||||||
|
elif sth.lower() in ("1", "计分板", "scoreboard"):
|
||||||
|
return 1
|
||||||
else:
|
else:
|
||||||
prt(f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}")
|
raise ValueError("播放器字符串啊?")
|
||||||
continue
|
|
||||||
break
|
|
||||||
|
playerFormat = format_ipt(
|
||||||
|
f"{_('ChoosePlayer')}{_(':')}",
|
||||||
|
is_in_player,
|
||||||
|
f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}",
|
||||||
|
)[1]
|
||||||
|
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
@ -196,9 +207,9 @@ def bool_str(sth: str) -> bool:
|
|||||||
try:
|
try:
|
||||||
return bool(int(sth))
|
return bool(int(sth))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if str(sth).lower() == "true":
|
if str(sth).lower() in ("true", "真", "是"):
|
||||||
return True
|
return True
|
||||||
elif str(sth).lower() == "false":
|
elif str(sth).lower() == ("false", "假", "否", "非"):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
raise ValueError("布尔字符串啊?")
|
raise ValueError("布尔字符串啊?")
|
||||||
@ -252,7 +263,7 @@ else:
|
|||||||
f'{_("EnterMaxHeight")}{_(":")}',
|
f'{_("EnterMaxHeight")}{_(":")}',
|
||||||
int,
|
int,
|
||||||
)
|
)
|
||||||
if fileFormat == 1
|
if playerFormat == 0
|
||||||
else (),
|
else (),
|
||||||
]:
|
]:
|
||||||
if args:
|
if args:
|
||||||
@ -268,7 +279,11 @@ for singleMidi in midis:
|
|||||||
json.dump(conversion.toDICT(), f)
|
json.dump(conversion.toDICT(), f)
|
||||||
f.write(5 * "\n")
|
f.write(5 * "\n")
|
||||||
conversion_result = (
|
conversion_result = (
|
||||||
|
(
|
||||||
conversion.to_mcpack(convert_method, *prompts)
|
conversion.to_mcpack(convert_method, *prompts)
|
||||||
|
if playerFormat == 1
|
||||||
|
else conversion.to_mcpack_with_delay(convert_method, *prompts)
|
||||||
|
)
|
||||||
if fileFormat == 0
|
if fileFormat == 0
|
||||||
else (
|
else (
|
||||||
conversion.to_BDX_file(convert_method, *prompts)
|
conversion.to_BDX_file(convert_method, *prompts)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Brotli>=1.0.9
|
Brotli>=1.0.9
|
||||||
mido>=1.2.10
|
mido>=1.2.10
|
||||||
rich>=10.9.0
|
rich>=10.9.0
|
||||||
Musicreater>=0.1.0
|
Musicreater>=0.5.0
|
||||||
TrimLog>=0.1.0
|
TrimLog>=0.1.0
|
||||||
|
Loading…
Reference in New Issue
Block a user