除旧迎新,0.2.0大更新!

This commit is contained in:
EillesWan 2023-01-20 00:33:09 +08:00
parent 392e74d8d9
commit 782395b6c9
7 changed files with 1 additions and 490 deletions

View File

@ -1,151 +0,0 @@
# -*- coding: utf-8 -*-
# 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
"""
· 库版 MIDI转换展示程序
Musicreater Package Version : Demo for Midi Conversion
Copyright 2023 all the developers of Musicreater
开源相关声明请见 ./Lisence.md
Terms & Conditions: ./Lisence.md
"""
from msctPkgver.main import *
import os
convertion = midiConvert()
while True:
midipath = input('请输入midi文件路径')
if os.path.exists(midipath):
break
else:
print('文件不存在,请重新输入')
outpath = input('请输入输出路径:')
if not os.path.exists(outpath):
os.makedirs(outpath)
while True:
try:
outFormat = int(input('请输入输出格式(0:mcpack|1:BDX结构)'))
if outFormat == 0:
isAutoReset = input('是否自动重置计分板(1|0)')
if isAutoReset != '':
isAutoReset = bool(int(isAutoReset))
while True:
isProgress = input('*进度条[本Demo不支持自定义]')
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 != '':
volume = float(volume)
speed = input('请输入速度倍率:')
if speed != '':
speed = float(speed)
elif outFormat == 1:
author = input('请输入作者:')
while True:
isProgress = input('*进度条[本Demo不支持自定义]')
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)
sbname = input('请输入计分板名称:')
volume = input('请输入音量0-1')
if volume != '':
volume = float(volume)
speed = input('请输入速度倍率:')
if speed != '':
speed = float(speed)
isAutoReset = input('是否自动重置计分板(1|0)')
if isAutoReset != '':
isAutoReset = bool(int(isAutoReset))
break
except BaseException:
print('输入错误,请重新输入')
m = 1
'''采用的算法编号'''
if os.path.isdir(midipath):
for i in os.listdir(midipath):
if i.lower().endswith('.mid'):
print(f'正在操作{i}')
convertion.convert(midipath + '/' + i, outpath + '/' + i[:-4])
if outFormat == 0:
print(convertion.tomcpack(
m,
isAutoReset
if isAutoReset != ''
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('请输入速度倍率:')),
))
elif outFormat == 1:
print(convertion.toBDXfile(
m,
author if author != '' else input('请输入作者:'),
isProgress,
maxHeight if maxHeight != '' else int(input('请输入指令结构最大生成高度:')),
sbname if sbname != '' else input('请输入计分板名称:'),
volume if volume != '' else float(input('请输入音量0-1')),
speed if speed != '' else float(input('请输入速度倍率:')),
isAutoReset
if isAutoReset != ''
else bool(int(input('是否自动重置计分板(1|0)'))),
))
else:
convertion.convert(midipath, outpath)
if outFormat == 0:
print(convertion.tomcpack(
m,
isAutoReset if isAutoReset != '' 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('请输入速度倍率:')),
))
elif outFormat == 1:
print(convertion.toBDXfile(
m,
author if author != '' else input('请输入作者:'),
isProgress,
maxHeight if maxHeight != '' else int(input('请输入指令结构最大生成高度:')),
sbname if sbname != '' else input('请输入计分板名称:'),
volume if volume != '' else float(input('请输入音量0-1')),
speed if speed != '' else float(input('请输入速度倍率:')),
isAutoReset if isAutoReset != '' else bool(int(input('是否自动重置计分板(1|0)'))),
))

View File

@ -1,105 +0,0 @@
# -*- coding: utf-8 -*-
# THIS PROGRAM IS ONLY A TEST EXAMPLE
# 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
"""
· 库版 MIDI转换展示程序
Musicreater Package Version : Demo for Midi Conversion
Copyright 2023 all the developers of Musicreater
开源相关声明请见 ./Lisence.md
Terms & Conditions: ./Lisence.md
"""
from msctPkgver.main import *
convertion = midiConvert()
while True:
midipath = input('请输入midi文件路径')
if os.path.exists(midipath):
break
else:
print('文件不存在,请重新输入')
outpath = input('请输入输出路径:')
if not os.path.exists(outpath):
os.makedirs(outpath)
while True:
try:
authorname = input('请输入作者:')
while True:
isProgress = input('*进度条[本Demo不支持自定义]')
if isProgress != '':
if isProgress in ('1', 'True'):
isProgress = True
elif isProgress in ('0', 'False'):
isProgress = False
else:
isProgress = isProgress
else:
continue
break
volume = input('请输入音量0-1')
if volume != '':
volume = float(volume)
speed = input('请输入速度倍率:')
if speed != '':
speed = float(speed)
player = input('请输入玩家选择器:')
heightmax = input('请输入指令结构最大生成高度:')
if heightmax != '':
heightmax = int(heightmax)
break
except BaseException:
print('输入错误,请重新输入')
def operation(
i,
):
print(f'正在操作{i}')
convertion.convert(midipath + '/' + i, outpath)
print(
convertion.toBDXfile_withDelay(
1,
authorname if authorname != '' else input('请输入作者:'),
isProgress,
heightmax if heightmax != '' else int(input('请输入指令结构最大生成高度:')),
volume if volume != '' else float(input('请输入音量(0-1]')),
speed if speed != '' else float(input('请输入速度倍率:')),
player if player != '' else input('请输入玩家选择器:'),
)
)
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()
else:
convertion.convert(midipath, outpath)
print(
convertion.toBDXfile_withDelay(
1,
authorname if authorname != '' else input('请输入作者:'),
isProgress,
heightmax if heightmax != '' else int(input('请输入指令结构最大生成高度:')),
volume if volume != '' else float(input('请输入音量(0-1]')),
speed if speed != '' else float(input('请输入速度倍率:')),
player if player != '' else input('请输入玩家选择器:'),
)
)

View File

@ -1,18 +0,0 @@
# THIS PROGRAM IS ONLY A TEST EXAMPLE
from msctPkgver.main import *
convertion = midiConvert()
convertion.convert(input('请输入midi文件路径'), input('请输入输出路径:'))
for i in convertion.toBDXfile(
1,
input('请输入作者:'),
bool(int(input('是否开启进度条(1|0)'))),
int(input('请输入指令结构最大生成高度:')),
input('请输入计分板名称:'),
float(input('请输入音量(0-1]')),
float(input('请输入速度倍率:')),
bool(int(input('是否自动重置计分板(1|0)'))),
):
print(i)

View File

@ -1,22 +0,0 @@
# THIS PROGRAM IS ONLY A TEST EXAMPLE
from msctPkgver.main import *
convertion = midiConvert()
convertion.convert(input('请输入midi文件路径'), input('请输入输出路径:'))
convertion.tomcpack(
1,
bool(int(input('是否自动重置计分板(1|0)'))),
bool(int(input('是否开启进度条(1|0)'))),
input('请输入计分板名称:'),
float(input('请输入音量0-1')),
float(input('请输入速度倍率:')),
)
# for the test
# if __name__ == '__main__':
# convertion = midiConvert()
# convertion.convert(r"C:\Users\lc\Documents\MuseScore3\乐谱\乐谱\victory.mid", ".")
# convertion.tomcpack(
# 1, True, True, "scb", 1, 1)

View File

@ -1,67 +0,0 @@
# -*- coding: utf-8 -*-
# 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
"""
· 库版 MIDI转换示例程序
Musicreater Package Version : Demo for Midi Conversion
Copyright 2022 all the developers of Musicreater
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from rich.console import Console
MainConsole = Console()
import requests
import random
# 欸嘿!
while True:
MainConsole.print(
"[#121110 on #F0F2F4] ",
style="#121110 on #F0F2F4",
justify="center",
)
MainConsole.rule(title="[bold #AB70FF]欢迎使用音·创独立转换器", characters="=", style="#26E2FF")
MainConsole.rule(
title="[bold #AB70FF]Welcome to Independent Musicreater Convernter", characters="-"
)
MainConsole.print(
"[#121110 on #F0F2F4]"
+ random.choice(
requests.get(
"https://gitee.com/EillesWan/Musicreater/raw/master/resources/myWords.txt"
)
.text.strip("\r\n")
.split("\r\n")
),
style="#121110 on #F0F2F4",
justify="center",
)
MainConsole.print()

View File

@ -7,7 +7,7 @@
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md # 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
__version__ = '0.1.3' __version__ = '0.2.0'
__all__ = [] __all__ = []
__author__ = (('金羿', 'Eilles Wan'), ('诸葛亮与八卦阵', 'bgArray'), ('鸣凤鸽子', 'MingFengPigeon')) __author__ = (('金羿', 'Eilles Wan'), ('诸葛亮与八卦阵', 'bgArray'), ('鸣凤鸽子', 'MingFengPigeon'))

View File

@ -365,106 +365,6 @@ class midiConvert:
def __score2time(self, score: int): def __score2time(self, score: int):
return str(int(int(score / 20) / 60)) + ":" + str(int(int(score / 20) % 60)) return str(int(int(score / 20) / 60)) + ":" + str(int(int(score / 20) % 60))
# def __formProgressBar(
# self,
# maxscore: int,
# scoreboardname: str,
# progressbar: tuple = (
# r"▶ %%N [ %%s/%^s %%% __________ %%t|%^t ]",
# ("§e=§r", "§7=§r"),
# ),
# ) -> list:
# pgsstyle = progressbar[0]
# """用于被替换的进度条原始样式"""
# """
# | 标识符 | 指定的可变量 |
# |---------|----------------|
# | `%%N` | 乐曲名(即传入的文件名)|
# | `%%s` | 当前计分板值 |
# | `%^s` | 计分板最大值 |
# | `%%t` | 当前播放时间 |
# | `%^t` | 曲目总时长 |
# | `%%%` | 当前进度比率 |
# | `_` | 用以表示进度条占位|
# """
# def __replace(
# s: str, tobeReplaced: str, replaceWith: str, times: int, other: str
# ):
# if times == 0:
# return s.replace(tobeReplaced, other)
# if times == s.count(tobeReplaced):
# return s.replace(tobeReplaced, replaceWith)
# result = ""
# t = 0
# for i in s:
# if i == tobeReplaced:
# if t < times:
# result += replaceWith
# t += 1
# else:
# result += other
# else:
# result += i
# return result
# idlist = {
# r"%%N": self.midFileName,
# r"%%s": r"%%s",
# r"%^s": str(maxscore),
# r"%%t": r"%%t",
# r"%^t": self.__score2time(maxscore),
# r"%%%": r"%%%",
# }
# ids = {}
# for i, j in idlist.items():
# if i != j:
# if i in pgsstyle:
# pgsstyle = pgsstyle.replace(i, j)
# else:
# if i in pgsstyle:
# ids[i] = True
# else:
# ids[i] = False
# del idlist
# pgblength = pgsstyle.count("_")
# """进度条的“条”长度"""
# finalprgsbar = []
# for i in range(maxscore):
# nowstr = pgsstyle
# if ids[r"%%s"]:
# nowstr = nowstr.replace(r"%%s", str(i + 1))
# if ids[r"%%t"]:
# nowstr = nowstr.replace(r"%%t", self.__score2time(i + 1))
# if ids[r"%%%"]:
# nowstr = nowstr.replace(
# r"%%%", str(int((i + 1) / maxscore * 10000) / 100) + "%"
# )
# countof_s = int((i + 1) / maxscore * pgblength)
# finalprgsbar.append(
# "title @a[scores={"
# + scoreboardname
# + "="
# + str(i + 1)
# + "}] actionbar "
# + __replace(
# nowstr, "_", progressbar[1][0], countof_s, progressbar[1][1]
# )
# )
# return finalprgsbar
def __formProgressBar( def __formProgressBar(
self, self,
maxscore: int, maxscore: int,
@ -1422,29 +1322,3 @@ class midiConvert:
return (True, len(cmdlist), maxdelay, size, finalPos) return (True, len(cmdlist), maxdelay, size, finalPos)
# def isProgressBar(pgbarLike:str):
# '''判断所输入数据是否为进度条式样数据
# 注意,使用本函数时不得直接放在 if 后,正确用法如下:
# 判断是否是合规进度条样式数据:
# ```
# if isProgressBar(pgb) == False:
# pass # 进度条样式错误
# else:
# pass # 进度条样式正确
# ```
# 当仅需要判断正确的情况时也最好这样写:
# ```
# if not isProgressBar(pgb) == False:
# pass # 进度条样式正确
# ```
# :param phbarLike:str
# 所需判断的字符串
# :return False | tuple
# 是否为可读的进度条式样,如果是,则转换为进度条元组
# '''
# if pgbarLike.lower() in ('true','1'):
# return (r"▶ %%N [ %%s/%^s %%% __________ %%t|%^t ]",("§e=§r", "§7=§r"),)
# elif pgbarLike.lower() in ('false','0'):
# return ()