From c32b94592a25432c7898a40c502eadc1702e24d8 Mon Sep 17 00:00:00 2001 From: EillesWan Date: Wed, 5 Oct 2022 23:59:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3=E5=8F=8A?= =?UTF-8?q?=E5=85=B6=E7=BF=BB=E8=AF=91=E2=80=A6=E2=80=A6=EF=BC=8C=E5=8F=A6?= =?UTF-8?q?=E5=A4=96=E5=AF=B9=E6=97=A0=E6=B3=95=E6=89=B9=E9=87=8F=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E5=B8=A6=E8=BF=9B=E5=BA=A6=E6=9D=A1=E7=9A=84bug?= =?UTF-8?q?=E5=81=9A=E4=BA=86=E6=9B=B4=E6=AD=A3=E2=80=A6=E2=80=A6=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E6=89=B9=E9=87=8F=E5=8F=AF=E4=BB=A5=E7=94=A8=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo_convert.py | 45 ++++++++---- demo_convert_bdx_byDelay.py | 11 ++- docs/Use of Funtions.md | 143 ++++++++++++++++++++++++++---------- docs/功能使用说明.md | 57 ++++++++------ 4 files changed, 175 insertions(+), 81 deletions(-) diff --git a/demo_convert.py b/demo_convert.py index 7492f68..254febf 100644 --- a/demo_convert.py +++ b/demo_convert.py @@ -50,9 +50,18 @@ while True: isAutoReset = input('是否自动重置计分板(1|0):') if isAutoReset != '': isAutoReset = bool(int(isAutoReset)) - isProgress = input('是否开启进度条(1|0):') - if isProgress != '': - isProgress = bool(int(isProgress)) + while True: + isProgress = input('*进度条[注]:') + if isProgress != '': + if isProgress in ('1', 'True'): + isProgress = True + elif isProgress in ('0', 'False'): + isProgress = False + else: + isProgress = isProgress + else: + continue + break sbname = input('请输入计分板名称:') volume = input('请输入音量(0-1):') if volume != '': @@ -62,9 +71,18 @@ while True: speed = float(speed) elif outFormat == 1: author = input('请输入作者:') - isProgress = input('是否开启进度条(1|0):') - if isProgress != '': - isProgress = bool(int(isProgress)) + while True: + isProgress = input('*进度条[注]:') + if isProgress != '': + if isProgress in ('1', 'True'): + isProgress = True + elif isProgress in ('0', 'False'): + isProgress = False + else: + isProgress = isProgress + else: + continue + break maxHeight = input('请输入指令结构最大生成高度:') if maxHeight != '': maxHeight = int(maxHeight) @@ -82,6 +100,9 @@ while True: except BaseException: print('输入错误,请重新输入') + + + if os.path.isdir(midipath): for i in os.listdir(midipath): if i.lower().endswith('.mid'): @@ -93,9 +114,7 @@ if os.path.isdir(midipath): isAutoReset if isAutoReset != '' else bool(int(input('是否自动重置计分板(1|0):'))), - isProgress - if isProgress != '' - else bool(int(input('是否开启进度条(1|0):'))), + isProgress, sbname if sbname != '' else input('请输入计分板名称:'), volume if volume != '' else float(input('请输入音量(0-1):')), speed if speed != '' else float(input('请输入速度倍率:')), @@ -104,9 +123,7 @@ if os.path.isdir(midipath): convertion.toBDXfile( 1, author if author != '' else input('请输入作者:'), - isProgress - if isProgress != '' - else bool(int(input('是否开启进度条(1|0):'))), + isProgress, maxHeight if maxHeight != '' else int(input('请输入指令结构最大生成高度:')), sbname if sbname != '' else input('请输入计分板名称:'), volume if volume != '' else float(input('请输入音量(0-1):')), @@ -121,7 +138,7 @@ else: convertion.tomcpack( 1, isAutoReset if isAutoReset != '' else bool(int(input('是否自动重置计分板(1|0):'))), - isProgress if isProgress != '' else bool(int(input('是否开启进度条(1|0):'))), + isProgress, sbname if sbname != '' else input('请输入计分板名称:'), volume if volume != '' else float(input('请输入音量(0-1):')), speed if speed != '' else float(input('请输入速度倍率:')), @@ -130,7 +147,7 @@ else: convertion.toBDXfile( 1, author if author != '' else input('请输入作者:'), - isProgress if isProgress != '' else bool(int(input('是否开启进度条(1|0):'))), + isProgress, maxHeight if maxHeight != '' else int(input('请输入指令结构最大生成高度:')), sbname if sbname != '' else input('请输入计分板名称:'), volume if volume != '' else float(input('请输入音量(0-1):')), diff --git a/demo_convert_bdx_byDelay.py b/demo_convert_bdx_byDelay.py index 1d22623..5e56874 100644 --- a/demo_convert_bdx_byDelay.py +++ b/demo_convert_bdx_byDelay.py @@ -22,8 +22,8 @@ while True: authorname = input('请输入作者:') while True: isProgress = input('*进度条[注]:') - if isProgress != '' : - if isProgress in ('1','True'): + if isProgress != '': + if isProgress in ('1', 'True'): isProgress = True elif isProgress in ('0', 'False'): isProgress = False @@ -49,7 +49,9 @@ while True: print('输入错误,请重新输入') -def operation(i,): +def operation( + i, +): print(f'正在操作{i}') convertion.convert(midipath + '/' + i, outpath) convertion.toBDXfile_withDelay( @@ -65,9 +67,10 @@ def operation(i,): if os.path.isdir(midipath): import threading + for i in os.listdir(midipath): if i.lower().endswith('.mid'): - threading.Thread(target=operation,args=(i,)).start() + threading.Thread(target=operation, args=(i,)).start() else: convertion.convert(midipath, outpath) convertion.toBDXfile_withDelay( diff --git a/docs/Use of Funtions.md b/docs/Use of Funtions.md index ded6dfc..2b6f1d7 100644 --- a/docs/Use of Funtions.md +++ b/docs/Use of Funtions.md @@ -5,47 +5,112 @@

-## Instructions📕 +# Instructions for Using Demo(s) -> 0. Install Python 3.6+ -> -> While installing, be sure to check "add Python 3.X to path", otherwise it needs to be set manually -> -> After the installation, remember to enter in CMD: "python" to try -> -> whether the installation is successful. -> -> Python installation tutorial can be found on the Internet easily. -> -> 1. Install (download this program) -> Git, you can use the following commands: -> -> `git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git` -> -> If Git is not installed, you can download the zip package from the website. Then decompress it -> and enter the directory. -> -> 2. Run (enter directory) -> -> Open CMD in the directory, enter the directory, and execute the following commands: -> -> `pip install mido` -> -> `pip install brotli` -> -> `pip install openpyxl` -> -> 3. Start using! -> -> Open CMD in the directory, enter the directory, and execute the following commands: -> -> (Choose what you need) -> -> `python example_convert_bdx.py` -> -> `python example_convert_mcpack.py` +*This is a tutorial for using the demo(s) of this library, not the Development Guide. If you want to see so, please read Below* -### Instructions for **Customize Progress Bar** +## Under Windows + +0. Install Python 3.6+ + + First of all, you need to install the runtime environment of this library, *Python*. And a Installation Pack maybe the best choice: + + > [Downloading Python 64-bit](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe) + > [Downloading Python 32-bit](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe) + + While installing, it's better to check `Add Python 3.X to PATH`(just as the screenshot showed below), otherwise it needs to be set manually which may cause some time wasting + + + + If you are new to Python or not very familiar to Computer Programming, and having the disk space in your PC's System Partition (usually C:) of 150 MB, you can directly choose *Install Now*. + + However, if you want to do it like a pro, choosing *Customize Installation*, it's a necessary to be sure to check `pip` and `py launcher` will be installed on your computer(see screenshot below). The two options is required for the next step of installing the requirements. + + + + After the installation, you can enter in your terminal(CMD/PowerShell/Bash/etc): "python" to ensure whether the installation was successful. If it was, your terminal will show things like below: + + + + +1. Installing Requirements + + It's better to open your terminal(CMD/PowerShell/Bash/etc) under Administrator Mode. + + For example, if you want to use CMD in Administrator Mode, you can search `cmd` in the *Start Menu*, right click it and *Run as Administrator* + + + + Okay, after that, please enter in your terminal: + + `pip install mido` + + `pip install brotli` + + If successful you will see something like below: + + + + + +2. Download This Package and Demo(s) + + - If you using Git, you can use the following commands to clone this lib: + + `git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git` + + - If Git is not installed, you can download the zip package from the code page(from [GitHub](https://github.com/EillesWan/Musicreater.git) or [Gitee](https://gitee.com/EillesWan/Musicreater.git)). Or you are a Chinese fan having a QQ account, you can [Join the QQ Group 861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr) and get it from our GroupFiles. + + + + +2. Start Using Demo(s) + + Open your terminal in the directory of this, taking CMD, for example, just enter the directory and enter `cmd` in the path box: + + + + + And enter one of the commands below by choosing what you need: + + `python demo_convert.py` + + `python demo_convert_bdx_byDelay.py` + + +### Addition for Error(s) Using or Installing + +1. Environment Error of Microsoft Visual C++ Redistributable + + If you meet this condition as the screenshot shows: + + + + Your MSVC Environment may be not installed, and you can download and install + > [Here of 64-Bit VCREDIST](https://aka.ms/vs/17/release/vc_redist.x64.exe) + > [Here of 32-Bit VCREDIST](https://aka.ms/vs/17/release/vc_redist.x86.exe) + + Thank our groupmate *Mono* again for helping finding this problem. + +2. More Info for Parameters of Our Demo Program(s) + + + + |Input Prompt|English Translation|Description| + |----------------|----------------|-------| + |请输入MIDI文件路径|Midi File Path|Path of a .mid file or a directory. While directory entered, our demo will convert all midi(s) in the directory| + |请输入输出路径|Output Path|Where files converted in| + |是否重置计分板|Whether Reset Scoreboard Automatically|Can only be 1 or 0(Recommanded 1)| + |*进度条[注]|Progressbar|Whether to enable Progressbar and customize progressbar style. Type 0 or False to disable, 1 or True to use default style, or type using format taught in follow the Instructions below to customize one you like| + |请输入计分板名称|Scoreboard Name|*Only not byDelay* The name of scoreboard that player using| + |请输入音量|Volume|Only decimal in [0,1],(Recommanded 1)| + |请输入速度倍率|Speed Multiplying Factor|Maybe you want to play it faster(>1) or slower(>0 <1)?| + |请输入玩家选择器|Player Selector|Full Selector including `@x`. E.g: Play for players tagged `Holo`, enter `@a[tag=Holo]` on this parameter| + + + + +# Instructions for **Customize Progress Bar** We have supported the function of making progress bar in *Minecraft*'s music player. And also the method of customize them. So the following instructions are about the parameters of the Progress Bar Customizition. diff --git a/docs/功能使用说明.md b/docs/功能使用说明.md index 712fa0e..a1047dd 100644 --- a/docs/功能使用说明.md +++ b/docs/功能使用说明.md @@ -1,3 +1,9 @@ +

音·创 Musicreater

+ +

+ +

+ # 演示程序使用教程 *由于先前的 **读我文件**(README.md) 过于冗杂,现另辟蹊径来给大家全方位的教程。* @@ -8,18 +14,18 @@ ### 运行环境安装 -0. 安装python3.6+ +0. 安装 Python3.6+ 首先需要下载Python的安装包 > [下载64位Python安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe) > [下载32位Python安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe) - 在安装时,最好需要勾选 `Add Python 3.X to PATH` ,如下图所示,当然,如果您对自己非常自信,您也可以手动设置此项目: + 在安装时,最好需要勾选 `Add Python 3.X to PATH`,如下图所示,当然,如果您对自己非常自信,您也可以手动设置此项目: - 若您对Python一知半解或者不怎么了解、并对自己的系统盘有大约150*MB*的信心的话,您可以在安装时直接选择*快速安装*(Install Now) + 若您对Python一知半解或者不怎么了解、并对自己的系统盘(通常是C盘)有大约150*兆字节*(MB)的信心的话,您可以在安装时直接选择*快速安装*(Install Now) 若您选择了*自定义安装*(Customize Installation),请务必勾选 `pip` 和 `py launcher` 便于后续安装依赖,如下图: @@ -29,17 +35,8 @@ -1. 下载本代码库以及演示程序 - - 若您使用git,请直接拷贝本仓库: - - `git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git` - - - 若您不使用git,可以在*码云*(Gitee)或GitHub下载zip包,或者[加入QQ群聊861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr),在群文件中获取。 - - - -2. 安装依赖 +1. 安装依赖 请以管理员模式打开您的*终端*(命令行/PowerShell/Bash/etc) @@ -58,17 +55,30 @@ +2. 下载本代码库以及演示程序 + + - 若您使用git,请直接克隆本仓库: + + `git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git` + + - 若您不使用git,可以在[*码云*(Gitee)](https://gitee.com/EillesWan/Musicreater.git)或[*GitHub*](https://github.com/EillesWan/Musicreater.git)下载zip包,或者[加入QQ群聊861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr),在群文件中获取。 + + + + 3. 开始使用 - 在目录下打开终端,例如,打开命令行,请进入到目录下,在地址框内输入cmd: + 在目录下打开终端,例如,打开命令行,请进入到目录下,在地址框内输入`cmd`: + 执行以下命令:(选择你需要的) - `python example_convert_bdx.py` + `python demo_convert.py` + + `python demo_convert_bdx_byDelay.py` - `python example_convert_mcpack.py` ### 补充错误说明 @@ -80,7 +90,7 @@ 请下载最新的VCREDIST安装包,可以参照[这个网页](https://docs.microsoft.com/zh-CN/cpp/windows/latest-supported-vc-redist)的说明,也可以在这直接选择你需要的安装包下载: > [下载64位VCREDIST安装包](https://aka.ms/vs/17/release/vc_redist.x64.exe) - > [下载32位VCREDIST安装包](https://aka.ms/vs/17/release/vc_redist.x64.exe) + > [下载32位VCREDIST安装包](https://aka.ms/vs/17/release/vc_redist.x86.exe) 感谢群友Mono帮我们发现这个问题 @@ -88,26 +98,26 @@ - - midi路径:含有mid文件路径、文件名、后缀的完整文件路径。可以使用相对或绝对路径皆可 + - midi路径:含有mid文件路径、文件名、后缀的完整文件路径,或者一个目录(demo可接受批量转换)。可以使用相对或绝对路径皆可 - 输出路径:输出文件夹的路径,不需要指示文件名 - 是否重置计分板:1或0(歌曲放完是否重置,推荐1) - - 是否启用进度条:1或0(看个人需要) - - *进度条:是否启用进度条,以及自定义进度条样式。输入0或False表示不启用进度条,输入1或True表示使用默认进度条,其余的输入均表示使用输入的格式作为自定义的进度条样式 + - *进度条:是否启用进度条,以及自定义进度条样式。输入0或False表示不启用进度条,输入1或True表示使用默认进度条,其余的输入均表示使用输入的格式作为自定义的进度条样式 - 计分板名称:游戏内的计分板名称 - 音量:0-1之间的小数(含0,1)正常来说推荐1 - - 变速:float数据,一般写1 + - 速度倍率:小数数据,不可为0,一般写1 - - 玩家选择器:包括 `@x` 在内的全部选择器,即若要选择全部标签为Holo的玩家,则需要如此输入:`@a[tag=Holo]` + - 玩家选择器:包括 `@x` 在内的全部选择器,即若要选择全部标签为`Holo`的玩家,则需要如此输入:`@a[tag=Holo]` - 没有报错且在输出路径下找到mcpack或bdx即为生成成功: + + # 对于 进度条自定义 功能的说明 @@ -152,4 +162,3 @@ *对了!为了避免生成错误,请尽量避免使用标识符作为定义样式字符串的其他部分* - \ No newline at end of file