直接更换库为BeeWare作为窗口库

This commit is contained in:
EillesWan 2021-12-31 07:54:56 +08:00
parent 4bd7fca256
commit acf4c6907e
76 changed files with 848 additions and 433 deletions

66
.gitignore vendored Normal file
View File

@ -0,0 +1,66 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# OSX useful to ignore
*.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# IntelliJ Idea family of suites
.idea
*.iml
## File-based project format:
*.ipr
*.iws
## mpeltonen/sbt-idea plugin
.idea_modules/
# Briefcase build directories
iOS/
macOS/
windows/
android/
linux/
django/

View File

@ -1,341 +0,0 @@
# -*- coding: utf-8 -*-
# W-YI 金羿
# QQ 2647547478
# 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com
# 版权所有 Team-Ryoun 金羿
# 若需转载或借鉴 请附作者
# 代码写的并非十分的漂亮还请大佬多多包涵本软件源代码依照Apache软件协议公开
import json
import os
import shutil
import threading
import sys
from msctspt.threadOpera import NewThread
from msctspt.bugReporter import version
from nmcsup.log import log
__version__ = version.version[1]+version.version[0]
__author__ = 'W-YI (金羿)'
log("系统工作————————加载变量及函数")
print("更新执行位置...")
if sys.platform == 'win32':
os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')])
log("更新执行位置,当前文件位置"+__file__)
else:
try:
os.chdir(__file__[:len(__file__) -
__file__[len(__file__)::-1].index('/')])
except:
pass
log("其他平台:"+sys.platform+"更新执行位置,当前文件位置"+__file__)
print('完成!')
def __main__():
print('建立变量,存入内存,载入字典常量函数')
# 主体部分
# 支持多文件同时操作
# dataset[{ 'mainset':{ 'x':'y' }, 'musics': [ { 'set' :{ 'A':'B' } , 'note' : [ [ 'a' , b ], ] }, ] }, ]
# 编辑:
# 修改主设置: dataset[第几个项目]['mainset']['什么设置'] = '设置啥'
# 修改音乐: dataset[第几个项目]['musics'][第几个音轨]['notes'][第几个音符][音符还是时间01] = 改成啥
# 修改音轨设置: dataset[第几个项目]['musics'][第几个音轨]['set']['什么设置'] = '设置啥'
#
# 新增音轨: dataset[第几个项目]['musics'].append(datasetmodelpart)
#
'''
dataset=[
{
'mainset':{
'PackName':"Ryoun",
'MusicTitle':'Noname',
'IsRepeat':False,
'PlayerSelect':''
},
'musics':[
{
'set':{
'EntityName':'music_support',
'ScoreboardName':'music_support',
'Instrument':'harp',
'FileName':"Music"
},
'notes':[
[0.0,1.0],
]
},
],
},
]
'''
global dataset
dataset = [
{
'mainset': {
'PackName': "Ryoun",
'MusicTitle': 'Noname',
'IsRepeat': False,
'PlayerSelect': ''
},
'musics': [
{
'set': {
'EntityName': 'MusicSupport',
'ScoreboardName': 'MusicSupport',
'Instrument': 'note.harp',
'FileName': "Music"
},
'notes': [
[0.0, 1.0],
]
},
],
},
]
global is_new_file
global is_save
global ProjectName
global NowMusic
is_new_file = True
is_save = True
ProjectName = ''
NowMusic = 0
def DMM(): # 反回字典用于编辑
datasetmodelpart = {
'set': {
'EntityName': 'MusicSupport',
'ScoreboardName': 'MusicSupport',
'Instrument': 'note.harp',
'FileName': "Music"
},
'notes': []
}
return datasetmodelpart
print("完成")
# 菜单命令
print('加载菜单命令...')
def exitapp(cmd):
log("程序正常退出", False)
global is_save
if is_save == False:
if '/s' in cmd:
saveProject()
else:
print("您尚未保存,请使用 /s 开关保存并退出")
return
try:
global dataset
del dataset
except:
pass
if '/c' in cmd:
print("清除log此句不载入日志")
try:
if os.path.exists("./log/"):
shutil.rmtree("./log/")
if os.path.exists("./logs/"):
shutil.rmtree("./logs/")
if os.path.exists("./cache/"):
shutil.rmtree("./cache/")
except:
print("无法清除日志及临时文件")
exit()
print('退出函数加载完成!')
print("载入文件读取函数")
def ReadFile(fn: str) -> list:
from nmcsup.nmcreader import ReadFile as fileRead
k = fileRead(fn)
if k == False:
log("找不到"+fn)
return
else:
return k
def ReadMidi(midfile: str) -> str:
from nmcsup.nmcreader import ReadMidi as midiRead
k = midiRead(midfile)
if k == False:
log("找不到"+midfile)
return
else:
return k
print('完成!')
print("载入命令函数")
def saveProject(cmd: list):
global is_new_file
if '/a' in cmd:
log("另存项目")
ProjectName = cmd[cmd.index('/a')+1]
else:
if is_new_file:
print("初次存储请使用 /a 开关规定存储文件名")
log("文件为未保存")
return
log("存储文件:"+ProjectName)
with open(ProjectName, 'w', encoding='utf-8') as f:
json.dump(dataset[0], f)
global is_save
is_save = True
print('保存项目函数加载完成!')
def loadMusic(cmd: list):
if '/mid' in cmd:
th = NewThread(ReadMidi, (cmd[cmd.index('/mid')+1],))
th.start()
def midiSPT(th):
for i in th.getResult():
datas = DMM()
datas['notes'] = i
dataset[0]['musics'].append(datas)
del th
global is_save
is_save = False
threading.Thread(target=midiSPT, args=(th,)).start()
del th
elif '/txt' in cmd:
th = NewThread(ReadFile, (cmd[cmd.index('/txt')+1],))
th.start()
def midiSPT(th):
for i in th.getResult():
datas = DMM()
datas['notes'] = i
dataset[0]['musics'].append(datas)
del th
global is_save
is_save = False
threading.Thread(target=midiSPT, args=(th,)).start()
elif '/input' in cmd:
datas = []
for i in cmd[cmd.index('/input')+1:]:
datas.append([str(i), 1.0])
from nmcsup.trans import note2list
datat = DMM()
datat['notes'] = note2list(datas)
dataset[0]['musics'].append(datat)
del datas, datat
global is_save
is_save = False
print('音轨载入函数加载完成!')
def funBuild(cmd: list):
if '/file' in cmd:
from msctspt.funcOpera import makeFuncFiles
makepath = cmd[cmd.index('/file')+1]
if makepath[-1] != '/':
makepath += '/'
makeFuncFiles(dataset[0], makepath)
elif '/directory' in cmd:
from msctspt.funcOpera import makeFunDir
makepath = cmd[cmd.index('/directory')+1]
if makepath[-1] != '/':
makepath += '/'
makeFunDir(dataset[0], makepath)
elif '/mcpack' in cmd:
import zipfile
from msctspt.funcOpera import makeFunDir
makepath = cmd[cmd.index('/mcpack')+1]
if makepath[-1] != '/':
makepath += '/'
if not os.path.exists('./temp/'):
os.makedirs('./temp/')
makeFunDir(dataset[0], './temp/')
shutil.move('./temp/'+dataset[0]['mainset']['PackName'] +
"Pack/behavior_packs/"+dataset[0]['mainset']['PackName']+"/functions", './')
shutil.move('./temp/'+dataset[0]['mainset']['PackName'] + "Pack/behavior_packs/" +
dataset[0]['mainset']['PackName']+"/manifest.json", './')
with zipfile.ZipFile(makepath+dataset[0]['mainset']['PackName']+'.mcpack', "w") as zipobj:
for i in os.listdir('./functions/'):
zipobj.write('./functions/'+i)
zipobj.write('./manifest.json')
shutil.move('./functions', './temp/')
shutil.move('./manifest.json', './temp/')
shutil.rmtree("./temp/")
print("函数建立函数加载完成")
if sys.platform == 'win32':
os.system("cls")
else:
os.system("clear")
if sys.platform in ('win32', 'linux'):
print("您当前的运行环境为标准桌面,您可以打开 Musicreater.py 运行窗口模式的 音·创")
print("您也可以输入 win 指令在不退出命令行模式的同时打开窗口模式\n")
print(__author__+" 音·创 —— 当前核心版本 "+__version__+'\n')
nowWorkPath = os.path.split(os.path.realpath(__file__))[0]
while True:
strcmd = input("MSCT "+nowWorkPath+">")
cmd = strcmd.lower().split(' ')
if cmd[0] == 'exit':
exitapp(cmd[1:])
elif cmd[0] == 'save':
saveProject(cmd[1:])
elif cmd[0] == 'load':
loadMusic(cmd[1:])
elif cmd[0] == 'win':
def run(cmd):
os.system(cmd)
if sys.platform == 'win32':
NewThread(run, ("python "+os.path.split(os.path.realpath(__file__))
[0]+"/Musicreater.py",)).start()
else:
NewThread(run, ("python3 "+os.path.split(os.path.realpath(__file__))
[0]+"/Musicreater.py",)).start()
elif cmd[0] == 'chdir':
nowWorkPath = os.path.realpath(cmd[1])
os.chdir(nowWorkPath)
elif cmd[0] == 'build':
funBuild(cmd[1:])
else:
os.system(strcmd)
if __name__ == '__main__':
__main__()

View File

@ -1,4 +1,4 @@
# Musicreater # 音·创 Musicreater
### 介绍 ### 介绍
音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件 音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件
@ -7,59 +7,39 @@
### 软件架构 ### 软件架构
软件采用Python作为第一语言目前还没有使用其他语言辅助。现在的图形库是tkinter后期将使用BeeWare兼容安卓 软件采用Python作为第一语言目前还没有使用其他语言辅助。使用BeeWare作为图形库兼容安卓
现阶段支持Windows7+Linux(版本嘛支持Python3.8就好) 尽量全平台支持
### 安装教程 ### 安装教程
#### Windows7+ #### Windows
0. [Gitee下载需要登陆](https://gitee.com/EillesWan/Musicreater/repository/archive/master.zip) 即将到来。
[Github下载](https://github.com/EillesWan/Musicreater/archive/refs/heads/master.zip)本程序
1. 安装Python 3.8.10
[下载64位安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe)
[下载32位安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe)
2. 以管理员身份运行 补全库.py :
- 按下 Ctrl+Shift+Esc 打开任务管理器
- 点击 "文件" 菜单中的 运行新任务 命令
- 输入 `cmd` 并框选 "以管理员身份运行" 按下 "确定"
- 将 "补全库.py" 拖拽入开启的窗口,按下回车
3. 等待安装完成后,双击运行 Musicreater.py
#### Linux (测试版本Kali 2021.4) #### Linux
0. 若你没有足够优秀的环境,推荐先在终端敲: 即将到来。
```bash
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3
sudo apt-get install python3-pip
sudo apt-get install git
```
1. 若你足够自信,该整的都整了,就在你想下载此程序的地方打开终端,敲:
```bash
sudo git clone https://gitee.com/EillesWan/Musicreater.git
cd Musicreater
python3 补全库.py
python3 Musicreater.py
```
#### Android
即将到来。
### 使用说明 ### 使用说明
1. 直接运行就好 1. 直接运行就好
2. 看得懂简体中文字的不一定全会用 2. 有不懂的问题来群里问
3. 最好要懂一点点英文 3. 请理解英文表述
### 致谢 ### 致谢
1. 感谢由 [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”等 带来的我的世界websocket服务器功能 1. 感谢由 [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”等 带来的我的世界websocket服务器功能
2. 感谢 昀梦QQ1515399885 找出指令生成错误bug并指正 2. 感谢 昀梦QQ1515399885 找出指令生成错误bug并指正
3. 感谢由 Charlie_Ping “查理平” 带来的bdx转换功能 3. 感谢由 Charlie_Ping “查理平” 带来的bdx转换功能
4. 感谢广大群友为此程序提供的测试等支持 4. 感谢由 CMA_2401PT 提供的 BDXWorkShop作为.bdx结构的操作指导
5. 若您为我找出了错误但您的名字没有显示在此列表中,请联系我! 5. 感谢广大群友为此程序提供的测试等支持
6. 若您为我找出了错误但您的名字没有显示在此列表中,请联系我!
### 作者<金羿>联系方式 ### 作者<金羿>联系方式

12
README.rst Normal file
View File

@ -0,0 +1,12 @@
Musicreater
===========
**This cross-platform app was generated by** `Briefcase`_ **- part of**
`The BeeWare Project`_. **If you want to see more tools like Briefcase, please
consider** `becoming a financial member of BeeWare`_.
音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件
.. _`Briefcase`: https://github.com/beeware/briefcase
.. _`The BeeWare Project`: https://beeware.org/
.. _`becoming a financial member of BeeWare`: https://beeware.org/contributing/membership

52
README_en.md Normal file
View File

@ -0,0 +1,52 @@
# Musicreater
### Introduction
Musicreater(音·创) is an Eilles(*W-YI*)'s app that is used for creating musics in **Minecraft: Bedrock Edition**.
Welcome to join our QQ group: 861684859
### Framework
Use *Python* to develop, use *BeeWare* as a Windows Library.
We are trying to support every platform.
### Tutorials
#### Windows
Please wait for a while...
Comming soon
#### Linux
Please wait for a while...
Comming soon
#### Android
Please wait for a while...
Comming soon
### Instructions
1. Just make u understand the Chinese
2. If u dont understand, u can come to the QQ group or email me to ask questions
3. The English Edition is comming soon.
### Thanks
1. Thank [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”and so on for the function of Creating the Websocket Server for Minecraft: Bedrock Edition.
2. Thank 昀梦QQ1515399885 for finding and correcting the bugs in the commands that *Musicreater* Created.
3. Thank Charlie_Ping “查理平” for bdx convert funtion.
4. Thank CMA_2401PT for BDXWorkShop as the .bdx structure's operation guide.
5. Thanks for a lot of groupmates who support me and help me to test the program.
6. If u have give me some help but u haven't been in the list, please contact me.
### Contact *Eilles(W-YI)*(金羿)
1. QQ 2647547478
2. E-mail EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
3. WeChat WYI_DoctorYI

1
Run in devmode.bat Normal file
View File

@ -0,0 +1 @@
briefcase dev

View File

@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
import os,shutil
from sys import platform
print("更新执行位置...")
if platform == 'win32':
try:
os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')]+'src\\')
print("更新执行位置,当前文件位置"+__file__)
except:
pass
else:
try:
os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('/')]+'src/')
except:
pass
print("其他平台:"+platform+"更新执行位置,当前文件位置"+__file__)
print('完成!')
try:
import toga,amulet
except:
print("You'd better install the libraries of this app\nNow, we're helping you with this.")
from src.musicreater.msctspt.bugReporter import version
version.installLibraries(version)
if platform == 'win32':
os.system("python ./Musicreater.py")
elif platform == 'linux':
os.system("python3 ./Musicreater.py")
try:
if os.path.exists("./log/"):
shutil.rmtree("./log/")
if os.path.exists("./logs/"):
shutil.rmtree("./logs/")
if os.path.exists("./cache/"):
shutil.rmtree("./cache/")
except:
print("无法清除日志及临时文件")

Binary file not shown.

49
pyproject.toml Normal file
View File

@ -0,0 +1,49 @@
[tool.briefcase]
project_name = "Musicreater"
bundle = "com.ryoun.musicreater"
version = "0.0.1"
url = "https://musicreater.ryoun.com/musicreater"
license = "Apache Software License"
author = 'Eilles Wan'
author_email = "W-YI_DoctorYI@outlook.com"
[tool.briefcase.app.musicreater]
formal_name = "Musicreater"
description = "Musicreater is an Eilles's app that is used for creating musics in Minecraft: Bedrock Edition"
icon = "src/musicreater/resources/musicreater"
sources = ['src/musicreater']
requires = []
[tool.briefcase.app.musicreater.macOS]
requires = [
'toga-cocoa>=0.3.0.dev20',
]
[tool.briefcase.app.musicreater.linux]
requires = [
'toga-gtk>=0.3.0.dev20',
]
system_requires = [
'libgirepository1.0-dev',
'libcairo2-dev',
'libpango1.0-dev',
'libwebkitgtk-3.0-0',
'gir1.2-webkit-3.0',
]
[tool.briefcase.app.musicreater.windows]
requires = [
'toga-winforms>=0.3.0.dev20',
]
# Mobile deployments
[tool.briefcase.app.musicreater.iOS]
requires = [
'toga-iOS>=0.3.0.dev20',
]
[tool.briefcase.app.musicreater.android]
requires = [
'toga-android>=0.3.0.dev20',
]

View File

@ -21,8 +21,8 @@ import tkinter.filedialog
import tkinter.messagebox import tkinter.messagebox
import tkinter.simpledialog import tkinter.simpledialog
from msctspt.threadOpera import NewThread from musicreater.msctspt.threadOpera import NewThread
from nmcsup.vers import VER from musicreater.nmcsup.vers import VER
@ -154,7 +154,7 @@ print("完成")
def __main__(): def __main__():
'''音·创 本体\n '''音·创 Tkinter窗口构建 本体\n
W-YI 金羿\n W-YI 金羿\n
QQ 2647547478\n QQ 2647547478\n
· 开发交流群 861684859\n · 开发交流群 861684859\n
@ -168,7 +168,7 @@ def __main__():
print('载入日志功能...') print('载入日志功能...')
from nmcsup.log import log from musicreater.nmcsup.log import log
print('完成!') print('完成!')
@ -197,7 +197,7 @@ def __main__():
print("载入文件读取函数") print("载入文件读取函数")
def ReadFile(fn:str) -> list: def ReadFile(fn:str) -> list:
from nmcsup.nmcreader import ReadFile as fileRead from musicreater.nmcsup.nmcreader import ReadFile as fileRead
k = fileRead(fn) k = fileRead(fn)
if k == False : if k == False :
tk.messagebox.showerror(title='错误', message="找不到文件😢:"+fn) tk.messagebox.showerror(title='错误', message="找不到文件😢:"+fn)
@ -207,7 +207,7 @@ def __main__():
def ReadMidi(midfile:str) -> str: def ReadMidi(midfile:str) -> str:
from nmcsup.nmcreader import ReadMidi as midiRead from musicreater.nmcsup.nmcreader import ReadMidi as midiRead
k = midiRead(midfile) k = midiRead(midfile)
if k == False : if k == False :
tk.messagebox.showerror(title='错误', message="找不到文件或无法读取文件😢:"+midfile) tk.messagebox.showerror(title='错误', message="找不到文件或无法读取文件😢:"+midfile)
@ -317,7 +317,7 @@ def __main__():
else: else:
fn = fn[0] fn = fn[0]
log("读取文件:"+fn) log("读取文件:"+fn)
from nmcsup.nmcreader import ReadOldProject from musicreater.nmcsup.nmcreader import ReadOldProject
dataset[0] = ReadOldProject(fn) dataset[0] = ReadOldProject(fn)
@ -406,8 +406,8 @@ def __main__():
else: else:
mp3file = mp3file[0] mp3file = mp3file[0]
log("转换mp3文件"+mp3file) log("转换mp3文件"+mp3file)
from nmcsup.nmcreader import ReadMidi from musicreater.nmcsup.nmcreader import ReadMidi
from nmcsup.trans import Mp32Mid from musicreater.nmcsup.trans import Mp32Mid
if not os.path.exists('./Temp/'): if not os.path.exists('./Temp/'):
os.makedirs('./Temp/') os.makedirs('./Temp/')
Mp32Mid(mp3file,'./Temp/Trans.mid') Mp32Mid(mp3file,'./Temp/Trans.mid')
@ -499,7 +499,7 @@ def __main__():
for i in dat.split(" "): for i in dat.split(" "):
datas.append([str(i), 1.0]) datas.append([str(i), 1.0])
log('音符数据写入'+str(datas)) log('音符数据写入'+str(datas))
from nmcsup.trans import note2list from musicreater.nmcsup.trans import note2list
datat = DMM() datat = DMM()
datat['notes'] = note2list(datas) datat['notes'] = note2list(datas)
dataset[0]['musics'].append(datat) dataset[0]['musics'].append(datat)
@ -518,13 +518,13 @@ def __main__():
def ShowCMD(): def ShowCMD():
log("展示指令") log("展示指令")
global NowMusic global NowMusic
from nmcsup.trans import Note2Cmd from musicreater.nmcsup.trans import Note2Cmd
RefreshCMDList(Note2Cmd(dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['ScoreboardName'],dataset[0]['musics'][NowMusic]['set']['Instrument'],dataset[0]['mainset']['PlayerSelect'])) RefreshCMDList(Note2Cmd(dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['ScoreboardName'],dataset[0]['musics'][NowMusic]['set']['Instrument'],dataset[0]['mainset']['PlayerSelect']))
def MakeCMD(): def MakeCMD():
log("生成文件") log("生成文件")
from msctspt.funcOpera import makeFuncFiles from musicreater.msctspt.funcOpera import makeFuncFiles
file = tkinter.filedialog.askdirectory(title='请选择文件生成的位置', initialdir=r'./') file = tkinter.filedialog.askdirectory(title='请选择文件生成的位置', initialdir=r'./')
if file == None or file =='': if file == None or file =='':
log("取消") log("取消")
@ -535,7 +535,7 @@ def __main__():
def MakeCMDdir(): def MakeCMDdir():
log("生成函数包") log("生成函数包")
from msctspt.funcOpera import makeFunDir from musicreater.msctspt.funcOpera import makeFunDir
file = tkinter.filedialog.askdirectory(title='请选择文件夹生成的位置', initialdir=r'./') file = tkinter.filedialog.askdirectory(title='请选择文件夹生成的位置', initialdir=r'./')
if file == None or file =='': if file == None or file =='':
log("取消") log("取消")
@ -551,7 +551,7 @@ def __main__():
return; return;
import zipfile import zipfile
from msctspt.funcOpera import makeFunDir from musicreater.msctspt.funcOpera import makeFunDir
log("生成附加包文件") log("生成附加包文件")
if not os.path.exists('./temp/'): if not os.path.exists('./temp/'):
os.makedirs('./temp/') os.makedirs('./temp/')
@ -575,7 +575,7 @@ def __main__():
def ToBlockWorldEpt(): def ToBlockWorldEpt():
import zipfile import zipfile
from nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player from musicreater.nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16')
@ -608,7 +608,7 @@ def __main__():
#转为已存在的方块世界 #转为已存在的方块世界
def ToBlockWorld(): def ToBlockWorld():
from nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player from musicreater.nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16')
@ -654,7 +654,7 @@ def __main__():
return; return;
else: else:
Outdire+='/'+dataset[0]['mainset']['PackName']+'/'; Outdire+='/'+dataset[0]['mainset']['PackName']+'/';
from nmcsup.trans import Notes2Player from musicreater.nmcsup.trans import Notes2Player
for i in range(len(dataset[0]['musics'])): for i in range(len(dataset[0]['musics'])):
open(Outdire+dataset[0]['musics'][i]['set']['FileName']+'_'+str(i)+'.mcfunction','w',encoding='utf-8').writelines(Notes2Player(dataset[0]['musics'][i]['notes'],[dire[0],dire[1],dire[2]+i],{'Ent':dataset[0]['musics'][i]['set']['EntityName'],'Pls':dataset[0]['mainset']['PlayerSelect'],'Ins':dataset[0]['musics'][i]['set']['Instrument']})) open(Outdire+dataset[0]['musics'][i]['set']['FileName']+'_'+str(i)+'.mcfunction','w',encoding='utf-8').writelines(Notes2Player(dataset[0]['musics'][i]['notes'],[dire[0],dire[1],dire[2]+i],{'Ent':dataset[0]['musics'][i]['set']['EntityName'],'Pls':dataset[0]['mainset']['PlayerSelect'],'Ins':dataset[0]['musics'][i]['set']['Instrument']}))
@ -666,7 +666,7 @@ def __main__():
def ToCmdWorldEpt(): def ToCmdWorldEpt():
import zipfile import zipfile
from nmcsup.trans import Cmd2World, Note2Cmd from musicreater.nmcsup.trans import Cmd2World, Note2Cmd
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16'); dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16');
@ -692,7 +692,7 @@ def __main__():
#转为已存在的指令世界 #转为已存在的指令世界
def ToCmdWorld(): def ToCmdWorld():
from nmcsup.trans import Cmd2World, Note2Cmd from musicreater.nmcsup.trans import Cmd2World, Note2Cmd
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16')
@ -718,7 +718,7 @@ def __main__():
#函数输入指令块 #函数输入指令块
def func2World(): def func2World():
from nmcsup.trans import Cmd2World from musicreater.nmcsup.trans import Cmd2World
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16')
@ -744,9 +744,9 @@ def __main__():
log("分割大函数") log("分割大函数")
import uuid import uuid
from msctspt.funcOpera import funSplit from musicreater.msctspt.funcOpera import funSplit
from msctspt.transfer import hans2pinyin from musicreater.msctspt.transfer import hans2pinyin
from nmcsup.trans import Cmd2World from musicreater.nmcsup.trans import Cmd2World
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入执行链生成坐标:',initialvalue = '16 4 16'); dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入执行链生成坐标:',initialvalue = '16 4 16');
@ -808,7 +808,7 @@ def __main__():
def toScbBDXfile(): def toScbBDXfile():
from msctspt.transfer import note2bdx from musicreater.msctspt.transfer import note2bdx
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入执行链生成相对坐标:',initialvalue = '0 0 0'); dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入执行链生成相对坐标:',initialvalue = '0 0 0');
@ -835,7 +835,7 @@ def __main__():
def wsPlay(): def wsPlay():
from msctspt.transfer import note2webs from musicreater.msctspt.transfer import note2webs
spd = tkinter.simpledialog.askfloat("输入播放速度",prompt='一秒,音乐走几拍?',initialvalue = '5.0') spd = tkinter.simpledialog.askfloat("输入播放速度",prompt='一秒,音乐走几拍?',initialvalue = '5.0')
tkinter.messagebox.showinfo(title="创建中", message="请在游戏中使用connect指令连接localhost:8080即可播放"); tkinter.messagebox.showinfo(title="创建中", message="请在游戏中使用connect指令连接localhost:8080即可播放");
note2webs(dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['Instrument'],spd,dataset[0]['mainset']['PlayerSelect']) note2webs(dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['Instrument'],spd,dataset[0]['mainset']['PlayerSelect'])
@ -847,7 +847,7 @@ def __main__():
def toRSworldEPT(): def toRSworldEPT():
import zipfile import zipfile
from msctspt.transfer import note2RSworld from musicreater.msctspt.transfer import note2RSworld
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16'); dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16');
@ -873,7 +873,7 @@ def __main__():
def toRSworld(): def toRSworld():
from msctspt.transfer import note2RSworld from musicreater.msctspt.transfer import note2RSworld
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16')
@ -927,7 +927,7 @@ def __main__():
if fileName == None or fileName == '': if fileName == None or fileName == '':
log("取消") log("取消")
return; return;
from msctspt.transfer import ryStruct from musicreater.msctspt.transfer import ryStruct
rys = ryStruct(outdir) rys = ryStruct(outdir)
rys.world2Rys(begp,endp,isAir) rys.world2Rys(begp,endp,isAir)
try: try:
@ -958,7 +958,7 @@ def __main__():
#使用邮件反馈bug #使用邮件反馈bug
def sendBugReport(): def sendBugReport():
from msctspt.bugReporter import report from musicreater.msctspt.bugReporter import report
name = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的称呼') name = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的称呼')
contact = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的联系方式') contact = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的联系方式')
describetion = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您对问题的描述') describetion = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您对问题的描述')
@ -1106,7 +1106,7 @@ def __main__():
def changeInstrument(event): def changeInstrument(event):
from nmcsup.const import Instuments as inst from musicreater.nmcsup.const import Instuments as inst
global NowMusic global NowMusic
while(True): while(True):
instemp = tkinter.simpledialog.askstring(title='修改节设置', prompt='修改本音轨所用乐器:', initialvalue='note.harp') instemp = tkinter.simpledialog.askstring(title='修改节设置', prompt='修改本音轨所用乐器:', initialvalue='note.harp')
@ -1242,7 +1242,7 @@ def __main__():
from nmcsup.vers import resetver from musicreater.nmcsup.vers import resetver
# 创建帮助菜单 # 创建帮助菜单
helpmenu = tk.Menu(main_menu_bar, tearoff=0) helpmenu = tk.Menu(main_menu_bar, tearoff=0)

View File

@ -0,0 +1 @@
briefcase

View File

@ -0,0 +1,10 @@
Metadata-Version: 2.1
Briefcase-Version: 0.3.5
Name: musicreater
Formal-Name: Musicreater
App-ID: com.ryoun.musicreater.musicreater
Version: 0.0.1
Home-page: https://musicreater.ryoun.com/musicreater
Author: Eilles Wan
Author-email: W-YI_DoctorYI@outlook.com
Summary: Musicreater is an Eilles's app that is used for creating musics in Minecraft: Bedrock Edition

364
src/musicreater/Cmd_Msct.py Normal file
View File

@ -0,0 +1,364 @@
# -*- coding: utf-8 -*-
# W-YI 金羿
# QQ 2647547478
# 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com
# 版权所有 Team-Ryoun 金羿
# 若需转载或借鉴 请附作者
# 代码写的并非十分的漂亮还请大佬多多包涵本软件源代码依照Apache软件协议公开
import json
import os
import shutil
import threading
import sys
from musicreater.msctspt.threadOpera import NewThread
from musicreater.msctspt.bugReporter import version
from musicreater.nmcsup.log import log
__version__ = version.version[1]+version.version[0]
__author__ = 'W-YI (金羿)'
log("系统工作————————加载变量及函数")
print("更新执行位置...")
if sys.platform == 'win32':
os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')])
log("更新执行位置,当前文件位置"+__file__)
else:
try:
os.chdir(__file__[:len(__file__) -
__file__[len(__file__)::-1].index('/')])
except:
pass
log("其他平台:"+sys.platform+"更新执行位置,当前文件位置"+__file__)
print('完成!')
print('建立变量,存入内存,载入字典常量函数')
# 主体部分
# 支持多文件同时操作
# dataset[{ 'mainset':{ 'x':'y' }, 'musics': [ { 'set' :{ 'A':'B' } , 'note' : [ [ 'a' , b ], ] }, ] }, ]
# 编辑:
# 修改主设置: dataset[第几个项目]['mainset']['什么设置'] = '设置啥'
# 修改音乐: dataset[第几个项目]['musics'][第几个音轨]['notes'][第几个音符][音符还是时间01] = 改成啥
# 修改音轨设置: dataset[第几个项目]['musics'][第几个音轨]['set']['什么设置'] = '设置啥'
#
# 新增音轨: dataset[第几个项目]['musics'].append(datasetmodelpart)
#
'''
dataset=[
{
'mainset':{
'PackName':"Ryoun",
'MusicTitle':'Noname',
'IsRepeat':False,
'PlayerSelect':''
},
'musics':[
{
'set':{
'EntityName':'music_support',
'ScoreboardName':'music_support',
'Instrument':'harp',
'FileName':"Music"
},
'notes':[
[0.0,1.0],
]
},
],
},
]
'''
global dataset
dataset = [
{
'mainset': {
'PackName': "Ryoun",
'MusicTitle': 'Noname',
'IsRepeat': False,
'PlayerSelect': ''
},
'musics': [
{
'set': {
'EntityName': 'MusicSupport',
'ScoreboardName': 'MusicSupport',
'Instrument': 'note.harp',
'FileName': "Music"
},
'notes': [
[0.0, 1.0],
]
},
],
},
]
global is_new_file
global is_save
global ProjectName
global NowMusic
is_new_file = True
is_save = True
ProjectName = ''
NowMusic = 0
def DMM(): # 反回字典用于编辑
datasetmodelpart = {
'set': {
'EntityName': 'MusicSupport',
'ScoreboardName': 'MusicSupport',
'Instrument': 'note.harp',
'FileName': "Music"
},
'notes': []
}
return datasetmodelpart
print("完成")
# 菜单命令
print('加载菜单命令...')
def exitapp(cmd):
log("程序正常退出", False)
global is_save
if is_save == False:
if '/s' in cmd:
saveProject()
else:
print("您尚未保存,请使用 /s 开关保存并退出")
return False
try:
global dataset
del dataset
except:
pass
if '/c' in cmd:
print("清除log此句不载入日志")
try:
if os.path.exists("./log/"):
shutil.rmtree("./log/")
if os.path.exists("./logs/"):
shutil.rmtree("./logs/")
if os.path.exists("./cache/"):
shutil.rmtree("./cache/")
except:
print("无法清除日志及临时文件")
exit()
print('退出函数加载完成!')
print("载入文件读取函数")
def ReadFile(fn: str):
from nmcsup.nmcreader import ReadFile as fileRead
k = fileRead(fn)
if k == False:
log("找不到"+fn)
return False
else:
return k
def ReadMidi(midfile: str):
from nmcsup.nmcreader import ReadMidi as midiRead
k = midiRead(midfile)
if k == False:
log("找不到"+midfile)
return False
else:
return k
print('完成!')
print("载入命令函数")
def saveProject(cmd: list):
global is_new_file
if '/a' in cmd:
log("另存项目")
ProjectName = cmd[cmd.index('/a')+1]
else:
if is_new_file:
print("初次存储请使用 /a 开关规定存储文件名")
log("文件未保存")
return False
log("存储文件:"+ProjectName)
with open(ProjectName, 'w', encoding='utf-8') as f:
json.dump(dataset[0], f)
global is_save
is_save = True
print('保存项目函数加载完成!')
def loadMusic(cmd: list):
if '/mid' in cmd:
th = NewThread(ReadMidi, (cmd[cmd.index('/mid')+1],))
th.start()
def midiSPT(th):
for i in th.getResult():
datas = DMM()
datas['notes'] = i
dataset[0]['musics'].append(datas)
del th
global is_save
is_save = False
threading.Thread(target=midiSPT, args=(th,)).start()
del th
elif '/txt' in cmd:
th = NewThread(ReadFile, (cmd[cmd.index('/txt')+1],))
th.start()
def midiSPT(th):
for i in th.getResult():
datas = DMM()
datas['notes'] = i
dataset[0]['musics'].append(datas)
del th
global is_save
is_save = False
threading.Thread(target=midiSPT, args=(th,)).start()
elif '/input' in cmd:
datas = []
for i in cmd[cmd.index('/input')+1:]:
datas.append([str(i), 1.0])
from nmcsup.trans import note2list
datat = DMM()
datat['notes'] = note2list(datas)
dataset[0]['musics'].append(datat)
del datas, datat
global is_save
is_save = False
else:
log("无参数,无法读入。")
print("请查看帮助文件查看指令格式。")
return False
print('音轨载入函数加载完成!')
def funBuild(cmd: list):
if '/file' in cmd:
from msctspt.funcOpera import makeFuncFiles
makepath = cmd[cmd.index('/file')+1]
if makepath[-1] != '/':
makepath += '/'
makeFuncFiles(dataset[0], makepath)
elif '/directory' in cmd:
from msctspt.funcOpera import makeFunDir
makepath = cmd[cmd.index('/directory')+1]
if makepath[-1] != '/':
makepath += '/'
makeFunDir(dataset[0], makepath)
elif '/mcpack' in cmd:
import zipfile
from msctspt.funcOpera import makeFunDir
makepath = cmd[cmd.index('/mcpack')+1]
if makepath[-1] != '/':
makepath += '/'
if not os.path.exists('./temp/'):
os.makedirs('./temp/')
makeFunDir(dataset[0], './temp/')
shutil.move('./temp/'+dataset[0]['mainset']['PackName'] +
"Pack/behavior_packs/"+dataset[0]['mainset']['PackName']+"/functions", './')
shutil.move('./temp/'+dataset[0]['mainset']['PackName'] + "Pack/behavior_packs/" +
dataset[0]['mainset']['PackName']+"/manifest.json", './')
with zipfile.ZipFile(makepath+dataset[0]['mainset']['PackName']+'.mcpack', "w") as zipobj:
for i in os.listdir('./functions/'):
zipobj.write('./functions/'+i)
zipobj.write('./manifest.json')
shutil.move('./functions', './temp/')
shutil.move('./manifest.json', './temp/')
shutil.rmtree("./temp/")
else:
log("无参数,无法读入。")
print("请查看帮助文件查看指令格式。")
return False
print("函数建立函数加载完成")
def __main__():
if sys.platform == 'win32':
os.system("cls")
else:
os.system("clear")
if sys.platform in ('win32', 'linux'):
print("您当前的运行环境为标准桌面,您可以打开 Musicreater.py 运行窗口模式的 音·创")
print("您也可以输入 win 指令在不退出命令行模式的同时打开窗口模式\n")
print(__author__+" 音·创 —— 当前核心版本 "+__version__+'\n')
nowWorkPath = os.path.split(os.path.realpath(__file__))[0]
while True:
strcmd = input("MSCT "+nowWorkPath+">")
cmd = strcmd.lower().split(' ')
if cmd[0] == 'exit':
exitapp(cmd[1:])
elif cmd[0] == 'save':
saveProject(cmd[1:])
elif cmd[0] == 'load':
loadMusic(cmd[1:])
elif cmd[0] == 'win':
def run(cmd):
os.system(cmd)
if sys.platform == 'win32':
NewThread(run, ("python "+os.path.split(os.path.realpath(__file__))
[0]+"/Musicreater.py",)).start()
else:
NewThread(run, ("python3 "+os.path.split(os.path.realpath(__file__))
[0]+"/Musicreater.py",)).start()
elif cmd[0] == 'chdir':
nowWorkPath = os.path.realpath(cmd[1])
os.chdir(nowWorkPath)
elif cmd[0] == 'build':
funBuild(cmd[1:])
else:
os.system(strcmd)
if __name__ == '__main__':
__main__

View File

@ -0,0 +1,4 @@
from musicreater.app import main
if __name__ == '__main__':
main().main_loop()

133
src/musicreater/app.py Normal file
View File

@ -0,0 +1,133 @@
"""
·(Musicreater)是由金羿(W-YI)开发的一款我的世界基岩版音乐生成辅助软件
"""
# W-YI 金羿
# QQ 2647547478
# 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com
# 版权所有 Team-Ryoun 金羿
# 若需转载或借鉴 请附作者
# 代码写的并非十分的漂亮还请大佬多多包涵本软件源代码依照Apache软件协议公开
import sys
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
from musicreater.Cmd_Msct import *
from musicreater.msctspt.bugReporter import version
from musicreater.resources.ChineseLang import LANGUAGE
__version__ = version.version[1]+version.version[0]
__author__ = 'W-YI (金羿)'
if sys.platform == 'win32':
os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')])
log("更新执行位置,当前文件位置"+__file__)
else:
try:
os.chdir(__file__[:len(__file__) -
__file__[len(__file__)::-1].index('/')])
except:
pass
log("其他平台:"+sys.platform+"更新执行位置,当前文件位置"+__file__)
class Musicreater(toga.App):
'''音·创 本体\n
W-YI 金羿\n
QQ 2647547478\n
· 开发交流群 861684859\n
Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com\n
版权所有 Team-Ryoun 金羿\n
若需转载或借鉴 请附作者\n
'''
def startup(self):
# Start to draw the window
main_box = toga.Box(style=Pack(direction=COLUMN))
self.noticeLabel = toga.Label('MSCT >>>',style=Pack(padding=(0, 5)))
self.inputBox = toga.TextInput(style=Pack(flex=1))
#dispImage = toga.ImageView("./resources/oddevenmatrix.png")
cmd_box = toga.Box(style=Pack(direction=ROW, padding=5))
cmd_box.add(self.noticeLabel)
cmd_box.add(self.inputBox)
# cmd_box.add(dispImage)
button = toga.Button(
LANGUAGE['main']['run'],
on_press=self.showMessage,
style=Pack(padding=5)
)
main_box.add(cmd_box)
main_box.add(button)
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = main_box
self.main_window.show()
self.main_window.info_dialog('',"{} {} —— {} {}".format(__author__,LANGUAGE['main']['name'],LANGUAGE['main']['version'],__version__))
self.nowWorkPath = os.path.split(os.path.realpath(__file__))[0]
def showMessage(self, widget):
strcmd = self.inputBox.value
cmd = strcmd.lower().split(' ')
if cmd[0] == 'exit':
if exitapp(cmd[1:]) == False:
self.main_window.info_dialog('',LANGUAGE['command']['FormatError'])
elif cmd[0] == 'save':
if saveProject(cmd[1:]) == False:
self.main_window.info_dialog('',LANGUAGE['command']['FormatError'])
elif cmd[0] == 'load':
if loadMusic(cmd[1:]) == False:
self.main_window.info_dialog('',LANGUAGE['command']['FormatError'])
elif cmd[0] == 'chdir':
self.main_window.info_dialog('',LANGUAGE['command']['NotAvailable'])
return
nowWorkPath = os.path.realpath(cmd[1])
os.chdir(nowWorkPath)
elif cmd[0] == 'build':
if funBuild(cmd[1:]) == False:
self.main_window.info_dialog('',LANGUAGE['command']['FormatError'])
else:
return
os.system(strcmd)
def main():
return Musicreater()

View File

@ -0,0 +1,2 @@
00:13:19 更新执行位置当前文件位置F:\W-YI\Programming\音·创\程序\src\musicreater\Cmd_Msct.py
00:13:19 更新执行位置当前文件位置F:\W-YI\Programming\音·创\程序\src\musicreater\app.py

View File

@ -59,7 +59,7 @@ class report():
from email.mime.text import MIMEText; from email.mime.text import MIMEText;
from email.mime.multipart import MIMEMultipart; from email.mime.multipart import MIMEMultipart;
from email.header import Header; from email.header import Header;
from nmcsup.log import log from musicreater.nmcsup.log import log
log("发送错误报告") log("发送错误报告")
import os; import os;
log("添加标题与正文") log("添加标题与正文")
@ -81,7 +81,6 @@ class report():
try: try:
smtp = smtplib.SMTP() smtp = smtplib.SMTP()
smtp.connect("smtp.163.com"); smtp.connect("smtp.163.com");
#smtp.login("RyounDevTeam@163.com","RyounDaiYi99");
#SIQQKQQYCZRVIDFJ是授权密码 #SIQQKQQYCZRVIDFJ是授权密码
smtp.login("RyounDevTeam@163.com","SIQQKQQYCZRVIDFJ"); smtp.login("RyounDevTeam@163.com","SIQQKQQYCZRVIDFJ");
smtp.sendmail("RyounDevTeam@163.com",["RyounDevTeam@163.com",],msg.as_string()) smtp.sendmail("RyounDevTeam@163.com",["RyounDevTeam@163.com",],msg.as_string())
@ -100,15 +99,15 @@ class report():
class version: class version:
libraries = ('mido','amulet','amulet-core','amulet-nbt','piano_transcription_inference','pypinyin','briefcase','toga','pyinstaller','py7zr','websockets','torch') libraries = ('mido','amulet','amulet-core','amulet-nbt','piano_transcription_inference','pypinyin','briefcase','toga','pyinstaller','py7zr','websockets','torch')
'''当前所需库,有一些是开发用的,用户不需要安装''' '''当前开发所需库'''
version = ('0.0.4.3','Beta',) version = ('0.0.0','Gamma',)
'''当前版本''' '''当前版本'''
def __init__(self) -> None: def __init__(self) -> None:
self.libraries = version.libraries self.libraries = version.libraries
'''当前所需库,有一些是开发用的,用户不需要安装''' '''当前开发所需库'''
self.version = version.version self.version = version.version
'''当前版本''' '''当前版本'''

View File

@ -2,7 +2,6 @@
"""音·创 的函数操作和一些其他功能""" """音·创 的函数操作和一些其他功能"""
from nmcsup.log import log
@ -107,8 +106,9 @@ def funSplit(bigFile,maxCmdLen : int = 10000 ):
def makeFuncFiles(musicset, path='./'): def makeFuncFiles(musicset, path='./'):
from musicreater.nmcsup.log import log
'''在指定目录下生成函数文件''' '''在指定目录下生成函数文件'''
from nmcsup.trans import Note2Cmd from musicreater.nmcsup.trans import Note2Cmd
commands = [] commands = []
starts = [] starts = []
log("=========================正在在此处生成文件:"+path) log("=========================正在在此处生成文件:"+path)
@ -147,6 +147,7 @@ def makeFuncFiles(musicset, path='./'):
def makeFunDir(musicset, path='./'): def makeFunDir(musicset, path='./'):
from musicreater.nmcsup.log import log
'''在指定目录下生成函数包文件夹''' '''在指定目录下生成函数包文件夹'''
import os import os
import uuid import uuid

View File

@ -69,9 +69,9 @@ def note2bdx(filePath:str,dire:list,Notes : list,ScoreboardName:str,Instrument:s
:return 返回一个BdxConverter类实际上没研究过同时在指定位置生成.bdx文件''' :return 返回一个BdxConverter类实际上没研究过同时在指定位置生成.bdx文件'''
from msctspt.transfer import formCmdBlock from musicreater.msctspt.transfer import formCmdBlock
from nmcsup.trans import Note2Cmd from musicreater.nmcsup.trans import Note2Cmd
from msctspt.bdxOpera_CP import BdxConverter from musicreater.msctspt.bdxOpera_CP import BdxConverter
cmd = Note2Cmd(Notes,ScoreboardName,Instrument, PlayerSelect,isProsess) cmd = Note2Cmd(Notes,ScoreboardName,Instrument, PlayerSelect,isProsess)
cdl = [] cdl = []
for i in cmd: for i in cmd:
@ -116,8 +116,8 @@ def note2webs(Notes : list,Instrument:str, speed:float = 5.0, PlayerSelect:str='
import time import time
import fcwslib import fcwslib
import asyncio import asyncio
from nmcsup.log import log from musicreater.nmcsup.log import log
from nmcsup.vers import VER from musicreater.nmcsup.vers import VER
async def run_server(websocket, path): async def run_server(websocket, path):
log('服务器连接创建') log('服务器连接创建')
@ -162,7 +162,7 @@ def note2RSworld(world:str,startpos:list,notes:list,instrument:str,speed:float =
''' '''
from msctspt.values import height2note,instuments from musicreater.msctspt.values import height2note,instuments
def formNoteBlock(note:int,instrument:str='note.harp',powered:bool = False): def formNoteBlock(note:int,instrument:str='note.harp',powered:bool = False):

View File

View File

@ -4,14 +4,14 @@
from nmcsup.log import log from musicreater.nmcsup.log import log
from nmcsup.const import notes from musicreater.nmcsup.const import notes
#从格式文本文件读入一个音轨并存入一个列表 #从格式文本文件读入一个音轨并存入一个列表
def ReadFile(fn : str) -> list: def ReadFile(fn : str) -> list:
from nmcsup.trans import note2list from musicreater.nmcsup.trans import note2list
log('打开'+fn+"并读取音符") log('打开'+fn+"并读取音符")
try: try:
nat = open(fn, 'r', encoding='UTF-8').read().split(" ") nat = open(fn, 'r', encoding='UTF-8').read().split(" ")
@ -31,7 +31,7 @@ def ReadFile(fn : str) -> list:
#从midi读入多个音轨返回多个音轨列表 #从midi读入多个音轨返回多个音轨列表
def ReadMidi(midfile : str ) -> list: def ReadMidi(midfile : str ) -> list:
import mido import mido
from msctspt.threadOpera import NewThread from musicreater.msctspt.threadOpera import NewThread
Notes = [] Notes = []
try: try:
mid = mido.MidiFile(midfile) mid = mido.MidiFile(midfile)
@ -70,7 +70,7 @@ def ReadMidi(midfile : str ) -> list:
def ReadOldProject(fn:str) -> list: def ReadOldProject(fn:str) -> list:
import json import json
from nmcsup.trans import note2list from musicreater.nmcsup.trans import note2list
log("读取文件:"+fn) log("读取文件:"+fn)
try: try:
with open(fn, 'r', encoding='UTF-8') as c: with open(fn, 'r', encoding='UTF-8') as c:

View File

@ -13,7 +13,7 @@ from nmcsup.log import log
# 输入一个列表 [ [str, float ], [], ... ] 音符str 值为持续时间float # 输入一个列表 [ [str, float ], [], ... ] 音符str 值为持续时间float
def note2list(Notes : list) -> list: def note2list(Notes : list) -> list:
from nmcsup.const import notes from musicreater.nmcsup.const import notes
def change(base): def change(base):
enwo = { enwo = {
'a': 'A', 'a': 'A',
@ -58,7 +58,7 @@ def note2list(Notes : list) -> list:
def mcnote2freq(Notes): def mcnote2freq(Notes):
from nmcsup.const import notes from musicreater.nmcsup.const import notes
mcnback = {} mcnback = {}
for i,j in notes.items(): for i,j in notes.items():
mcnback[j[0]] = i mcnback[j[0]] = i
@ -197,7 +197,7 @@ def Cmd2World(cmd:list,world:str,dire:list):
#音符转成方块再加载到世界里头 #音符转成方块再加载到世界里头
def Blocks2World(world:str,dire:list,Datas:list): def Blocks2World(world:str,dire:list,Datas:list):
from nmcsup.const import Blocks from musicreater.nmcsup.const import Blocks
level = amulet.load_level(world) level = amulet.load_level(world)
i = 0 i = 0
def setblock(block:str,pos:list): def setblock(block:str,pos:list):
@ -231,7 +231,7 @@ def Notes2Player(Note,dire:list,CmdData:dict):
for i in Note: for i in Note:
Notes[i[0]] = '' Notes[i[0]] = ''
Notes = list(Notes.keys()) Notes = list(Notes.keys())
from nmcsup.const import Blocks from musicreater.nmcsup.const import Blocks
Cmds = [] Cmds = []
for j in Notes: for j in Notes:
Cmds.append('execute @e[x='+str(dire[0])+',y='+str(dire[1])+',z='+str(dire[2])+',dy='+str(255-dire[1])+',name='+CmdData['Ent']+'] ~ ~ ~ detect ~ ~ ~ '+Blocks[j]+' 0 execute @a '+CmdData['Pls']+' ~ ~ ~ playsound '+CmdData['Ins']+' @s ~ ~ ~ 1000 '+str(j)+' 1000\n') Cmds.append('execute @e[x='+str(dire[0])+',y='+str(dire[1])+',z='+str(dire[2])+',dy='+str(255-dire[1])+',name='+CmdData['Ent']+'] ~ ~ ~ detect ~ ~ ~ '+Blocks[j]+' 0 execute @a '+CmdData['Pls']+' ~ ~ ~ playsound '+CmdData['Ins']+' @s ~ ~ ~ 1000 '+str(j)+' 1000\n')

View File

@ -2,7 +2,7 @@
from msctspt.bugReporter import version from musicreater.msctspt.bugReporter import version
#以下下两个值请在 msctspt/bugReporter 的version类中修改 #以下下两个值请在 msctspt/bugReporter 的version类中修改

View File

@ -0,0 +1,11 @@
LANGUAGE = {
'main':{
"name":"音·创",
"version":"当前版本",
"run":"执行指令",
},
'command':{
"NotAvailable":"此指令不可用。",
"FormatError":"指令格式错误,请查看 命令行操作.md 以查阅指令。"
}
}

View File

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

View File

@ -0,0 +1,11 @@
生命灵动 当用激情跃起奋发之力
奇偶数阵
学海无涯 应用爱意徜徉
在生命的起源寻找灵魂的慰藉
纪念那一段辉煌灿烂的青春年华
以梦想为驱使 创造属于自己的未来
集青春之力 绽放爱意之花
那个曾与我相伴的人 依稀在我的心头留恋
我爱你 我 爱 你
你是我灵魂中绽放出最艳丽的花朵
心之所向 意之所属

View File

@ -1,11 +1,13 @@
# -*- conding: utf8 -*- # -*- conding: utf8 -*-
import os import os
from msctspt.funcOpera import keepart from src.musicreater.msctspt.funcOpera import keepart
l = 0 l = 0
for path,dir_list,file_list in os.walk(r"./") : for path,dir_list,file_list in os.walk(r"./") :
for file_name in file_list: for file_name in file_list:
if keepart(file_name,'.',None) == '.py': if keepart(file_name,'.',None) == '.py':

View File

@ -1,2 +0,0 @@
from msctspt.bugReporter import version
version.installLibraries(version)