2022-10-30 01:39:20 +08:00
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 音·创 开发交流群 861684859
|
|
|
|
|
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
|
|
|
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
2023-01-28 11:56:09 +08:00
|
|
|
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
2022-10-30 01:39:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
音·创 库版 MIDI转换示例程序
|
|
|
|
|
Musicreater Package Version : Demo for Midi Conversion
|
|
|
|
|
|
2023-01-02 14:28:25 +08:00
|
|
|
|
Copyright 2023 all the developers of Musicreater
|
2022-12-31 13:21:30 +08:00
|
|
|
|
|
2023-01-28 11:56:09 +08:00
|
|
|
|
开源相关声明请见 ./License.md
|
|
|
|
|
Terms & Conditions: ./Lisense.md
|
2022-10-30 01:39:20 +08:00
|
|
|
|
"""
|
|
|
|
|
|
2023-01-27 23:25:28 +08:00
|
|
|
|
import datetime
|
|
|
|
|
import random
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
2023-01-28 11:56:09 +08:00
|
|
|
|
|
2022-10-30 01:39:20 +08:00
|
|
|
|
languages = {
|
|
|
|
|
"ZH_CN": {
|
|
|
|
|
"MSCT": "音·创",
|
|
|
|
|
"ChooseLang": "选择语言",
|
|
|
|
|
"LangChd": "当前语言已经切换为",
|
|
|
|
|
"ZH_CN": "简体中文",
|
|
|
|
|
"ZH_TW": "繁体中文(台湾)",
|
|
|
|
|
"EN_GB": "英语(英国)",
|
|
|
|
|
"EN_US": "英语(美国)",
|
|
|
|
|
":": ":",
|
|
|
|
|
",": ",",
|
|
|
|
|
".": "。",
|
2023-01-31 20:39:50 +08:00
|
|
|
|
"ChoosePath": "请输入MIDI路径或所在文件夹",
|
2022-10-30 01:39:20 +08:00
|
|
|
|
"ChooseFileFormat": "请输入输出格式[BDX(1)或MCPACK(0)]",
|
2023-01-31 20:39:50 +08:00
|
|
|
|
"EnterMethod": "请输入转换算法",
|
|
|
|
|
"MethodRangeErr": "输入的转换算法应为 [{},{}](首位皆含)之间的一个整数。",
|
2022-10-30 01:39:20 +08:00
|
|
|
|
"ChoosePlayer": "请选择播放方式[计分板(1) 或 延迟(0)]",
|
|
|
|
|
"WhetherArgEntering": "是否为文件夹内文件的转换统一参数[是(1) 或 否(0)]",
|
2022-12-31 13:20:30 +08:00
|
|
|
|
"EnterArgs": "请输入转换参数",
|
|
|
|
|
"noteofArgs": "注:文件夹内的全部midi将统一以此参数转换",
|
2023-01-20 00:31:45 +08:00
|
|
|
|
"EnterVolume": "请输入音量大小(0~1)",
|
|
|
|
|
"EnterSpeed": "请输入速度倍率",
|
|
|
|
|
"WhetherPgb": "是否自动生成进度条[是(1) 或 否(0)]",
|
2022-10-30 01:39:20 +08:00
|
|
|
|
"WhetherCstmProgressBar": "是否自定义进度条[是(1) 或 否(0)]",
|
|
|
|
|
"EnterProgressBarStyle": "请输入进度条样式",
|
|
|
|
|
"EnterSbName": "请输入计分板名称",
|
2023-01-20 00:31:45 +08:00
|
|
|
|
"EnterSelecter": "请输入播放者选择器",
|
|
|
|
|
"WhetherSbReset": "是否自动重置计分板[是(1) 或 否(0)]",
|
2022-10-30 01:39:20 +08:00
|
|
|
|
"EnterAuthor": "请输入作者",
|
|
|
|
|
"EnterMaxHeight": "请输入指令结构最大生成高度",
|
|
|
|
|
"ErrEnter": "输入错误",
|
|
|
|
|
"Re-Enter": "请重新输入",
|
|
|
|
|
"Dealing": "正在处理",
|
|
|
|
|
"FileNotFound": "文件(夹)不存在",
|
2023-01-02 14:28:25 +08:00
|
|
|
|
"ChooseOutPath": "请输入结果输出路径",
|
2022-10-30 01:39:20 +08:00
|
|
|
|
"Saying": "言·论",
|
2023-01-20 00:31:45 +08:00
|
|
|
|
"Failed": "失败",
|
|
|
|
|
"CmdLength": "指令数量",
|
|
|
|
|
"MaxDelay": "曲目时间(游戏刻)",
|
|
|
|
|
"PlaceSize": "结构占用大小",
|
|
|
|
|
"LastPos": "最末方块坐标",
|
|
|
|
|
"PressEnterExit": "请按下回车键退出。",
|
2022-10-30 01:39:20 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if sys.argv.__len__() > 0:
|
|
|
|
|
currentLang = sys.argv[0]
|
2023-01-27 23:25:28 +08:00
|
|
|
|
if currentLang not in languages.keys():
|
2022-10-30 01:39:20 +08:00
|
|
|
|
currentLang = "ZH_CN"
|
|
|
|
|
else:
|
|
|
|
|
currentLang = "ZH_CN"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _(__):
|
2023-01-28 11:56:09 +08:00
|
|
|
|
"""
|
2022-12-31 13:20:30 +08:00
|
|
|
|
`languages`
|
2023-01-28 11:56:09 +08:00
|
|
|
|
"""
|
2022-10-30 01:39:20 +08:00
|
|
|
|
return languages[currentLang][__]
|
|
|
|
|
|
|
|
|
|
|
2022-10-30 01:58:29 +08:00
|
|
|
|
try:
|
2023-01-20 21:34:15 +08:00
|
|
|
|
import msctPkgver
|
2022-10-30 01:58:29 +08:00
|
|
|
|
except ModuleNotFoundError as E:
|
2023-01-28 11:56:09 +08:00
|
|
|
|
if input("您需要安装 mido、Brotli 模块才能使用这个样例\n请问是否安装?(y/n):").lower() in ("y", "1"):
|
2023-01-20 21:34:15 +08:00
|
|
|
|
os.system("pip install -r requirements.txt")
|
|
|
|
|
import msctPkgver
|
2022-10-30 01:58:29 +08:00
|
|
|
|
else:
|
|
|
|
|
raise E
|
2022-10-30 01:39:20 +08:00
|
|
|
|
|
2022-12-31 13:20:30 +08:00
|
|
|
|
try:
|
2023-01-20 21:34:15 +08:00
|
|
|
|
from msctPkgver.magicBeing import *
|
2022-10-30 01:58:29 +08:00
|
|
|
|
import requests
|
|
|
|
|
except ModuleNotFoundError as E:
|
2023-01-20 21:34:15 +08:00
|
|
|
|
if input(
|
2023-01-28 11:56:09 +08:00
|
|
|
|
"您需要安装以下模块才能使用这个样例\nrequests==2.28.1\nrich==12.6.0\nzhdate==0.1\n请问是否安装?(y/n):"
|
|
|
|
|
).lower() in ("y", "1"):
|
|
|
|
|
open("Demo_Requirements.txt", "w").write(
|
2023-01-29 13:02:43 +08:00
|
|
|
|
"requests==2.28.1\nrich==12.6.0"
|
2023-01-20 21:34:15 +08:00
|
|
|
|
)
|
|
|
|
|
os.system("pip install -r Demo_Requirements.txt")
|
|
|
|
|
os.remove("./Demo_Requirements.txt")
|
2023-01-29 13:02:43 +08:00
|
|
|
|
from msctPkgver.magicBeing import *
|
2022-10-30 01:58:29 +08:00
|
|
|
|
import requests
|
|
|
|
|
else:
|
|
|
|
|
raise E
|
|
|
|
|
|
|
|
|
|
MainConsole.print(
|
|
|
|
|
"[#121110 on #F0F2F4] ",
|
|
|
|
|
style="#121110 on #F0F2F4",
|
|
|
|
|
justify="center",
|
|
|
|
|
)
|
2022-10-30 01:39:20 +08:00
|
|
|
|
|
2022-12-31 13:20:30 +08:00
|
|
|
|
# 显示大标题
|
2023-01-28 11:56:09 +08:00
|
|
|
|
MainConsole.rule(title="[bold #AB70FF]欢迎使用音·创独立转换器", characters="=", style="#26E2FF")
|
2022-10-30 01:39:20 +08:00
|
|
|
|
MainConsole.rule(
|
2023-01-28 11:56:09 +08:00
|
|
|
|
title="[bold #AB70FF]Welcome to Independent Musicreater Converter", characters="-"
|
|
|
|
|
)
|
2022-10-30 01:39:20 +08:00
|
|
|
|
|
2023-01-20 00:31:45 +08:00
|
|
|
|
nowYang = datetime.datetime.now()
|
2022-10-30 01:58:29 +08:00
|
|
|
|
|
2023-01-20 00:31:45 +08:00
|
|
|
|
if nowYang.month == 8 and nowYang.day == 6:
|
|
|
|
|
# 诸葛八卦生日
|
2023-01-28 11:56:09 +08:00
|
|
|
|
MainConsole.print(
|
|
|
|
|
"[#7DB5F0 on #121110]今天可不是催更的日子!\n诸葛亮与八卦阵{}岁生日快乐!".format(nowYang.year - 2009),
|
|
|
|
|
style="#7DB5F0 on #121110",
|
|
|
|
|
justify="center",
|
|
|
|
|
)
|
2023-01-20 00:31:45 +08:00
|
|
|
|
elif nowYang.month == 4 and nowYang.day == 3:
|
|
|
|
|
# 金羿生日快乐
|
2023-01-28 11:56:09 +08:00
|
|
|
|
MainConsole.print(
|
|
|
|
|
"[#0089F2 on #F0F2F4]今天就不要催更啦!\n金羿{}岁生日快乐!".format(nowYang.year - 2006),
|
|
|
|
|
style="#0089F2 on #F0F2F4",
|
|
|
|
|
justify="center",
|
|
|
|
|
)
|
2023-01-20 00:31:45 +08:00
|
|
|
|
else:
|
|
|
|
|
# 显示箴言部分
|
|
|
|
|
MainConsole.print(
|
|
|
|
|
"[#121110 on #F0F2F4]{}".format(
|
|
|
|
|
random.choice(
|
|
|
|
|
requests.get(
|
2023-01-28 11:56:09 +08:00
|
|
|
|
"https://gitee.com/EillesWan/Musicreater/raw/master/resources/myWords.txt"
|
2023-01-20 00:31:45 +08:00
|
|
|
|
)
|
2023-01-28 11:56:09 +08:00
|
|
|
|
.text.strip("\r\n")
|
|
|
|
|
.split("\r\n")
|
2023-01-20 00:31:45 +08:00
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
style="#121110 on #F0F2F4",
|
|
|
|
|
justify="center",
|
|
|
|
|
)
|
2022-10-30 01:39:20 +08:00
|
|
|
|
|
|
|
|
|
prt(f"{_('LangChd')}{_(':')}{_(currentLang)}")
|
|
|
|
|
|
2023-01-27 23:25:28 +08:00
|
|
|
|
|
2023-01-28 11:56:09 +08:00
|
|
|
|
def format_ipt(
|
|
|
|
|
notice: str,
|
|
|
|
|
fun,
|
|
|
|
|
err_note: str = f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}",
|
|
|
|
|
*extraArg,
|
2023-01-20 00:31:45 +08:00
|
|
|
|
):
|
2023-01-28 11:56:09 +08:00
|
|
|
|
"""循环输入,以某种格式
|
2023-01-02 14:28:25 +08:00
|
|
|
|
notice: 输入时的提示
|
|
|
|
|
fun: 格式函数
|
2023-01-28 11:56:09 +08:00
|
|
|
|
err_note: 输入不符格式时的提示
|
|
|
|
|
*extraArg: 对于函数的其他参数"""
|
2022-12-31 13:20:30 +08:00
|
|
|
|
while True:
|
|
|
|
|
result = ipt(notice)
|
|
|
|
|
try:
|
2023-01-28 11:56:09 +08:00
|
|
|
|
fun_result = fun(result, *extraArg)
|
2022-12-31 13:20:30 +08:00
|
|
|
|
break
|
2023-01-29 13:02:43 +08:00
|
|
|
|
except ValueError:
|
2023-01-28 11:56:09 +08:00
|
|
|
|
prt(err_note)
|
2022-12-31 13:20:30 +08:00
|
|
|
|
continue
|
2023-01-28 11:56:09 +08:00
|
|
|
|
return result, fun_result
|
2023-01-27 23:25:28 +08:00
|
|
|
|
|
2022-10-30 01:39:20 +08:00
|
|
|
|
|
2023-01-02 14:28:25 +08:00
|
|
|
|
# 获取midi列表
|
2022-10-30 01:39:20 +08:00
|
|
|
|
while True:
|
2023-01-28 11:56:09 +08:00
|
|
|
|
midi_path = ipt(f"{_('ChoosePath')}{_(':')}").lower()
|
|
|
|
|
if os.path.exists(midi_path):
|
|
|
|
|
if os.path.isfile(midi_path):
|
|
|
|
|
midis = (midi_path,)
|
|
|
|
|
elif os.path.isdir(midi_path):
|
2022-12-31 13:20:30 +08:00
|
|
|
|
midis = tuple(
|
|
|
|
|
(
|
2023-01-28 11:56:09 +08:00
|
|
|
|
os.path.join(midi_path, i)
|
|
|
|
|
for i in os.listdir(midi_path)
|
|
|
|
|
if i.lower().endswith(".mid") or i.lower().endswith(".midi")
|
2022-12-31 13:20:30 +08:00
|
|
|
|
)
|
|
|
|
|
)
|
2022-10-30 01:39:20 +08:00
|
|
|
|
else:
|
|
|
|
|
prt(f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}")
|
|
|
|
|
continue
|
|
|
|
|
else:
|
|
|
|
|
prt(f"{_('FileNotFound')}{_(',')}{_('Re-Enter')}{_('.')}")
|
|
|
|
|
continue
|
|
|
|
|
break
|
|
|
|
|
|
2023-01-02 14:28:25 +08:00
|
|
|
|
# 获取输出地址
|
2023-01-28 11:56:09 +08:00
|
|
|
|
out_path = format_ipt(
|
2023-01-02 14:28:25 +08:00
|
|
|
|
f"{_('ChooseOutPath')}{_(':')}",
|
|
|
|
|
os.path.exists,
|
|
|
|
|
f"{_('FileNotFound')}{_(',')}{_('Re-Enter')}{_('.')}",
|
2023-01-20 00:31:45 +08:00
|
|
|
|
)[0].lower()
|
2023-01-02 14:28:25 +08:00
|
|
|
|
|
2023-01-31 20:39:50 +08:00
|
|
|
|
def isMethodOK(sth: str):
|
|
|
|
|
if int(sth) in range(1,len(conversion.methods)+1):
|
|
|
|
|
return int(sth)
|
|
|
|
|
else:
|
|
|
|
|
raise ValueError
|
|
|
|
|
|
2023-01-31 20:47:09 +08:00
|
|
|
|
convert_method = format_ipt(f"{_('EnterMethod')}{_(':')}",isMethodOK,f"{_('MethodRangeErr').format(1,len(conversion.methods))}")[1]
|
2023-01-31 20:39:50 +08:00
|
|
|
|
|
|
|
|
|
|
2023-01-02 14:28:25 +08:00
|
|
|
|
# 选择输出格式
|
2022-10-30 01:39:20 +08:00
|
|
|
|
while True:
|
|
|
|
|
fileFormat = ipt(f"{_('ChooseFileFormat')}{_(':')}").lower()
|
2023-01-28 11:56:09 +08:00
|
|
|
|
if fileFormat in ("0", "mcpack"):
|
2022-10-30 01:39:20 +08:00
|
|
|
|
fileFormat = 0
|
2023-01-20 00:31:45 +08:00
|
|
|
|
playerFormat = 1
|
|
|
|
|
break
|
2023-01-02 14:28:25 +08:00
|
|
|
|
|
2023-01-28 11:56:09 +08:00
|
|
|
|
elif fileFormat in ("1", "bdx"):
|
2022-10-30 01:39:20 +08:00
|
|
|
|
fileFormat = 1
|
|
|
|
|
while True:
|
|
|
|
|
playerFormat = ipt(f"{_('ChoosePlayer')}{_(':')}").lower()
|
2023-01-28 11:56:09 +08:00
|
|
|
|
if playerFormat in ("0", "延迟", "delay"):
|
2022-10-30 01:39:20 +08:00
|
|
|
|
playerFormat = 0
|
2023-01-28 11:56:09 +08:00
|
|
|
|
elif playerFormat in ("1", "计分板", "scoreboard"):
|
2022-10-30 01:39:20 +08:00
|
|
|
|
playerFormat = 1
|
|
|
|
|
else:
|
|
|
|
|
prt(f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}")
|
|
|
|
|
continue
|
|
|
|
|
break
|
|
|
|
|
else:
|
|
|
|
|
prt(f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}")
|
|
|
|
|
continue
|
|
|
|
|
break
|
|
|
|
|
|
2023-01-20 22:26:04 +08:00
|
|
|
|
debug = False
|
2023-01-27 23:25:28 +08:00
|
|
|
|
|
|
|
|
|
|
2023-01-20 00:31:45 +08:00
|
|
|
|
# 真假字符串判断
|
2023-01-28 11:56:09 +08:00
|
|
|
|
def bool_str(sth: str) -> bool:
|
2023-01-20 00:31:45 +08:00
|
|
|
|
try:
|
|
|
|
|
return bool(int(sth))
|
2023-01-29 13:02:43 +08:00
|
|
|
|
except ValueError:
|
2023-01-28 11:56:09 +08:00
|
|
|
|
if str(sth).lower() == "true":
|
2023-01-20 00:31:45 +08:00
|
|
|
|
return True
|
2023-01-28 11:56:09 +08:00
|
|
|
|
elif str(sth).lower() == "false":
|
2023-01-20 00:31:45 +08:00
|
|
|
|
return False
|
|
|
|
|
else:
|
2023-01-29 13:02:43 +08:00
|
|
|
|
raise ValueError("布尔字符串啊?")
|
2023-01-20 00:31:45 +08:00
|
|
|
|
|
2023-01-27 23:25:28 +08:00
|
|
|
|
|
2023-01-20 21:34:15 +08:00
|
|
|
|
if os.path.exists("./demo_config.json"):
|
|
|
|
|
import json
|
2023-01-27 23:25:28 +08:00
|
|
|
|
|
2023-01-28 11:56:09 +08:00
|
|
|
|
prompts = json.load(open("./demo_config.json", "r", encoding="utf-8"))
|
2023-01-20 22:26:04 +08:00
|
|
|
|
if prompts[-1] == "debug":
|
|
|
|
|
debug = True
|
|
|
|
|
prompts = prompts[:-1]
|
2023-01-20 21:34:15 +08:00
|
|
|
|
else:
|
|
|
|
|
prompts = []
|
|
|
|
|
# 提示语 检测函数 错误提示语
|
|
|
|
|
for args in [
|
|
|
|
|
(
|
|
|
|
|
f'{_("EnterVolume")}{_(":")}',
|
|
|
|
|
float,
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
f'{_("EnterSpeed")}{_(":")}',
|
|
|
|
|
float,
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
f'{_("WhetherPgb")}{_(":")}',
|
2023-01-28 11:56:09 +08:00
|
|
|
|
bool_str,
|
2023-01-20 21:34:15 +08:00
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
f'{_("EnterSbName")}{_(":")}',
|
|
|
|
|
str,
|
|
|
|
|
)
|
|
|
|
|
if playerFormat == 1
|
|
|
|
|
else (
|
|
|
|
|
f'{_("EnterSelecter")}{_(":")}',
|
|
|
|
|
str,
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
f'{_("WhetherSbReset")}{_(":")}',
|
2023-01-28 11:56:09 +08:00
|
|
|
|
bool_str,
|
2023-01-20 21:34:15 +08:00
|
|
|
|
)
|
|
|
|
|
if playerFormat == 1
|
|
|
|
|
else (),
|
|
|
|
|
(
|
|
|
|
|
f'{_("EnterAuthor")}{_(":")}',
|
|
|
|
|
str,
|
|
|
|
|
)
|
|
|
|
|
if fileFormat == 1
|
|
|
|
|
else (),
|
|
|
|
|
(
|
|
|
|
|
f'{_("EnterMaxHeight")}{_(":")}',
|
|
|
|
|
int,
|
|
|
|
|
)
|
|
|
|
|
if fileFormat == 1
|
|
|
|
|
else (),
|
|
|
|
|
]:
|
|
|
|
|
if args:
|
2023-01-28 11:56:09 +08:00
|
|
|
|
prompts.append(format_ipt(*args)[1])
|
2023-01-20 21:34:15 +08:00
|
|
|
|
|
2023-01-20 22:26:04 +08:00
|
|
|
|
conversion = msctPkgver.midiConvert(debug)
|
2023-01-20 00:31:45 +08:00
|
|
|
|
for singleMidi in midis:
|
2023-01-28 11:56:09 +08:00
|
|
|
|
prt("\n" f"{_('Dealing')} {singleMidi} {_(':')}")
|
|
|
|
|
conversion.convert(singleMidi, out_path)
|
2023-01-20 22:26:04 +08:00
|
|
|
|
if debug:
|
2023-01-28 11:56:09 +08:00
|
|
|
|
with open("./records.json", "a", encoding="utf-8") as f:
|
2023-01-27 23:25:28 +08:00
|
|
|
|
json.dump(conversion.toDICT(), f)
|
|
|
|
|
f.write(5 * "\n")
|
2023-01-20 00:31:45 +08:00
|
|
|
|
conversion_result = (
|
2023-01-31 20:39:50 +08:00
|
|
|
|
conversion.to_mcpack(convert_method, *prompts)
|
2023-01-20 00:31:45 +08:00
|
|
|
|
if fileFormat == 0
|
|
|
|
|
else (
|
2023-01-31 20:39:50 +08:00
|
|
|
|
conversion.to_BDX_file(convert_method, *prompts)
|
2023-01-20 00:31:45 +08:00
|
|
|
|
if playerFormat == 1
|
2023-01-31 20:39:50 +08:00
|
|
|
|
else conversion.to_BDX_file_with_delay(convert_method, *prompts)
|
2023-01-20 00:31:45 +08:00
|
|
|
|
)
|
|
|
|
|
)
|
2023-01-27 23:25:28 +08:00
|
|
|
|
|
2023-01-20 00:31:45 +08:00
|
|
|
|
if conversion_result[0]:
|
|
|
|
|
prt(
|
2023-01-31 20:39:50 +08:00
|
|
|
|
f" {_('CmdLength')}{_(':')}{conversion_result[1]}{_(',')}{_('MaxDelay')}{_(':')}{conversion_result[2]}{f'''{_(',')}{_('PlaceSize')}{_(':')}{conversion_result[3]}{_(',')}{_('LastPos')}{_(':')}{conversion_result[4]}''' if fileFormat == 1 else ''}"
|
2023-01-20 00:31:45 +08:00
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
prt(f"{_('Failed')}")
|
2022-10-30 01:39:20 +08:00
|
|
|
|
|
2023-01-27 02:19:53 +08:00
|
|
|
|
exitSth = ipt(_("PressEnterExit")).lower()
|
|
|
|
|
if exitSth == "record":
|
2023-01-20 21:34:15 +08:00
|
|
|
|
import json
|
2023-01-27 23:25:28 +08:00
|
|
|
|
|
2023-01-28 11:56:09 +08:00
|
|
|
|
with open("./demo_config.json", "w", encoding="utf-8") as f:
|
2023-01-27 23:25:28 +08:00
|
|
|
|
json.dump(prompts, f)
|
2023-01-27 02:19:53 +08:00
|
|
|
|
elif exitSth == "delrec":
|
|
|
|
|
os.remove("./demo_config.json")
|